Question

In: Computer Science

3.21 [10] <§3.5> If the bit pattern 0×0C000000 is placed into the Instruction Register, what MIPS...

3.21 [10] <§3.5> If the bit pattern 0×0C000000 is placed into the Instruction Register, what MIPS instruction will be executed?

3.22 [10] <§3.5> What decimal number does the bit pattern 0×0C000000 represent if it is a floating point number? Use the IEEE 754 standard.

Given the following 32-bit binary sequences representing single precision IEEE

754 floating point numbers:

a = 0100 0000 1101 1000 0000 0000 0000 0000

b = 1011 1110 1110 0000 0000 0000 0000 0000

Perform the following arithmetic and show the final addition and multiplication results in both normalized binary format and IEEE 754 single-precision format. Show your steps (Do not convert a and b to decimal base, compute the addition and multiplication, then convert the results back to normalized binary and single precision).

a)     a + b

b)     a × b

Solutions

Expert Solution

3.21)
0x0C000000
Converting 0C000000 to binary
0 => 0000
C => 1100
0 => 0000
0 => 0000
0 => 0000
0 => 0000
0 => 0000
0 => 0000
So, in binary 0C000000 is 00001100000000000000000000000000

=>  00001100000000000000000000000000
=>  000011 00000000000000000000000000
=>  I-type instruction
000011 is jal
=>  jal 0
Answer: jal 0

3.22)
in binary 0C000000 is 00001100000000000000000000000000
0 00011000 00000000000000000000000
sign bit is 0(+ve)
exp bits are 00011000
Converting 00011000 to decimal
   00011000
   => 0x2^7+0x2^6+0x2^5+1x2^4+1x2^3+0x2^2+0x2^1+0x2^0
   => 0x128+0x64+0x32+1x16+1x8+0x4+0x2+0x1
   => 0+0+0+16+8+0+0+0
   => 24
in decimal it is 24
so, exponent/bias is 24-127 = -103
frac bits are

IEEE-754 Decimal value is 1.frac * 2^exponent
IEEE-754 Decimal value is 1.0 * 2^-103
Answer: 2^-103

1 * 2^-103 in decimal is 9.860761315262648e-32
so, 00001100000000000000000000000000 in IEEE-754 single precision format is 9.860761315262648e-32
Answer: 2^-103 or 9.860761315262648e-32

3.23)
a = 0 10000001 10110000000000000000000
sign bit is 0(+ve)
exp bits are 10000001
Converting 10000001 to decimal
   10000001
   => 1x2^7+0x2^6+0x2^5+0x2^4+0x2^3+0x2^2+0x2^1+1x2^0
   => 1x128+0x64+0x32+0x16+0x8+0x4+0x2+1x1
   => 128+0+0+0+0+0+0+1
   => 129
in decimal it is 129
so, exponent/bias is 129-127 = 2
frac bits are 1011

IEEE-754 Decimal value is 1.frac * 2^exponent
IEEE-754 Decimal value is 1.1011 * 2^2

b = 1 01111101 11000000000000000000000
sign bit is 1(-ve)
exp bits are 01111101
Converting 01111101 to decimal
   01111101
   => 0x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+0x2^1+1x2^0
   => 0x128+1x64+1x32+1x16+1x8+1x4+0x2+1x1
   => 0+64+32+16+8+4+0+1
   => 125
in decimal it is 125
so, exponent/bias is 125-127 = -2
frac bits are 11

IEEE-754 Decimal value is 1.frac * 2^exponent
IEEE-754 Decimal value is 1.11 * 2^-2

a)
a + b
= 1.1011 * 2^2 - 1.11 * 2^-2
= 1.1011 * 2^2 - 0.000111 * 2^2
= 1.100101 * 2^2

single precision:
--------------------
sign bit is 0(+ve)
exponent bits are (127+2=129) => 10000001
   Divide 129 successively by 2 until the quotient is 0
      > 129/2 = 64, remainder is 1
      > 64/2 = 32, remainder is 0
      > 32/2 = 16, remainder is 0
      > 16/2 = 8, remainder is 0
      > 8/2 = 4, remainder is 0
      > 4/2 = 2, remainder is 0
      > 2/2 = 1, remainder is 0
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10000001
   So, 129 of decimal is 10000001 in binary
frac/significant bits are 10010100000000000000000

so, a+b in single-precision format is 0 10000001 10010100000000000000000

Answer:
----------
normalized binary format:           1.100101 * 2^2
IEEE 754 single-precision format:   0 10000001 10010100000000000000000

b)
a x b
= 1.1011 * 2^2 x -1.11 * 2^-2
= 1.1011 x -1.11
= -10.111101
= -1.0111101 * 2^1

single precision:
--------------------
sign bit is 1(-ve)
exponent bits are (127+1=128) => 10000000
   Divide 128 successively by 2 until the quotient is 0
      > 128/2 = 64, remainder is 0
      > 64/2 = 32, remainder is 0
      > 32/2 = 16, remainder is 0
      > 16/2 = 8, remainder is 0
      > 8/2 = 4, remainder is 0
      > 4/2 = 2, remainder is 0
      > 2/2 = 1, remainder is 0
      > 1/2 = 0, remainder is 1
   Read remainders from the bottom to top as 10000000
   So, 128 of decimal is 10000000 in binary
frac/significant bits are 01111010000000000000000

so, a x b in single-precision format is 1 10000000 01111010000000000000000

normalized binary format:           -1.0111101 * 2^1
IEEE 754 single-precision format:   1 10000000 01111010000000000000000

Related Solutions

Write a MIPS program that always checks the bit 0 of a memory data at address...
Write a MIPS program that always checks the bit 0 of a memory data at address 0x0BF81234. If it is equal to one add nth and (n+1)th elements of an array and store it to memory address 0x0BF85678 . Suppose $t0 contains the address of the 0th element of an array of 32-bit data and $t1 = n.
Consider the following C code: (10 marks) // write a MIPS instruction to initialize s0 to...
Consider the following C code: // write a MIPS instruction to initialize s0 to 6 t0 = ((s03 - 93)2 + s0 ) << 2 t1 = t0 / 4 Q2.1: Write a MIPS program that performs the operation of the above C program. Q2.2: What is the value of $t0 and $t1 after running your MIPS program (write your answer in a comment at the end of the code). Submit your answer to Q2 in a file named A2_Q2.asm
Assuming three-bit exponent field and four-bit significand, what is the bit pattern for -8.75
Assuming three-bit exponent field and four-bit significand, what is the bit pattern for -8.75
Using the three-bit exponent field and four-bit significand, what is the bit pattern for the -2.5?...
Using the three-bit exponent field and four-bit significand, what is the bit pattern for the -2.5? (show work)
Assuming three-bit exponent field and four-bit significant, what is the bit pattern for 5.75
Assuming three-bit exponent field and four-bit significant, what is the bit pattern for 5.75
Two charges + 12 nC and -12 nC, are placed at (- 3.5 m, 0) and...
Two charges + 12 nC and -12 nC, are placed at (- 3.5 m, 0) and (3.5 m, 0) respectively. The Coulomb constant is given by k = 8.99x109 N m2 / C2, a) If the field E from the positive charge at (0, 1 m ) is given by E = a x + b y , find a and b respectively Number Units Number Units b) If the field E from the negative charge at (0, 1 m)...
What is the Opcode? What is the Operand? What is the value in Register 5 after the instruction is executed?
What is the Opcode? What is the Operand? What is the value in Register 5 after the instruction is executed?
the speed of light in centimeters is 2.99 x 10^10. Give the bit pattern to represent...
the speed of light in centimeters is 2.99 x 10^10. Give the bit pattern to represent this number as a double-precision floating point value according to the IEEE standard. (Hint: You might want to convert it first to a binary number and then wangle it into floating point)
1. Assuming three-bit exponent field and four-bit significand, what is the bit pattern for -8.75?
1. Assuming three-bit exponent field and four-bit significand, what is the bit pattern for -8.75?
(5 pts) Assuming three-bit exponent field and four-bit significand, what is the bit pattern for 11.25(show...
(5 pts) Assuming three-bit exponent field and four-bit significand, what is the bit pattern for 11.25(show work)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT