Reputation: 31
I'm working on my homework, and one of the question I have is to decode 0x8008FFC0 into MIPS assembly language instructions and write the instruction type. 0x8008FFC0 is converted to 1000 0000 0000 1000 1111 1111 1100 0000, and 100000 instruction is lb. I'm looking at the 'MIPS Reference Data. "green sheet"', and I don't see it listed in the 'Core Instruction Set'. So does it even have instruction type? If it does why?
Thank you
Upvotes: 0
Views: 147
Reputation: 1169
There are three instruction types in a MIPS processor, R, I, and J.
In a MIPS processor, R-type instructions have opcode 000000, so this one can't be an R-type instruction.
J type instructions move the pc around, and have format [opcode][target]. lb doesn't move us around, and doesn't have that format, so it can't be J.
The only option left is I, and lb has format [opcode][src][dest][immediate], as you can see here, so it is an I type instruction.
Hope that helps.
Assuming you mean this green sheet. You look at the table on the first page that says "core instruction set" It lists a bunch of load x instructions and they're all I-type so it's reasonable to guess that lb will also be I-type. (in particular, load byte unsigned ought to be the same instruction type as load byte.)
Or if you know how to use the instruction, I think it's lb $t offset($s), you can see that it references two registers ($s and $t) and an immediate value (offset). And from that you can see that it's I type.
As to your questions about the opcode and the funccode. The opcode is the first six bits of the instruction, it's the first thing the computer looks at in order to decide what to do. Since it's six bits, there are 64 possible values. This is enough to uniquely identify every I- and J-type instruction, but in order to increase the number of instructions available, R-type instructions are identified slightly differently. Every R type instruction has an opcode of 000000, and the computer tells them apart via the last 5 bits, referred to as the function code.
Upvotes: 1