开发者

Microprogramming in MIPS

开发者 https://www.devze.com 2023-03-16 23:43 出处:网络
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

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?


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.


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:

  • Some general information
  • Here is a bit more heavy power-point presentation on the subject from Princton ( PDF )
  • Here is a paper from another university which is one of the best of these three ( PDF ).
0

精彩评论

暂无评论...
验证码 换一张
取 消