Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinguishing between I-type and R-type Instruction format in MIPS

In MIPS, I wonder if there is a way to tell if an instruction, by just looking at the machine code, is an I-type or R-type instruction?

like image 831
chanpkr Avatar asked Oct 18 '25 12:10

chanpkr


1 Answers

If you're looking for something quick and dirty, the op-code (6 most significant bits) of almost all R-type instructions is set to 0.

Of course in a real CPU there would be a more complicated test that would deal with all the possible exceptions.

See this chart.

like image 197
Konrad Lindenbach Avatar answered Oct 21 '25 16:10

Konrad Lindenbach



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!