Name:
UID:
CS / ECE 3810 Midterm 2 Solutions – March 31, 2026
Notes: Students are allowed to bring 2 A4/letter-sized sheets of paper with anything written/printed on
both sides. The “green sheet” is attached at the end of the test. No phones, laptops, or internet access are
allowed. You may bring a simple calculator with no internet connectivity, that can be used for any numeric
calculations (but it’s also ok to write a mathematical term, say 1.4/2.2 GHz without doing the calculation).
You may of course not use your phone to surf the web or consult with others during the test. You may
also not use the MARS simulator or other calculators/tools for numeric conversions. If necessary, make
reasonable assumptions and clearly state them. The only clarifications you may ask for during the exam are
definitions of terms. You will receive partial credit if you show your steps and explain your line of thinking,
so attempt every question even if you can’t fully solve it. Complete your answers in the space provided
(including the back side of each page). Turn in your answer sheets before 12:10pm. The test is worth 100
points and you have about 90 minutes, so allocate time accordingly. Confirm that you have 12 questions
on 8 pages.
1. Add the following two signed 8-bit binary integers. Express A, B, and C in decimal format and con-
firm that your math is correct. (8 points)
A: 0110 1011
B: 1111 0110
---------
Sum C =
Solution: A is 64+32+8+2+1 = 107. B is a negative integer because the most significant bit is 1, so
to get its absolute value, first flip the bits and add 1 = 0000 1001 + 1 = 9 + 1 = 10, i.e., B is -10. The
sum of the two numbers should therefore be 97.
carry: 1111 110
A: 0110 1011
B: 1111 0110
---------
Sum C = 0110 0001
This number is indeed (64+32+1) 97. Note that the summation of the last bits is really 27 (the carry)
plus −27 (the magnitude of B’s most significant bit), so it produces a 0. It’s also ok to do 1+1 = 10
and ignore the carry.
2. (8 points) Convert the following IEEE 754 single-precision floating-point value to its decimal value:
1 1000 0010 11100000000000000000000.
Solution: The sign bit is 1, so the number is negative. The exponent is 130; with the bias of 127
subtracted, the true exponent is 3. The number is therefore 1.111 ×23 = 1111 = 15. Given the sign
bit, final answer is -15.
1
, 3. Perform addition of the following two IEEE 754 single-precision floating point numbers. Show all
steps and show the final IEEE 754 representation of the addition result. (8 points)
0 1000 0010 10000..0
0 1000 0101 01100..0
Solution: The exponents are 130-127=3 and 133-127=6. We will convert the first number to the larger
exponent.
1.1 x 2ˆ3 = 0.0011 x 2ˆ6
Adding:
0.0011 x 2ˆ6
1.0110 x 2ˆ6
--------------
1.1001 x 2ˆ6
The final representation will be 0 1000 0101 1001000....0
4. Consider the truth table below for a 3-input logic block. Express the boolean equation that represents
the output value D as a function of the three inputs A, B, and C in either sum-of-products or product-
of-sums form. (4 points)
A | B | C || D
--------|-------|---------||----------
0 | 0 | 0 || 0
0 | 0 | 1 || 1
0 | 1 | 0 || 0
0 | 1 | 1 || 0
1 | 0 | 0 || 0
1 | 0 | 1 || 0
1 | 1 | 0 || 1
1 | 1 | 1 || 0
Solution: It is more efficient to use sum-of-products because there are fewer 1s than 0s in the output
column. The expression is:
D = Ā.B̄.C + A.B.C̄
5. In an out-of-order processor, the “window” and “width” are important parameters for high perfor-
mance. Define these terms and explain why they impact performance. (6 points)
Solution: Window is the size of the reorder buffer, i.e., the number of instructions that can enter the
pipeline. The further you can look into the future, the higher the probability of finding instructions that
can execute and do useful work. Width is the maximum number of instructions that can be executed in
a cycle. The more instructions that can execute in a cycle, the higher the peak IPC and average IPC.
6. What is the major drawback in a ripple-carry adder? How did we arrive at a better adder design (the
carry lookahead adder)? (6 points)
Solution: While a ripple-carry adder uses few gates with few inputs, the carries have to be propagated
sequentially through each bit. Therefore, for a 32-bit adder, 64 sequential gate delays have to be
navigated, making it a high-latency adder. To get the best performance, we design the carry lookahead
2
UID:
CS / ECE 3810 Midterm 2 Solutions – March 31, 2026
Notes: Students are allowed to bring 2 A4/letter-sized sheets of paper with anything written/printed on
both sides. The “green sheet” is attached at the end of the test. No phones, laptops, or internet access are
allowed. You may bring a simple calculator with no internet connectivity, that can be used for any numeric
calculations (but it’s also ok to write a mathematical term, say 1.4/2.2 GHz without doing the calculation).
You may of course not use your phone to surf the web or consult with others during the test. You may
also not use the MARS simulator or other calculators/tools for numeric conversions. If necessary, make
reasonable assumptions and clearly state them. The only clarifications you may ask for during the exam are
definitions of terms. You will receive partial credit if you show your steps and explain your line of thinking,
so attempt every question even if you can’t fully solve it. Complete your answers in the space provided
(including the back side of each page). Turn in your answer sheets before 12:10pm. The test is worth 100
points and you have about 90 minutes, so allocate time accordingly. Confirm that you have 12 questions
on 8 pages.
1. Add the following two signed 8-bit binary integers. Express A, B, and C in decimal format and con-
firm that your math is correct. (8 points)
A: 0110 1011
B: 1111 0110
---------
Sum C =
Solution: A is 64+32+8+2+1 = 107. B is a negative integer because the most significant bit is 1, so
to get its absolute value, first flip the bits and add 1 = 0000 1001 + 1 = 9 + 1 = 10, i.e., B is -10. The
sum of the two numbers should therefore be 97.
carry: 1111 110
A: 0110 1011
B: 1111 0110
---------
Sum C = 0110 0001
This number is indeed (64+32+1) 97. Note that the summation of the last bits is really 27 (the carry)
plus −27 (the magnitude of B’s most significant bit), so it produces a 0. It’s also ok to do 1+1 = 10
and ignore the carry.
2. (8 points) Convert the following IEEE 754 single-precision floating-point value to its decimal value:
1 1000 0010 11100000000000000000000.
Solution: The sign bit is 1, so the number is negative. The exponent is 130; with the bias of 127
subtracted, the true exponent is 3. The number is therefore 1.111 ×23 = 1111 = 15. Given the sign
bit, final answer is -15.
1
, 3. Perform addition of the following two IEEE 754 single-precision floating point numbers. Show all
steps and show the final IEEE 754 representation of the addition result. (8 points)
0 1000 0010 10000..0
0 1000 0101 01100..0
Solution: The exponents are 130-127=3 and 133-127=6. We will convert the first number to the larger
exponent.
1.1 x 2ˆ3 = 0.0011 x 2ˆ6
Adding:
0.0011 x 2ˆ6
1.0110 x 2ˆ6
--------------
1.1001 x 2ˆ6
The final representation will be 0 1000 0101 1001000....0
4. Consider the truth table below for a 3-input logic block. Express the boolean equation that represents
the output value D as a function of the three inputs A, B, and C in either sum-of-products or product-
of-sums form. (4 points)
A | B | C || D
--------|-------|---------||----------
0 | 0 | 0 || 0
0 | 0 | 1 || 1
0 | 1 | 0 || 0
0 | 1 | 1 || 0
1 | 0 | 0 || 0
1 | 0 | 1 || 0
1 | 1 | 0 || 1
1 | 1 | 1 || 0
Solution: It is more efficient to use sum-of-products because there are fewer 1s than 0s in the output
column. The expression is:
D = Ā.B̄.C + A.B.C̄
5. In an out-of-order processor, the “window” and “width” are important parameters for high perfor-
mance. Define these terms and explain why they impact performance. (6 points)
Solution: Window is the size of the reorder buffer, i.e., the number of instructions that can enter the
pipeline. The further you can look into the future, the higher the probability of finding instructions that
can execute and do useful work. Width is the maximum number of instructions that can be executed in
a cycle. The more instructions that can execute in a cycle, the higher the peak IPC and average IPC.
6. What is the major drawback in a ripple-carry adder? How did we arrive at a better adder design (the
carry lookahead adder)? (6 points)
Solution: While a ripple-carry adder uses few gates with few inputs, the carries have to be propagated
sequentially through each bit. Therefore, for a 32-bit adder, 64 sequential gate delays have to be
navigated, making it a high-latency adder. To get the best performance, we design the carry lookahead
2