chanpkr
chanpkr

Reputation: 915

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?

Upvotes: 4

Views: 7727

Answers (1)

Konrad Lindenbach
Konrad Lindenbach

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

Related Questions