ECE 4436 Microprocessor Systems - PowerPoint PPT Presentation

1 / 30
About This Presentation
Title:

ECE 4436 Microprocessor Systems

Description:

Leading bit is not a sign bit although it does indicate whether # is negative or ... American Standard Code for Information ... MIPS Assembly Language ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 31
Provided by: DianaDe1
Category:

less

Transcript and Presenter's Notes

Title: ECE 4436 Microprocessor Systems


1
ECE 4436Microprocessor Systems
  • Wednesday January 24, 2001
  • Week 2 Lecture 3

2
Todays Agenda
  • Annoucements/News
  • E-mail/Slides
  • Quiz 0
  • Quiz 1
  • Review Quiz 1
  • Finish Mondays Slides
  • Overflow
  • Numbering bits bytes
  • Interpreting Binary Strings as keyboard
    characters
  • The ASCII Standard
  • MIPS Assembly Language
  • Background
  • Registers
  • Instruction Set
  • Instruction Formats
  • Assignment

3
Binary Strings as Binary s
  • For n bits
  • 0000 0000 ____
  • 0101 0101 ____
  • 1111 1111 ____
  • Range 0 to 2n-1 for n bits
  • For n8 (1 byte), range ____ to ____

4
Binary Strings as Twos Complement s
  • For n bits
  • Max positive value ? an-10 all other ai1
  • 011
  • Max negative value ? an-11 all other ai0
  • 100

5
Binary Strings as Twos Complement s
  • Range
  • -2n-1 to (2n-1-1)
  • for n 8 ___ to ___
  • Note
  • Range is asymmetrical
  • Leading bit is not a sign bit although it does
    indicate whether is negative or positive
  • Max positive value
  • Max negative value

6
Binary Strings as Twos Complement s
  • Examples
  • 00100110 __________
  • 11110101 __________
  • 11111111 __________
  • 1111111111111111111111111 _______

7
TCA Negation
  • -(i) i 1 where i ? ones complement
  • Note this operation is called Taking the twos
    complement
  • Examples
  • 0110 1101 1111 0110
  • Use this to find value of negative numbers!
    -(-i) i

8
TCA Addition
  • Examples (8-bit)
  • 7 10
  • (-7) 10
  • (-10) 7
  • For now, ignore the carry.

9
TCA Subtraction
  • Can always make subtraction an addition problem
    with signed numbers.
  • Question How is 2s complement (signed) binary
    arithmetic different from regular (unsigned)
    binary arithmetic?

1111 0110 - 0000 0111
What is this?
10
Overflow
  • Overflow occurs when you try to store a value
    that does not fit in the intended cell using the
    chosen representation.
  • Example Can you correctly store the values in
    the table in a nibble (4 bits)?

11
Overflow
  • Keys
  • Value
  • Representation
  • of bits in the cell
  • To find whether a value can be represented in a
    cell for a particular interpretation
  • Calculate range of legal values for cell
    size/representation
  • Determine whether value is in that range

12
Numbering Bits Bytes
  • Store the word OxABCDEF01 using
  • Little-Endian
  • Big-Endian

13
The ASCII Standard
Hex MSD 0 1 2 3 4 5 6
7 Hex LSD 0 NUL DLE SP
0 _at_ P ' p 1 SOH DC1
! 1 A Q a q 2 STX
DC2 " 2 B R b r 3
ETX DC3 3 C S c s 4
EOT DC4 4 D T d t
5 ENQ NAK 5 E U e u
6 ACK SYN 6 F V f
v 7 BEL ETB 7 G W
g w 8 BS CAN ( 8 H
X h x 9 HT EM ) 9
I Y i y A LF SUB
J Z j z B VT ESC
K k C FF
FS , lt L \ l D
CR GS _ M m E
SO RS . gt N n
F SI US / ? O - o DEL
14
The ASCII Standard
LSB
  • American Standard Code for Information
    Interchange
  • Only 7 bits are used
  • Note convenient ordering of letter/s
  • How would we represent the word WORD?
  • What about word?

MSB
15
The ASCII Standard
  • Program steps
  • Get keyboard input into memory
  • Convert ASCII coded s into binary
  • Perform operation
  • Convert result to ASCII code
  • Send output to monitor
  • Example
  • 13 from keyboard

16
MIPS Assembly Language
  • Review

I/O
CPU
Memory
Control
Datapath
17
MIPS Assembly Language
  • CPU Datapath (extremely simplified)

Operation
Registers
Operand 1
ALU
Operand 2
Result
18
MIPS Assembly Language
  • Background
  • ALU ? Arithmetic Logic Unit
  • ALU
  • Inputs 1 or 2 operands and an operation
  • Outputs result
  • Typical operations are
  • Arithmetic ADD, SUB, NEG, MUL, DIV
  • Logical AND, OR, XOR, NOT

19
MIPS Assembly Language
  • Registers
  • Storage within CPU
  • Very fast execution
  • Temporary storage, esp. for
  • Intermediate results
  • Addresses of data
  • Address data structures (stack)
  • Parameters
  • Return address
  • Frame pointer
  • Accessed explicitly by name

20
MIPS Assembly Language
  • In MIPS means a register
  • In Bare MIPS
  • 32 registers 0-31
  • 0 is hardwired to 0
  • 31 gets return address on subroutine calls
  • Rest of register set is general purpose, can be
    used for anything
  • Not case in X86 brands where most of registers
    have specific functions (more on that in Adv.
    MicroP)

21
MIPS Assembly Language
  • In MIPS assembly language programming, there is a
    usage convention (See Figures 3.13 A.10)
  • For now
  • zero 0
  • t0-t9 are use for temporary variables
  • s0-s7 are used for copies of variables
  • Note in programming, either will work. We will
    use usage convention for programs and 0-31 in
    hardware.

22
MIPS Assembly LanguageInstruction Set
  • 3 different instruction formats
  • I-type, R-type, J-type (well discuss first two
    for now)
  • R-type
  • Three register operands
  • Arithmetic logical opcodes
  • Format opcode Rd,Rs,Rt
  • Rd destination operand (output)
  • Rs source operand (input)
  • Rt source operand (input)

23
MIPS Assembly LanguageInstruction Set
  • R-type 6 fields
  • R-type at work
  • ADD t0,t1,t2
  • SUB t7,t8,t9

op (6)
rs (5)
rt (5)
rd (5)
shamt (5)
funct (6)
24
MIPS Assembly LanguageInstruction Set
  • I-type
  • Two registers and an immediate
  • Format opcode Rt,Rs,immediate
  • Rt destination operand
  • Rs source operand
  • Immediate a constant, also a source operand
  • Note immediate operand must fit into 16 bits!
    (Why?)

25
MIPS Assembly LanguageInstruction Set
  • I-type 4 fields
  • I-type at work
  • ADD t0,t1,32
  • SUB t7,t8,OxABCD

op (6)
rs (5)
rt (5)
address/immediate
26
Assignment for Monday
  • Check email for slides
  • HW1 due Monday
  • Search for big-endian at www.whatis.com web
    site
  • Have a Happy Chinese New Year!

27
Homework 1 (Part 1)
  • 1. Using the equation from slide 4, what is the
    integer decimal value of 1100 01002?
  • 2. Using the equation from slide 4, what is the
    integer decimal value of 0110 11102?
  • 3. Binary addition 10100110 01111100
  • 4. Binary subtraction 01110100 00101011 5.
    Binary multiplication 011 110
  • 6. Binary division 10110 / 111
  • 7. 01001 ? 10011 ?
  • 8. 01100 ? 01001 ?

28
Homework 1 (Part 1, cont.)
  • 9. 11100 ? 01010 ?
  • 10. ?1100001 ?
  • 11. Convert A58016 to binary.
  • 12. Convert 1011 0010 0001 01102 to hexidecimal.
  • 13. Convert 1010 10002 to unsigned binary.
  • 14. Convert 1010 10002 to signed binary.
  • 15. Take the 2s complement of 1101 10012.
  • 16. Compute using 8-bit 2s complement addition.
    Show work. 20 64 ?

29
Homework 1 (cont.)
  • 17. Will the value 25610 cause an overflow in
    8-bit binary representation?
  • 18. Will the value 25710 cause an overflow in
    8-bit binary representation?
  • 19. Will the value 12810 cause an overflow in
    7-bit 2s complement representation?
  • 20. Will the value -12810 cause an overflow in
    7-bit 2s complement representation?
  • 21. What is the hexidecimal representation of the
    phrase ECE 4436 (including double quotes!)

30
Homework 1 (cont.)
  • 22. If the number Ox3674F8A0 were to be stored
    beginning at address 1000, show how the values
    would be stored along with their address
    locations using little endian.
  • 23. If the number Ox3674F8A0 were to be stored
    beginning at address 1000, show how the values
    would be stored along with their address
    locations using big endian.
  • 24. Show the binary representation for the
    following instruction (the examples on the back
    cover of the book may help) and
    t3,t5,s2

31
Scratch Pad
Write a Comment
User Comments (0)
About PowerShow.com