MIPS CODE Suppose that the hex value 0xA0FFA000 is stored in
MIPS CODE Suppose that the hex value 0xA0FFA000 is stored in registers $s0-$s3.
1. The MIPS instruction 0x152D0014 is stored at memory address 0x0000CDE0.
What instruction is this? (Write assembly instruction.)
Solution
Hex: 0x152D0014
BNE $t1 $t5 0x0014
Binary: 00010101001011010000000000010100
BNE rs, rt, offset
(To compare general purpose registers(GPRs) then do a PC-relative conditional branch)
operation:
step1. target_offset=offset<<2 // 18-bit signed offset (the 16-bit offset field shifted left 2 bits)
step2.if( gpr[rs]!=gpr[rt])
then pc=pc+target_offset
endif
step3.next instructions......
Explanation:
if rs != rt then branch
An 18-bit signed offset (the 16-bit offset field shifted left 2 bits) is added to the address of the instruction following the branch, in the branch delay slot, to form a PC-relative effective target address. If the contents of GPR rs and GPR rt are not equal, branch to the effective target address after the instruction in the delay slot is executed.
