MIPS 中的微编程

发布于 2024-11-18 21:26:05 字数 153 浏览 1 评论 0原文

我正在学习微编程,但对微指令实际上是什么感到困惑。我正在使用MIPS架构。我的问题如下

假设我有 ADD 指令,那么微指令会是什么样子? add指令有多少条微指令。网上有什么地方可以看到 MIPS 基本指令的微指令列表吗?

如何找出 ADD 微程序指令的位串?

I am learning about micro programming and am confused as to what a micro-instruction actually is. I am using the MIPS architecture. My questions are as follows

Say for example I have the ADD instruction, what would the micro-instructions look like for this? How many micro-instructions are there for the add instruction. Is there somewhere online I can see the list of micro-instructions for the basic instructions of MIPS?

How can I figure out the bit string for an ADD microprogrammed instruction?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

情场扛把子 2024-11-25 21:26:05

微编程是一种实现复杂指令集架构(例如x86)的方法就更简单的“微指令”而言。 MIPS 是 RISC 指令集架构,通常不使用微编程来实现,因此 ADD 指令的微指令为零。

要回答您的具体问题,我们必须知道您的特定微架构的定义是什么。

Microprogramming is a method of implementing a complex instruction set architecture (such as x86) in terms of simpler "micro instructions". MIPS is a RISC instruction set architecture and is not typically implemented using micro-programming, so there are ZERO microinstructions for the ADD instruction.

To answer your specific question one would have to know what the definition of your particular micro-architecture is.

寄人书 2024-11-25 21:26:05

这是如何将 EPC 加载到其中一个寄存器并向其中添加 4 个字节

lw      t0, 20(sp)      // Load EPC
addi    t0, 4           // Add 4 to the return adress
sw      t0, 20(sp)      // Save EPC

的示例:您可以使用“很多”指令,您可以 在此处查看 MIPS 指令集。以我的拙见,MIPS 确实简洁且易于学习!一个有趣的事实是,第一代 Playstation 使用的是 MIPS CPU。

示例说明

  • lw = 加载单词
  • la = 加载地址
  • sw = 保存单词
  • addi = add immidate

然后你有很多条件指令,例如:

  • bne = 分支不等于
  • bnez = 分支不等于 0

有了这些你就可以使用 j 跳转到某个地址。

这是我为 MIPS 编写的异常处理程序的一个示例,这是外部源处理程序:

External: 
        mfc0    t0, C0_CAUSE        // We could aswell use 24(sp) to load CAUSE
        and     t0, t0, 0x02000     // Mask the CAUSE
        bnez    t0, Puls            // If the only character left is 
                                    // "not equal zero" jump to Puls

        j   DisMiss                 // Else jump to DisMiss

在上面的示例中,我定义了一个名为 External 的入口点,我可以跳转到该入口点,就像我所做的那样DisMiss 循环,通常会跳转到自己。

这里还使用了一些其他指令:

  • mfc0 = 从协处理器 0 移动

要处理标签,我建议您检查一下这个问题/答案。

这里有一些关于使用 MIPS 进行微编程的资源:

This is an example of how to load the EPC into one of the registers and add 4-bytes to it:

lw      t0, 20(sp)      // Load EPC
addi    t0, 4           // Add 4 to the return adress
sw      t0, 20(sp)      // Save EPC

There are "a lot" of instructions that you can use, you can see the MIPS Instruction Set here. In my humble opinion, MIPS is Really neat and easy to learn! A fun fact is that the first Playstation used a MIPS CPU.

Example instructions

  • lw = load word
  • la = load address
  • sw = save word
  • addi = add immidate

Then you have a lot of conditional instructions such as:

  • bne = branch not equal
  • bnez = branch not equal zero

And with these you use j to jump to an adress.

Here is an example from an Exception Handler that I wrote once for MIPS, this is the External Source handler:

External: 
        mfc0    t0, C0_CAUSE        // We could aswell use 24(sp) to load CAUSE
        and     t0, t0, 0x02000     // Mask the CAUSE
        bnez    t0, Puls            // If the only character left is 
                                    // "not equal zero" jump to Puls

        j   DisMiss                 // Else jump to DisMiss

In the above example I define an entry point called External that I can jump to, as I do with DisMiss to loop, you generally jump to yourself.

There are some other instructions used here aswell:

  • mfc0 = move from co-processor 0

To handle labels, I would suggest you check this question/answer out.

Here's a couple of resources on MicroProgramming with MIPS:

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