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?
您需要做两件事。
- 在寄存器的输入端添加一个多路复用器,以便可以选择 PC+4 值作为要写入的数据。通过适当的控制信号,这将允许您写入 PC+4 作为“jal $ra”指令的附加效果。
- 执行返回“jr $ra”指令。您需要将一个多路复用器添加到选择下一个 PC 的逻辑链中,以便当指令为“jr xxx”时,可以从寄存器文件中选择“读取数据 1”作为下一个 PC。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)