Professional Documents
Culture Documents
main
registers
CSE 410, Spring 2005 memory
http://www.cs.washington.edu/education/courses/410/05sp/
...
...
...
...
...
• Program counter (PC) points to the next
20
instruction
instruction 16
» All MIPS instructions are 4 bytes long, and so
addresses 12
instruction addresses are always multiples of 4
8
• Program addresses are 32 bits long
4 instruction value
» 232 = 4,294,967,296 = 4 GigaBytes (GB)
0 instruction value
Some common storage units Alignment
Note that a byte is 8 bits on almost all machines.
The definition of word is less uniform (4 and 8 bytes are common today). • An object in memory is “aligned” when its
address is a multiple of its size
A nibble is 4 bits (half a byte!)
unit
# • Byte: always aligned
bits
• Halfword: address is multiple of 2
byte 8
• Word: address is multiple of 4
half-word 16
• Double word: address is multiple of 8
word 32
• Alignment simplifies load/store hardware
double word 64
instructions and
• 32 bits wide
data » 32 bits is 4 bytes
program counter » same as a word in memory
increments by 4
» signed values from -231 to +231-1
main
memory
32-bit
instructions
registers » unsigned values from 0 to 232-1
• easy to access and manipulate
functional units
» 32 registers (not related to being 32 bits wide)
» on chip, so very fast to access
Register addresses Register numbers and names
• 32 general purpose registers number
0
name
zero
usage
always returns 0
• how many bits does it take to identify a 1 at reserved for use as assembler temporary
v0,
register? 2-3
v1 values returned by procedures
4-7 a0-a3 first few procedure arguments
» 5 bits, because 25 = 32 8-15, 24, 25 t0-t9 temps - can use without saving
instructions and
• Load instructions
data » word: lw rt, address
» half word:! lh rt, address
program counter ! ! ! lhu rt, address
increments by 4
program counter
• The contents of the base register and the increments by 4
Big endian - most significant bits are in byte 0 of the word Little endian - least significant bits are in byte 0 of the word
byte byte
contents contents
# #
...
...
...
...
...
...
...
...
...
...
7 67 7 01
12 12
6 45 6 23
8 8
5 23 5 45
4 01 23 45 67 4 01 23 45 67
4 01 4 67
0 0
0 1 2 3 byte offsets 3 2 1 0 byte offsets