address 0 at the top of this diagram
| |<-$sp | |<-$sp
--------------- --------------
| $a0 | | param 5 | ---
--------------- -------------- |
| $a1 | | $a3 | |
--------------- -------------- |
| $a2 | | $a2 | |--- space allocated
--------------- -------------- | by procedure A
| $a3 | | $a1 | |
--------------- -------------- |
| param 5 | | $a0 | |
--------------- -------------- |
| $ra | | $ra | ---
--------------- --------------
| | | |
--------------- --------------
| | | |
--------------- --------------
| | | |
--------------- --------------
Assume that A calls B, and A gives B 5 arguments. Procedure A then
calls C, and A gives C 2 arguments. Using these assumptions, which
of these orders (diagram on left or diagram on right) ought to be used? Why?
X is assigned address 0xcc00faa0.
lw $8, X
move $9, $10
putc $11
rem $12, $13, $4
label1: sb $10, -20($10)
la $12, label1
addi $8, $9, -9
j label1
Address (contents in hex) (contents in binary)
---------- ----------------- ----------------------------------
0x08040cd0 0x
0x08040cd4 0x
0x08040cd8 0x
0x08040cdc 0x
bne $8, $10, while_loop
at address 0x0800aa04.
The address for label while_loop is assigned to be 0x0800ac00.
Give machine code for the branch instruction (in both hexadecimal and in
binary).
For partial credit, show how you generate the offset field within the
branch instruction.
Turn in your file containing answers by running the script:
handinHW4 hw4file
where hw4file is an example name of a file
containing the homework answers.
The handinHW script submits your homework for you.
No printout will be turned in.