

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


0x400000 add r1, r2, r 4 addi r1, r2,0x nop beq r0, r0, LOOP (For the problem 2 .1) 2 .1)Write Machine code for the above 4 instructions. (Hexadecimal format) Hint : opcode for add is 0 and func field is 0x20. opcode for addi is 8 and think about rt and rs fields. opcode for beq is 4 What will be the offset value for LOOP. ############################################## START: 0x400000 J LINE Nop Nop LINE1 beq r0,r0,LINE add r1,r0,r LINE2 nop (For the problem 2 .2) 2 .2)Write Machine code for the above 5 instructions. (Hexadecimal format) Hint : opcode for j is 2. What will be the offset value for LINE1 and LINE2.
2 .3)Compute this branch target address: 0x400000 bne r1, r2, 3 2 .4)compute this branch target address 0x40000c bne r1,r2,- 3