Reputation: 915
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?
Upvotes: 4
Views: 7727
Reputation: 4961
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.
Upvotes: 5