I can't seem to find the explanation for why all r-type instructions have opcode 0 always. Can anybody explain why this is so.


In designing an ISA, there are many tradeoffs that can/need to be taken. This makes it slightly challenging to answer why questions but I will do my best.

In mips I am sure you are aware of the three instruction classes: I, J, and R.

For this explenation I belive only I and R are relevant.

    Type    [31-26] [25-21] [20-16] [15-11] [10-06] [05-00]
    R-Type  [opcode] [$rs]   [$rt]  [ $rd ] [shamt] [funct]
    I-Type  [opcode] [$rs]   [$rt]  [         imm         ]

First lets examine the implications of using [31-26] for R-Type [funct] information.

This would limit the total number of R + I + J instructions to 64. To increase this field for all instructions would limit the size of immediate values.

Additonaly, [5-0] of R instructions would be freed up but not used, not very efficient. By moving R-type opcodes to [funct] the total possible instructions jumps to ~127, while keeping 16 bit immediates.

Finally, if you notice in the data path below there is almost no cost to moving R instruction opcodes to the [funct] field, and it makes room for future instructions to be added to the ISA.

Mips Datapath I hope this helps


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.