These 3 questions are the only ones I didn't understand in class. My professor is horrible & isn't clear at all when explaining the material which is why I had to come here. I have answers for some of them but I don't know if they're correct. Thank you so much in advance, I greatly appreciate that you took the time to read.
- Give the assembly instruction in order to:
a) Isolate Byte 1 of a word in $s0 using only logical shifts.
b) Complement the lower 12 bits of register $t0 but leave all the other bits unchanged. If possible, use immediate format instruction. If it's not possible to use immediate format instruction, explain why and use mask a register instead.
c) Mask the shift amount of an R-Format instruction and clear the rest of the bits. If possible, use immediate format instruction. If it's not possible to use immediate format instruction, explain why and use mask register instead.
- This code is for question 2a
loop: slt $t2, $t0, $t0
bne $t2, $zero, loop
j done
done:
a) The address of bne is 400. Give its target address.
- Given the assembly instruction beq $t1, $t2, Next
a) If the address of the instruction is 800bytes and Next is at target address 680 bytes. What will be the value of the offset field of the instructions binary representation? Give the offset value in decimal and in binary.
My answers:
1a. sll $t0, $s0, 16 srl $t1, $t0, 24
b. xori (can't figure out the rest)
c. andi $t0, $s1, 0x07c0
2a. 424 (400 + 4) + (4 * 3) = 416
b.
3a. I think you have to do 800-680 but I don't know for sure. What I do know is that the offset value has to be 16 bits when written in binary.