Lecture 3
- Compile Two C Assignments
- C is one level above assembler
- Change c program segment into MIPS assembly language:
a = b + c;- d = a – e;
- Solution
- Add a,b,c
- Sub d,a,e
- Add a,b,c
- C is one level above assembler
Data Path Memory: MIPS Registers
- Register = STORAGE LOCATION (ONE WORD LONG)
- 1 word long = 32 bits
- Numbered in reverse direction
- 32 registers
- named (each register has a unique specific name)
- each register has 32 bits
- why? We can't have too much memory because this memory is very expensive, and we don't want too few because we want to do interesting things. (broad answer)
- why? We can't have too much memory because this memory is very expensive, and we don't want too few because we want to do interesting things. (broad answer)
- each register has a specific name
- there are temporary registers and save registers
- 7 S registers
- Addressed like this: $t0
- Addressed like this: $t0
- 10 T registers
- Addressed like this: $s0
- Addressed like this: $s0
- named (each register has a unique specific name)
Main Memory as an Array of Words
- A 'word' is 4 bytes
- A byte is 8 bits
- A byte is 8 bits
- Big Endian is a 32 bit word
- The array structure G is imbedded in word memory array at Byte 16(base address)
- Word address of G[3] is base address + offset
- Base address = 16
- Offset = relative word * bytes/word = 3*4=12
Address of G[3] = 16+3*4 = 28
No comments:
Post a Comment