- #1

John_Brown

- 2

- 0

I have two doubts, In an exercise I have to convert a MIPS instruction into hexadecimal code. I understand a part of it.

The instruction given by the professor is:

Exercise 2 : bne $t2, $zero, previous instruction

The solution is

Co =0b0 00101, $rs =0b0 1010,$rt =0b0 0000, Imm16 = 0b1111 1111 1111 1110= 0xFFFE

So the whole instruction is : 0x1540 FFFE.

I understand that bne = 000101, and $t2 occupies the 10th position that $t2 is 01010. But I do not understand why Imm16 = 0b1111 1111 1111 1110= 0xFFFE

Can anybody help me?

The previous instruction (since it makes reference to the previous instruction it may be usefull) was :

Exercice 1 addi $t3 , $t2 ,-1 and the solution :

Co =0b0 01000,$rs =0b0 1010,$rt =0b0 1011,Imm16 =0b1111 1111 1111 1111

And the instruction : 0x214B FFFF

Another doubt is (more or less the same) :

I am given this :

Exercise 3: bne $t2, $zero, current instruction and the solution is :

Co =0b0 00101, $rs =0b0 1010,$rt =0b0 0000, Imm16 = 0b1111 1111 1111 1110= xFFFF So the whole isntruction is 0x1540 FFFF. What I do not understand here is the same, why does Imm16 = 0b1111 1111 1111 1110 ??

Anybody can help me?