EE488 Computer Architecture Homework
EE488 Computer Architecture Homework
add a0,a,r0
add a1,b,r0
add a2,c,r0
jal myfunction
add mydata,$v0,r0
2. List all the key registers, used in a stack call, by their compiler name and their physical register
number (i.e. r0)
Compiler name
$v0
$v1
$a0
$a1
$a2
$a3
$sp
$ra
Physical register
number
r2
r3
r4
r5
r6
r7
r29
r31
3. Show the RTL notation for how the JAL instruction works.
JAL offset
jump and Link
R31PC+4
PC (PC+4)+offset
4. Show the RTL notation for how the JR instruction works.
JR r31
Jump register
(PC R31)
5. The JAL instruction automatically performs 2 task does it matter which order the task occur?
Briefly support your answer.
Yes, order matters. You must save R31 first to preserve the return address. If you branch first,
then the PC register will be altered and you will lose the return address.
0x10001AEC
0x1000182C
instruction
JAL 0x2C0