Reputation: 8585
I have to implement jal instruction as pseudo-instruction without using J-Type instructions. I can implement it with jr but I know that jal stores current PC+8 in $ra. How can I implement that? How can I store PC address in ra without J-type?
Upvotes: 3
Views: 1167
Reputation: 6266
Try this:
la $ra, ret # load return address (pseudo instruction!)
j dest # call the function
nop # delay slot
ret: # return here
...
dest: # destination function
...
jr $ra
Upvotes: 1