How do you find the following values of a MIPS instruction o
How do you find the following values of a MIPS instruction
-opcode (OP)
-source register (RS)
-target register (RT) fi elds.
I-type instructions (value of the immediate field)
R-type instructions (value of the destination register (RD) field)
Solution
For 32 bit address.Field sizes are:
R type:op=6bits,rs=5bits,rt=5bits,rd=5bits,shamt=5bits,functons=6bits
I TYPE:op=6bits,rs=5bits,rt=5bits,address=16 bit
Example: add $t0, $s1, $s2
– registers have numbers, $t0=8, $s1=17, $s2=18
•Instruction Format:
Code 000000 10001 10010 01000 00000 100000
num.bits 6 5 5 5 5 6
Fields op rs rt rd shamt funct
I type:
Example: lw $t0, 32($s2)
35 8 18 32
op rs rt 16 bit number
Example: R TYPE
lw $s1,100($s2) $s1 = Memory[$s2+100]
sw $s1,100($s2) Memory[$s2+100] = $s1
bne $s4,$s5,L Next instr. is at Label if $s4 not equl to $s5
beq $s4,$s5,L Next instr. is at Label if $s4 = $s5
Formats:
R : op rs rt rd shamt funct
I: op rs rt 16 bit addres
