Tutorial 7 Solutions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Advanced Digital Systems Tutorial Sheet 7 + Solutions S.

Nasser, 2022/2023

Tutorial Sheet 7
Solutions
Arithmetic Circuits

Quick Reminder:
Table 1 Range of N-bit Numbers

Figure 1 Number line and 4-bit binary encodings

Problem Set:
1. What is the largest unsigned 32-bit binary number?
Solution: 232 − 1 = 4,294,697,295

2. What is the largest 16-bit binary number that can be represented with:
a) unsigned numbers?
b) two’s complement numbers?
c) sign/magnitude numbers?
Solution:
a) 216 − 1 = 65535
b) 215 − 1 = 32767
c) 215 − 1 = 32767

3. What is the smallest (most negative) 16-bit binary number that can be represented with:
a) unsigned numbers?

Page 1 of 4
Advanced Digital Systems Tutorial Sheet 7 + Solutions S. Nasser, 2022/2023

b) two’s complement numbers?


c) sign/magnitude numbers?
Solution:
a) 0
b) −215 = −32768
c) −(215 − 1) = −32767

4. Convert the following two’s complement binary numbers to decimal.


a) 10102
b) 1101102
c) 011100002
d) 100111112

Solution:
a) −6
b) −10
c) 112
d) −97

5. Convert the following decimal numbers to 8-bit two’s complement numbers or indicate that the
decimal number would overflow the range.
a) 4210
b) −6310
c) 12410
d) −12810
e) 13310
Solution:
a) 00101010
b) 11000001
c) 01111100
d) 10000000
e) Overflows

6. Perform the following additions of unsigned binary numbers. Indicate whether the sum
overflows a 4-bit result.
a) 10012 + 01002
b) 11012 + 10112
Solution:
a) 1101
b) 11000 (overflows)

7. Perform the following additions of unsigned binary numbers. Indicate whether the sum
overflows an 8-bit result.

Page 2 of 4
Advanced Digital Systems Tutorial Sheet 7 + Solutions S. Nasser, 2022/2023

a) 100110012 + 010001002
b) 110100102 + 101101102
Solution:
a) 11011101
b) 110001000 (overflows)

8. Convert the following decimal numbers to 6-bit two’s complement binary numbers and
add them. Indicate whether the sum overflows a 6- bit result.
a) 1610 + 910
b) 2710 + 3110
c) −410 + 1910
Solution:
a) 010000 + 001001 = 011001
b) 011011 + 0111111 = 111010 (overflows)
c) 111100 + 010011 = 001111

9. Convert the following decimal numbers to 5-bit two’s complement binary numbers and
subtract them. Indicate whether the difference overflows a 5-bit result.
a) 910 − 710
b) 1210 − 1510
c) −610 − 1110
d) 410 − (−8)10
Solution:
a) 01001 − 00111 = 00010
b) 01100 − 01111 = 11101
c) 11010 − 01011 = 01111
d) 00100 − 11000 = 01100
10. For each of the three full adders in the figure below, determine the outputs for the inputs shown.

Figure 2
Solution:
a) The input bits are A = 1, B = 0, and Cin = 0.
1 + 0 + 0 = 1 with no carry
Therefore, Σ = 1 and Cout = 0.
b) The input bits are A = 1, B = 1, and Cin = 0.
1 + 1 + 0 = 0 with a carry of 1
Therefore, Σ = 0 and Cout = 1.
Page 3 of 4
Advanced Digital Systems Tutorial Sheet 7 + Solutions S. Nasser, 2022/2023

c) The input bits are A = 1, B = 0, and Cin = 1.


1 + 0 + 1 = 0 with a carry of 1
Therefore, Σ = 0 and Cout = 1.
11. Determine the sum (Σ) and the output carry (Cout) of a half-adder for each set of input bits:
a) 01
b) 00
c) 10
d) 11
Solution:
a) Σ = 1, 𝐶𝑜𝑢𝑡 = 0
b) Σ = 0, 𝐶𝑜𝑢𝑡 = 0
c) Σ = 1, 𝐶𝑜𝑢𝑡 = 0
d) Σ = 0, 𝐶𝑜𝑢𝑡 = 1

12. A full-adder has Cin = 1. What is the sum (Σ) and the output carry (Cout) when A = 1 and B=1?
Solution: Σ = 1, 𝐶𝑜𝑢𝑡 = 1

13. For the full adder, determine the outputs for each of the following inputs
a) A = 0, B = 1, Cin = 0
b) A = 1, B = 0, Cin = 1
c) A = 0, B = 0, Cin = 0
Solution:
a) Σ = 1, 𝐶𝑜𝑢𝑡 = 0
b) Σ = 1, 𝐶𝑜𝑢𝑡 = 1
c) Σ = 0, 𝐶𝑜𝑢𝑡 = 0

14. What are the half-adder inputs that will produce the following outputs:
a) Σ = 0, Cout = 0
b) Σ = 1, Cout = 0
c) Σ = 0, Cout = 1
Solution:
a) 𝐴 = 0, 𝐵 = 0
b) 𝐴 = 0, 𝐵 = 1 𝑜𝑟 𝐴 = 1, 𝐵 = 0
c) 𝐴 = 1 , 𝐵 = 1

15. Determine the outputs of a full adder for each of the following inputs:
a) A = 1, B = 0, Cin = 0
b) A = 0, B = 0, Cin = 1
c) A = 0, B = 1, Cin = 1
d) A = 1, B = 1, Cin = 1

Solution:

a) Σ = 1, 𝐶𝑜𝑢𝑡 = 0
b) Σ = 1, 𝐶𝑜𝑢𝑡 = 0
c) Σ = 0, 𝐶𝑜𝑢𝑡 = 1
Page 4 of 4
Advanced Digital Systems Tutorial Sheet 7 + Solutions S. Nasser, 2022/2023

d) Σ = 1, 𝐶𝑜𝑢𝑡 = 1

Page 5 of 4
Advanced Digital Systems Tutorial Sheet 7 + Solutions S. Nasser, 2022/2023

16. The circuit shown in figure 3 below is a 4-bit circuit that can add or subtract numbers in a form
used in computers (positive numbers in true form; negative numbers in complement form). (a)
̅̅̅̅̅̅ /𝑆𝑢𝑏𝑡 is HIGH. (b) What happens when ̅𝐴𝑑𝑑
Explain what happens when the 𝐴𝑑𝑑 ̅̅̅̅̅̅ /𝑆𝑢𝑏𝑡 is
LOW?

Figure 3

Solution:
a) The circuit performs the subtraction operation (𝐴 − 𝐵). When this high input is XORed
with the bits from B – those bits are inverted (obtaining the one’s complement of B at
this point). But, this high input is also the Cin of the first FA – which is the same process
of getting the two’s complement of B.
b) The circuit performs the addition operation (𝐴 + 𝐵). When a low input is XORed with
B, it is maintained as is.

17. For the circuit in Figure 3, assume the inputs are ̅̅̅̅̅̅
𝐴𝑑𝑑 /𝑆𝑢𝑏𝑡 = 1, A = 1010, and B = 1101. What is
the output?
Solution:
1010 + 0011 = 1101

Page 6 of 4

You might also like