I am working on a problem that asks for the assembly language that would correspond to the following machine instruction in MIPS:
OX3062FF80
Here is what I've done:
step 1: convert to binary
0011 0000 0110 0010 1111 1111 1000 0000
opcode: 000000 <--- im not sure about this part ( I thought it should always be zero)
rs: 00011
rt: 00010
rd: 11111
shamt: 11110
funct: 000000
add $15, $3, $2
Is this correct? I am going off an example but I am not entirely sure if its correct. Any help, advice would be appreciated. Thank you.
Best Answer
I believe it is a bitwise and immediate AND.
You had the first two steps right:
But not the rest.
First separate out the opcode, starting from the left. All opcodes are 6 bits.
So the opcode in binary, from the left, is:
which is 0xC. This is an andi instruction.
Then you need to separate out the fields according to the MIPS I instruction format;
I wrote some code and checked that an adi instruction has the above format in a disassembly listing.
To convert this into a assembly instruction:
The assembly language format of an andi is:
Looking up the MIPS registers for the rs and rt fields:
so the corresponding assembly instruction is:
andi $v1,$v0,0xFF80