MIPS 立即指令 ori/addi/lui 等需要寄存器写入吗?

发布于 2024-11-19 16:24:00 字数 807 浏览 3 评论 0原文

我正在学习 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

萌能量女王 2024-11-26 16:24:00

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文