4.14) Meaning of bits patterns:
1000 1111 1110 1111 1100 0000 0000 00002
a) a two's complement integer?
1) Notice leading bit is 1 which mean negative number
=> sign = negative
2) invert bits
0111 0000 0001 0000 0011 1111 1111 1111
3) Add the invert to 1
0111 0000 0001 0000 0011 1111 1111
1111
+ 1
0111 0000 0001 0000 0100 0000 0000 0000
4) Convert two's complement bit to decimal
0111 0000 0001 0000 0100 0000 0000
00002
230 + 229 + 228 + 220 + 214 = 1,880,113,152
5) Add sign to the decimal number
sing = negative
=> - 1,880,113,152
b) An unsigned number?
For the unsigned number, we use maximum bit pattern.
MIPS word is 32 bits long = 232 = 4,294,967,29510
Unsigned number binary conversion to decimal:
1000 1111 1110 1111 1100 0000 0000
00002
231 + 227 + 226 + 225 + 224 + 223 + 222 + 221 + 219 + 218 + 217 + 216 + 215 + 214 = 2,414,854,144
c) A single precision floating-point number)
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
S | Exponent | Significant |
S = 1
E = 0001 1111 = 3110
Significant = .1101 1111 1000 = 1/2 + 1/4 + 0/8 +1/16 + 1/32 + 1/64 +1/128 + 1/256 +1/512
= .873046875
IEEE 754 format: (-1)S x (1 + Significant) x 2(Exponent - Bias)
= (-1)1 x (1 + .873046875) x 2(31 - 127)
= -1 x 1.873046875 x 2-96
= - 1.873046875 x 1.262177448 x 10-29
= - 2.364117525 x 10-29
d) a MIPS instruction)
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
OP | RS | RT | RD | SHAMT | FUNCT |
OP | RS | RT | address/immediate |
OP | target address |
OP = 10 0011 = 3510
=> OP35 = lw
RS = 1 1111 = 3110 = $ra (page 140)
RT = 0 1111 = 1510 = $t7
address/ imediate = 1100 0000 0000 0000 = 495210
=> MIPS instruction is: lw $t7, 49152($ra)