Reputation:
I am trying to add jal functionality to the following but I am stuck with how does it work. I know that it stores the old PC+4
value in the $ra
register and then transfers the control to the function which transfers back the control by return $ra
but how do I implement it in the hardware?
Upvotes: 3
Views: 11065
Reputation: 909
We ad a new line that takes the PC+4 and sends it to the "Write Data" input of the register file. We need to add a multiplexer. We also need to make sure the "Write Register" field is set to the address of $RA. Register $RA is register number 31 most of the time.
Upvotes: 0
Reputation: 6266
There are two things you need to do.
Upvotes: 2