Excercie Text Book (MIP Version)
2.7 The following problems explore number conversions from signed and unsigned binary number to decimal numbers.
a. 1010 1101 0001 0000 0000 0000 0000 0010two
b. 1111 1111 1111 1111 1011 0011 0101 0011two
2.7.1 For the patterns above, what base 10 number does it represent, assuming that it is a two's complement integer?
a. 1010 1101 0001 0000 0000 0000 0000 0010two - 1
= 1010 1101 0001 0000 0000 0000 0000 0001 two
complement
= 0101 0010 1110 1111 1111 1111 1111 1110 two
(1x230)+ (1x228)+ (1x225)+ (1x223)+ (1x222)+ (1x221)+ (1x219)+…+(1x24)+ (1x23)+ (1x22)+ (1x21)
= 1,391,460,350 ten => = -1,391,460,350 ten
b. 1111 1111 1111 1111 1011 0011 0101 0011two - 1
= 1111 1111 1111 1111 1011 0011 0101 0010two
complement
= 0000 0000 0000 0000 0100 1100 1010 1100two
(1x214)+ (1x211)+ (1x210)+ (1x27)+ (1x25)+ (1x23)+ (1x22)
= 19,628 ten => = -19,628 ten
2.7.2 For the patterns above, what base 10 number does it represent, assuming that it is an unsigned integer?
a. 1010 1101 0001 0000 0000 0000 0000 0010two
(1x-231)+ (1x229)+ (1x227)+ (1x226)+ (1x224)+ (1x220)+ (1x21)
= 2,903,506,946ten
b. 1111 1111 1111 1111 1011 0011 0101 0011two
(1x-231)+ (1x230)+…+ (1x215)+ (1x213)+ (1x212)+ (1x29)+ (1x28)+ (1x26)+ (1x24)+ (1x21)+ (1x20)
= 4,294,947,667ten
2.7.3 For the patterns above, what hexadecimal number does it represent?
a. 1010 1101 0001 0000 0000 0000 0000 0010two
= 1010 => a
1101 => d
0001 => 1
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0010 => 2
Ans ad100002 hex
b. 1111 1111 1111 1111 1011 0011 0101 0011two
= 1111 => f
1111 => f
1111 => f
1111 => f
1011 => b
0011 => 3
0101 => 5
0011 => 3
Ans fffb353 hex
The following problems explore number conversions from decimal to signed and unsigned binary numbers
a. 2147483647ten
b. 1000ten
2.7.4 For the base ten numbers above, convert to two’s complement binary
a. 2147483647ten
Ans 1110 0000 1110 0100 1010 1111 1111 1111 two
b. 1000ten
Ans 0000 0000 0000 0000 0000 0011 1110 1000 two
2.7.5 For the base ten numbers above, convert to two’s complement hexadecimal
a. 2147483647ten
= 1110 0000 1110 0100 1010 1111 1111 1111 two
= 1110 => e
0000 => 0
1110 => e
0100 => 4
1010 => a
1111 => f
1111 => f
1111 => f
= e0e4afff hex
b. 1000ten
= 0000 0000 0000 0000 0000 0011 1110 1000 two
= 0000 => 0
0000 => 0
0000 => 0
0000 => 0
0000 => 0
0011 => 3
1110 => e
1000 => 8
= 000003e8 hex
2.7.6 For the base ten numbers above, convert the negated values from the table to two’s complement hexadecimal
a. 2147483647ten
= 1110 0000 1110 0100 1010 1111 1111 1111 two - 1
= 1110 0000 1110 0100 1010 1111 1111 1110 two
complement
= 0001 1111 0001 1011 0101 0000 0000 0001 two
= 0001 => 1
1111 => f
0001 => 1
1011 => b
0101 => 5
0000 => 0
0000 => 0
0001 => 1
= 1f1b5001 hex
b. 1000ten
= 0000 0000 0000 0000 0000 0011 1110 1000 two - 1
= 0000 0000 0000 0000 0000 0011 1110 0001 two
complement
= 1111 1111 1111 1111 1111 1100 0001 1110 two
= 1111 => f
1111 => f
1111 => f
1111 => f
1111 => f
1100 => c
0001 => 1
1110 => e
= fffffc1e hex
2.9 The table below contains various values for register $s1. You will be asked to evaluate if there would be overflow for a given operation
a. 2147483647ten
b. 0XD0000000sixteen
2.9.1 Assume that register $s0 = 0X70000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, will there be overflow?
a. 2147483647ten
2147483647ten = 0111 1111 1111 1111 1111 1111 1111 1111 two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
0111 1111 1111 1111 1111 1111 1111 1111 two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1110 1111 1111 1111 1111 1111 1111 1111 two
Ans Overflow
b. 0XD0000000sixteen
0XD0000000sixteen = 1101 0000 0000 0000 0000 0000 0000 0000 two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1101 0000 0000 0000 0000 0000 0000 0000 two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0100 0000 0000 0000 0000 0000 0000 0000 two
Ans Overflow
2.9.2 Assume that register $s0 = 0X80000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, will there be overflow?
a. 2147483647ten
2147483647ten = 0111 1111 1111 1111 1111 1111 1111 1111 two
0x80000000 = 1000 0000 0000 0000 0000 0000 0000 0000 two
0111 1111 1111 1111 1111 1111 1111 1111 two
+
1000 0000 0000 0000 0000 0000 0000 0000 two
1111 1111 1111 1111 1111 1111 1111 1111 two
Ans Overflow
b. 0XD0000000sixteen
0XD0000000sixteen = 1101 0000 0000 0000 0000 0000 0000 0000 two
0x80000000 = 1000 0000 0000 0000 0000 0000 0000 0000 two
1101 0000 0000 0000 0000 0000 0000 0000 two
+
1000 0000 0000 0000 0000 0000 0000 0000 two
1111 1111 0000 0000 0000 0000 0000 0000 two
Ans Overflow
2.9.3 Assume that register $s0 = 0X7FFFFFFF and $s1 has the value as given in the table. If the instruction: sub $s0, $s0, $s1 is executed, will there be overflow?
a. 2147483647ten
2147483647ten = 0111 1111 1111 1111 1111 1111 1111 1111 two
0x7FFFFFFF = 0111 1111 1111 1111 1111 1111 1111 1111 two
0111 1111 1111 1111 1111 1111 1111 1111 two
-
0111 1111 1111 1111 1111 1111 1111 1111 two
1110 0000 0000 0000 0000 0000 0000 0000two
Ans Overflow
b. 0XD0000000sixteen
0XD0000000sixteen = 1101 0000 0000 0000 0000 0000 0000 0000 two
0x7FFFFFFF = 0111 1111 1111 1111 1111 1111 1111 1111 two
0111 1111 1111 1111 1111 1111 1111 1111two
-
1101 0000 0000 0000 0000 0000 0000 0000two
1010 1111 1111 1111 1111 1111 1111 1111 two
Ans Overflow
The table below contains various values for register $s1. You will be asked to evaluate if there would be overflow for a given operation
a. 1010 1101 0001 0000 0000 0000 0000 0010two
b. 1111 1111 1111 1111 1011 0011 0101 0011two
2.9.4 Assume that register $s0 = 0X70000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, will there be overflow?
a. 1010 1101 0001 0000 0000 0000 0000 0010two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1010 1101 0001 0000 0000 0000 0000 0010two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0001 1101 0001 0000 0000 0000 0000 0010 two
Ans Overflow
b. 1111 1111 1111 1111 1011 0011 0101 0011two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1111 1111 1111 1111 1011 0011 0101 0011two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0110 1111 1111 1111 1011 0011 0101 0011 two
Ans Overflow
2.9.5 Assume that register $s0 = 0X70000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, what is the result in hex?
a. 1010 1101 0001 0000 0000 0000 0000 0010two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1010 1101 0001 0000 0000 0000 0000 0010two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0001 1101 0001 0000 0000 0000 0000 0010 two
Ans 11d100002
b. 1111 1111 1111 1111 1011 0011 0101 0011two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1111 1111 1111 1111 1011 0011 0101 0011two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0110 1111 1111 1111 1011 0011 0101 0011 two
Ans 16fffb353
2.9.6 Assume that register $s0 = 0X70000000 and $s1 has the value as given in the table. If the instruction: add $s0, $s0, $s1 is executed, what is the result in base ten?
a. 1010 1101 0001 0000 0000 0000 0000 0010two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1010 1101 0001 0000 0000 0000 0000 0010two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0001 1101 0001 0000 0000 0000 0000 0010 two
0001 0001 1101 0001 0000 0000 0000 0000 0010 two
(1x232)+ (1x228)+ (1x227)+ (1x226)+ (1x224) + (1x21)
4294967296+268435456+134217728+67108864+16777216+2
Ans 4,781,506,562 ten
b. 1111 1111 1111 1111 1011 0011 0101 0011two
0x70000000 = 0111 0000 0000 0000 0000 0000 0000 0000 two
1111 1111 1111 1111 1011 0011 0101 0011two
+
0111 0000 0000 0000 0000 0000 0000 0000 two
1 0110 1111 1111 1111 1011 0011 0101 0011 two
0001 0110 1111 1111 1111 1011 0011 0101 0011 two
(1x232)+ (1x230)+ (1x229)+ (1x227)+…+ (1x215) + (1x213) + (1x212) + (1x29) + (1x28) + (1x26) + (1x24) + (1x21) + (1x20)
Ans 6,173,995,859 ten
2.10 In the following problems, the data table contains bit that represent the opcode of an instruction. You will be asked to translate the entries into assembly code and determine what format of MIPS instruction the bits represent
a. 1010 1110 0000 1011 0000 0000 0000 0100two
b. 1000 1101 0000 1000 0000 0000 0100 0000two
2.10.1 For the binary entries above, what instruction do they represent?
a.
opcode(6) | rs(5) | rt(5) | immediate(16) |
101011 | 10000 | 01011 | 0000000000000100 |
Sw | 16 | 11 | 4 |
sw rt, immediate(rs)
sw $11,4($16) หรือ sw $t3, 4($s0)
b.
opcode(6) | rs(5) | rt(5) | immediate(16) |
100011 | 01000 | 01000 | 0000000001000000 |
lw | 8 | 8 | 64 |
lw rt, immediate(rs)
lw $8,64($8) หรือ lw $t0, 64($t0)
2.10.2 What type (I-type, R-type) instruction do the binary entries above represent?
a. I-type
b. I-type
2.10.3 If the binary entries above were data bits, what number would they represent in hexadecimal?
a. 1010 1110 0000 1011 0000 0000 0000 0100 แปลงเป็นฐาน 16 ได้ AE0B0004
b. 1000 1101 0000 1000 0000 0000 0100 0000 แปลงเป็นฐาน 16 ได้ 8D080040
In the following problems, the data table contains MIPS instruction. You will be asked to translate the entries into the bits of the opcode and determine what is the MIPS instruction format.
a. add $t0, $t0, $zero
b. lw $t1, 4($s3)
2.10.4 For the instruction above, show the hexadecimal representation of these instructions
a.
add $t0, $t0, $zero | add rd, rs, rt 100000 (R-type) |
Opcode | 000000two |
Function | 100000two |
rd | $t0 = 8 = 01000two |
rs | $t0 = 8 = 01000two |
rt | $zero = 0 = 00000two |
opcode(6) | rs(5) | rt(5) | rd(5) | sa(5) | function(6) |
000000 | 01000 | 00000 | 01000 | 00000 | 100000 |
0000 0001 0000 0000 0100 0000 0010 0000 แปลงเป็นฐาน 16 ได้ 01004020
b.
lw $t1, 4($s3) | lw rt, immediate(rs) (I-type) |
Opcode | 100011two |
rt | $t1 = 9 = 01001two |
Immediate | 4 = 0000000000000100two |
rs | $s3 = 19 = 10011two |
opcode(6) | rs(5) | rt(5) | immediate(16) |
100011 | 10011 | 01001 | 0000000000000100 |
1000 1110 0110 1001 0000 0000 0000 0100 เป็นฐาน 16 ได้ 8E690004
2.10.5 What type (I-type, R-type) instruction do the instructions above represent?
a. R-type
b. I-type
2.10.6 What is the hexadecimal representation of the opcode, rs, and rt fields in this instruction? For R-type instructions, what is the hexadecimal representation of the rd and funct fields? For I-type instructions, what is the hexadecimal representation of the immediate field?
a.
Opcode | 000000two | 0hex |
Function | 100000two | 20hex |
rs | 01000two | 8hex |
rt | 00000two | 0hex |
rd | 01000two | 8hex |
b.
Opcode | 100011two | 23hex |
rs | 10011two | 13hex |
rt | 01001two | 9hex |
Immediate | 0000000000000100 | 4hex |
2.11 In the following problems, the data table contains bits that represent the opcode of an instruction. You will be asked to translate the entries into assembly code and determine what format of MIPS instruction the bits represent.
a. 0xAE0BFFFC
b. 0xBD08FFC0
2.11.1 What binary number does the above hexadecimal number represent?
a. 0xAE0BFFFC แปลงเป็นฐาน 2 ได้ 1010 1110 0000 1011 1111 1111 1111 1100
b. 0xBD08FFC0 แปลงเป็นฐาน 2 ได้ 1000 1101 0000 1000 1111 1111 1100 0000
2.11.2 What decimal number does the above hexadecimal number represent?
a. 0xAE0BFFFC แปลงเป็นฐาน 2 ได้ 1010 1110 0000 1011 1111 1111 1111 1100
แปลงเป็นฐาน 10 -1374945284
b. 0xBD08FFC0 แปลงเป็นฐาน 2 ได้ 1000 1101 0000 1000 1111 1111 1100 0000
แปลงเป็นฐาน 10 -1928790080
2.11.3 What instruction does the above hexadecimal number represent?
a. 0xAE0BFFFC แปลงเป็นฐาน 2 ได้ 1010 1110 0000 1011 1111 1111 1111 1100
opcode(6) | rs(5) | rt(5) | immediate(16) |
101011 | 10000 | 01011 | 1111111111111100 |
sw | 16 | 11 | -4 |
sw rt, immediate(rs)
sw $11,-4($16) หรือ sw $t3, -4($s0)
b. 0xBD08FFC0 แปลงเป็นฐาน 2 ได้ 1000 1101 0000 1000 1111 1111 1100 0000
opcode(6) | rs(5) | rt(5) | immediate(16) |
100011 | 01000 | 01000 | 1111111111000000 |
lw | 8 | 8 | -64 |
lw rt, immediate(rs)
sw $8,4($8) หรือ sw $t0, -64($t0)
In the following problems, the data table contains the values of various fields of MIPS instructions. You will be asked to determine what the instruction is, and find the MIPS format for the instruction
a. op=0, rs=1, rt=2, rd=3, shamt=0, funct=32
b. op=0x2B, rs=0x10, rt=0x5, const=0x4
2.11.4 What type (I-type, R-type) instruction do the instructions above represent?
a. R-type
b. I-type
2.11.5 What is the MIPS assembly instruction described above?
a.
opcode(6) | rs(5) | rt(5) | rd(5) | sa(5) | function(6) |
000000 | 00001 | 00010 | 00011 | 00000 | 100000 |
0 | 1 | 2 | 3 | 0 | 32 |
add rd, rs, rt
add $3, $1, $2 หรือ add $v1, $at, $v0
b.
opcode(6) | rs(5) | rt(5) | immediate(16) |
101011 | 10000 | 00101 | 0000000000000100 |
lw | 16 | 5 | 4 |
sw rt, immediate(rs)
sw $5,4($16) หรือ sw $a1, 4($s0)
2.11.6 What is the binary representation of the instructions above?
a. เป็นเลขฐาน 2 คือ 0000 0000 0010 0010 0001 1000 0010 0000
b. เป็นเลขฐาน 2 คือ 1010 1110 0000 0101 0000 0000 0000 0100
2.25
In this exercise, you will explore 32-bit constants in MIPS. For the following problems, you will be using the binary data in the table below.
a. 1010 1101 0001 0000 0000 0000 0000 0010two
b. 1111 1111 1111 1111 1111 1111 1111 1111two
2.25.1 Write the MIPS code that creates the 32-bit constants listed above and stores that value to register $t1
a. 1010 1101 0001 0000 0000 0000 0000 0010two = 0xAD100002
Ans add $t1,$0,0xAD10002
b. 1111 1111 1111 1111 1111 1111 1111 1111two = 0xFFFFFFFF
Ans add $t1,$0,0xFFFFFFFF
2.25.2 If the current value of the PC is 0x00000000, can you use a single jump instruction to get to the PC address as shown in the table above?
a. 1010 1101 0001 0000 0000 0000 0000 0010two = 0xAD100002
add $t1,$0,0xAD10002
Ans jr $t1
b. 1111 1111 1111 1111 1111 1111 1111 1111two = 0xFFFFFFFF
add $t1,$0,0xFFFFFFFF
Ans jr $t1
2.25.3 If the current value of the PC is 0x00000600, can you use a single branch instruction to get to the PC address as shown in the table above?
a. 1010 1101 0001 0000 0000 0000 0000 0010two = 0xAD100002
add $t1,$0,0xAD10002
Ans beq $0,$0,$t1
b. 1111 1111 1111 1111 1111 1111 1111 1111two = 0xFFFFFFFF
add $t1,$0,0xFFFFFFFF
Ans beq $0,$0,$t1
2.25.4 If the current value of the PC is 0x00400600, can you use a single branch instruction to get to the PC address as shown in the table above?
a. 1010 1101 0001 0000 0000 0000 0000 0010two = 0xAD100002
add $t1,$0,0xAD10002
Ans beq $0,$0,$t1
b. 1111 1111 1111 1111 1111 1111 1111 1111two = 0xFFFFFFFF
add $t1,$0,0xFFFFFFFF
Ans beq $0,$0,$t1
2.25.5 If the immediate field of a MIPS instruction was only 8 bits wide, write the MIPS code that creates the 32-bit constants listed above and stores that value to register $t1. Do not use the lui instruction.
a. 1010 1101 0001 0000 0000 0000 0000 0010two = 0xAD100002
Ans
add $t1,$0,0xAD
sll $t1,$t1,24
add $t2,$0,0x10
sll $t2,$t2,16
or $t1,$t1,$t2
add $t2,$0,0x00
sll $t2,$t2,8
or $t1,$t1,$t2
add $t2,$0,0x02
or $t1,$t1,$t2
b. 1111 1111 1111 1111 1111 1111 1111 1111two = 0xFFFFFFFF
Ans
add $t1,$0,0xFF
sll $t1,$t1,28
add $t2,$0,0xFF
sll $t2,$t2,16
or $t1,$t1,$t2
add $t2,$0,0xFF
sll $t2,$t2,8
or $t1,$t1,$t2
add $t2,$0,0xFF
or $t1,$t1,$t2
For the following problems, you will be using the MIPS assembly code as listed in the table
a. lui $t0, 0x1234
ori $t0, $t0, 0x5678
b. ori $t0, $t0, 0x5678
lui $t0, 0x1234
2.25.6 What is the value of register $t0 after the sequence of code in the table above?
a. lui $t0, 0x1234
ori $t0, $t0, 0x5678
Ans $to เก็บค่า 0x12345678
b. ori $t0, $t0, 0x5678
lui $t0, 0x1234
Ans $t0 เก็บค่า 0x567c
2.25.7 Write C code that is equivalent to the assembly code in the table. Assume that the largest constant that you can load into a 32-bit integer is 16 bits
a. lui $t0, 0x1234
ori $t0, $t0, 0x5678
Ans
Int V1,V2;
V1 = 0x1234;
V1 = V1 << 16;
V2 = 0x5678;
V1 = V1 | V2;
b. ori $t0, $t0, 0x5678
lui $t0, 0x1234
Ans
Int V1,V2;
V1 = 0x1234;
V2 = 0x5678;
V1 = V1 | V2;
3.10
In a Von Neumann architecture, groups of bits have no intrinsic meanings by themselves. What a bit pattern represents depends entirely on how it is used. The following table shows bit patterns expressed in hexadecimal notation
a. 0x24A60004
b. 0xAFBF0000
3.10.1 What decimal number does the bit pattern represent if it is a two’s-complement integer? An unsigned integer?
a. 0x24A60004
Ans two’s-complement และ unsigned integer = 614,858,756
b. 0xAFBF0000
Ans unsigned integer = 2,949,578,752
two’s-complement = -1,345,388,544
3.10.2 If this bit pattern is placed into the Instruction Register, what MIPS instruction will be executed?
a. 0x24A60004
Ans add $t1,$t1,0x24A60004
b. 0xAFBF0000
Ans add $t1,$t1,0xAFBF000
3.10.3 What decimal number does the bit pattern represent if it is a floating-point number? Use the IEEE754standard.
a. 0x24A60004 แปลงเป็นฐาน 2 ได้ 0010 0100 1010 0110 0000 0000 0000 0100
Sign(1) | Exponent(8) | Fraction(23) |
0 | 01001001 = 73 | 01001100000000000000100 = 0.296875477 |
(-2sign) * (1+Fraction) * 2eponent-127
(-1sign) 0 * (1+0.296875477) * 2(1sign 73 -127) = 7.19910507 × 10-17
b. 0xAFBF0000 แปลงเป็นฐาน 2 ได้ 1010 1111 1011 1111 0000 0000 0000 0000
Sign(1) | Exponent(8) | Fraction(23) |
1 | 01011111 = 95 | 01111110000000000000000 = 0.4921875 |
(-1sign) * (1+Fraction) * 1 Exponential-127
(-11) * (1+0.4921875) * 195-127 = -3.47426976 × 10-10
The following table shows decimal numbers.
a. -1609.5
b. -938.8125
3.10.4 Write down the binary representation of the decimal number, assuming the IEEE 754 single precision format.
a. -1609.5 แปลงเป็นฐาน 2 ได้ - 0110 0100 1001.1
- 110 0100 1001.1 * 20
- 1.10 0100 10011 * 210
(-1sign) * (1+Fraction) * 2eponent-127
-11* (1+0.10 0100 10011) * 2137-127
Sign(1) | Exponent(8) | Fraction(23) |
1 | 137 = 1000 1001 | 1001 0010 0110 0000 0000 000 |
Ans. 1100 0100 1100 1001 0011 0000 0000 0000
3.10.5 Write down the binary representation of the decimal number, assuming the IEEE 754 double precision format.
a. -1609.5 แปลงเป็นฐาน 2 ได้ - 0110 0100 1001.1
- 110 0100 1001.1 * 2eponent-127
- 1.10 0100 10011 * 210
-1sign * (1+Fraction) * 2eponent-127
(-11)* (1+0.10 0100 10011) * 2137-127
Sign(1) | Exponent(11) | Fraction(20) |
1 | 137 = 0001000 1001 | 1001 0010 0110 0000 0000 |
Ans. 1000 1000 1001 1001 0010 0110 0000 0000
b. -938.8125 แปลงเป็นฐาน 2 ได้ - 0011 1010 1010.1101
- 0011 1010 1010.1101 * 1sign -
- 1.1101010101101 * 29
-1sign * (1+Fraction) * 2137-126
(-11) * (1+0.1101010101101) * 2136-127
Sign(1) | Exponent(11) | Fraction(20) |
1 | 136 = 0001000 1000 | 1101 0101 0110 1000 0000 |
Ans 1000 1000 1000 1101 0101 0110 1000 0000
3.10.6 Write down the binary representation of the decimal number assuming it was stored using the single precision IBM format (base 16, instead of base 2, with 7 bits of exponent).
a. -1609.5 แปลงเป็นฐาน 2 ได้ - 0110 0100 1001.1
- 110 0100 1001.1 * 2sign
- 1.10 0100 10011 * 210
-1sign * (1+Fraction) * 2eponent-127
-11 * (1+0.10 0100 10011) * 2136-127
Sign(1) | Exponent(7) | Fraction(24) |
1 | 1000011 | 1001 0010 0110 0000 0000 0000 |
Ans 1100 0100 1100 1001 0011 0000 0000 0000
b. -938.8125 แปลงเป็นฐาน 2 ได้ - 0011 1010 1010.1101
- 0011 1010 1010.1101 * 20
- 1.1101010101101 * 29
-1sign * (1+Fraction) * 2136-127
-11 * (1+0.1101010101101) * 2136-127
Sign(1) | Exponent(7) | Fraction(24) |
1 | 1000011 | 1101 0101 0110 1000 0000 0000 |
Ans 1100 0100 0110 1010 1011 0100 0000 0000