MIPS 立即指令 ori/addi/lui 等需要寄存器写入吗?
我正在学习 MIPS 中的流水线技术。我对即时指示及其指示流程有疑问。我一直在阅读 ori/addi/lui,并且是即时指令或 I 型。我还不断发现 I 型指令只需要 MIPS 5 阶段过程的前三个阶段。如下所示
|instruction memory|register read|ALU op|DataMemory|Register Write|
|------------------------------------------------------------------
addi| X | X | X | | |
-----------------------------------------------------------------------
ori | X | X | X | | |
-----------------------------------------------------------------------
lui | X | X | X | | |
-----------------------------------------------------------------------
我的问题是第一,这个表正确吗?我觉得奇怪的是,这些指令不需要写入寄存器来更改寄存器的内容。如果这张桌子不合适,有人可以帮我看看正确的桌子是什么样子吗?
I am learning about pipelining in MIPS. I had a question about immediate instructions and their instruction process. I keep reading that ori/addi/lui and are immediate instructions or I-type. I also keep finding that I-type instructions only require the first three stages of the of a MIPS 5-stage process. Like shown below
|instruction memory|register read|ALU op|DataMemory|Register Write|
|------------------------------------------------------------------
addi| X | X | X | | |
-----------------------------------------------------------------------
ori | X | X | X | | |
-----------------------------------------------------------------------
lui | X | X | X | | |
-----------------------------------------------------------------------
My question is first, is this table correct? I find it weird that these instructions do not require a register write to change the contents of the register. If this table is not right can someone help me with what the right table would look like?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
addi/ori/lui
等立即指令确实需要将其结果写入寄存器文件。例如:addi $dest、$src、immd_val
。对于该指令,操作数之一是立即数。因此计算结果为:$dest = $src + immd_val
。正如您所看到的,结果必须写回寄存器$dest
。您走在正确的轨道上,您需要适当修改您的表格。有些指令不需要将结果写回寄存器文件,如分支、存储、比较等。
The immediate instructions of
addi/ori/lui
and so on do need to write their results to the register file. For example:addi $dest, $src, immd_val
. For this instruction, one of the operands is an immediate value. So the computation will be,$dest = $src + immd_val
. As you can see the result has to be written back to register$dest
. You are on the right track, you need to modify your table suitably.There are some instructions that do not need to write-back the result to the register file like the branch, store, compare etc.