Consider the following MIPS assembly instructions:
andi $s0, $t1, 65
a) What will be the machine code for the assembler instruction?
Justify the answer and state it in hexadecimal form.
b) In which building blocks in the processor are the pieces in the
machine code for the assembler instruction above used?
a) The given instruction is an I-Type instruction. We can convert this to machine code as follows:
opcode: 001100 (ANDI instruction)
rs: 01001 ($t1)
rt: 10000 ($s0)
immediate: 0000000001000001 (65)
Hence the Machine code is 00110001001100000000000001000001
Converting to hex we get, 0x31300041
b)
First the Opcode is used in the Control part of the processor to set the control signals for the instruction.
The rs and rt fields are used in the Register File to get and store the values respectively.
The immediate field is used in the ALU as an input to perform addition.
You can comment below the answer in case of any doubts and I will be happy to help.
Please give a thumbs up if the answer could be of help!
All the best!
Get Answers For Free
Most questions answered within 1 hours.