Binary numbers can be interpreted in a number of ways Consid
Binary numbers can be interpreted in a number of ways. Consider the following 32-bit binary number:
0010 0000 1011 0100 0000 0000 1001 0100
a) What is the value when interpreted as a set of four 8-bit 2\'s complement signed integers?
b) What is the value when interpreted as a MIPS instruction?
c) What is the value in hex?
Solution
0010 0000 1011 0100 0000 0000 1001 0100 =(548667540)10
a) What is the value when interpreted as a set of four 8-bit 2\'s complement signed integers?
Negate this binary number 0010 0000 1011 0100 0000 0000 1001 0100 i,.e
11011111 01001011 11111111 01101011
Add 1 to it , It becomes 11011111 01001011 11111111 01101100 i.e Decimal form of signed -548667540
Its Decimal value is (3746299756)10
b) What is the value when interpreted as a MIPS instruction? [We have to refer data sheet of MIPS instriuction]
The first 6 bit is Opcode that determines whether the instruction is R, I or J type.
Opcode -->0010 00 (0X08) [Add Immediate ] Its an I type instruction (addi)
As its an I type instriuction. Source and destination register is of 5 bit each
For our Binary Number 6(Opcode) + 5(Source register) + 5(Destination) + 16(Immediate Type)
00 101 -->$5 (Source)
1 0100 -->$20 (Destination)
0000 0000 1001 0100 --> 148 (Last 16 bit Immediate Type)
addi $r5 $r20,148
c) What is the value in hex?
0010[2] 0000[0] 1011[B] 0100[4] 0000[0] 0000[0] 1001[9] 0100 [4]
0X20B40094
Thanks, I hope it clarifies.Let me know if there is anything
