
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















1 1 1 1 1
+
7 − 5 = 0111 + 1010 + 1 → keep 4 bits: 0010
EECS 31 · Introduction to Digital Systems
Reading: Section 5.2.2 (Subtraction) · BCD step by step: Suggested Study 7
UC Irvine · Samueli School of Engineering · Fall 2026
TODAY
Plan for the next 50 minutes
1
x − y with a borrow · its circuit and delay 6 min
2
Practice 1 · truth table, K-maps, delay, compare with the full adder 9 min
3
A − B = A + B̅ + 1 · what Cout means · Practice 2 11 min
4
Codes · a BCD → excess-3 converter with don't-cares 11 min
5
0–15 as two decimal digits 2 min
6
Add 6 when the sum is over 9 · Practice 3 9 min
7
Common mistakes, cheat sheet, questions 2 min
PART 1 · HALF SUBTRACTOR
The circuit and its delay
1
NOT, AND, OR: 1 gate delay
each, any fan-in.
2
No XOR gate: in a circuit XOR is
NOT → AND → OR (3).
3
Inputs ready at 0, true form only:
a bar costs a NOT.
4
Delay = most gates on any path
from an input.
vs. the half adder: same D = S (NOT → AND → OR = 3). The carry xy is ready at 1, but the borrow x̅y needs a
NOT: ready at 2.
PART 2 · FULL SUBTRACTOR
Practice 1: the full subtractor
TRY IT · 5 MIN
Design a full-subtractor circuit with three
inputs x, y, Bin and two outputs D and B.
The circuit subtracts x − y − Bin, where
Bin is the input borrow, B is the output
borrow, and D is the difference.
Hint: if x − y − Bin < 0, borrow: add 2 and
set the borrow out to 1.
Fill in the truth table.
Draw the K-maps of D and Bout
and write minimal two-level
equations.
Delay of the two-level circuit: D?
Bout? From Bin to Bout?
Fast finishers: compare with Week
6's full adder. What is the same?
Name: we write the output borrow as Bout (the problem calls it B) so it can't be confused with an input.
PART 2 · FULL SUBTRACTOR
Solutions (c)(d): delay, and the full adder
SOLUTIONS
(c)
Bout: needs x̅ → also 3
From Bin: Bout 2 , D 3
(d) vs. the full adder
D = S. Bout = Cout with x̅ in place of A
: 1 when two
or more of x̅, y, Bin are 1.
PART 3 · SUBTRACTING WITH AN ADDER
A − B = A + B̅ + 1
invert every bit, then add 1
The +1 goes in through the adder's carry in : no extra
adder needed.
carries 1 1 1 1 1
A 0 1 1 1
= 7
B̅ 1 0 1 0
(B = 0101 = 5)
1 0 0 1 0
Keep 4 bits: 0010 = 2 carry out = 1
gold row: carries (carry in = 1 on the right)
Last year: A − B = A + ( B̅ + 1) = A + B̅ + 1 “by associativity” — that one line is why every computer subtracts with its
adder.
PART 3 · PRACTICE
Practice 2: subtract with the adder
TRY IT · 5 MIN
Hint: B̅ is ready at 1; the carry in is a constant 1,
ready at 0. Week 6: a two-level full adder is carry in
→ carry out 2, carry in → sum 3.
1001 − 0011: write B̅, add, give the 4-bit result and Cout. In
decimal?
0011 − 1001: same questions. What does Cout tell you?
What is the answer in decimal?
The adder is four two-level full adders (Week 6). Delay of the
subtractor, and which output is last?
Fast finishers: a chain of four full subtractors (Practice 1), Bin
= 0. Faster or slower?
Remember: 4 bits only — the carry out is a separate output, not a fifth bit of the answer.
PART 3 · PRACTICE
Solutions (e)(f)
SOLUTIONS
carries 1 0 0 1 1
A 1 0 0 1
= 9
B̅ 1 1 0 0
(B = 0011 = 3)
1 0 1 1 0
Cout = 1: no borrow. 0110 = 6
borrow out of bits 3…0: 0 1 1 0 = NOT carry out of each bit
carries 0 1 1 1 1
A 0 0 1 1
= 3
B̅ 0 1 1 0
(B = 1001 = 9)
0 1 0 1 0
Cout = 0: borrow. 1010 − 16 = 10 − 16 = −
borrow out of bits 3…0: 1 0 0 0 = NOT carry out of each bit
Check: 9 − 3 = 6 and 3 − 9 = −6. Cout = 0 means we borrowed 16: the answer is the 4-bit result − 16.
PART 4 · BCD AND EXCESS-
Binary-coded decimal (BCD)
0
1
2
3
4
5
6
7
8
9
Not used: 1010 1011 1100 1101 1110 1111
2026
2
0
2
6
BCD: 16 bits
binary: 11 bits
BCD ≠ binary: 15 is 0001 0101 in BCD, but 1111 in binary. A 4-bit group above 1001 is not a BCD digit.
PART 4 · BCD AND EXCESS-
Excess-3: each digit + 3
digit BCD excess-
The 9's complement (9 − digit) is just NOT on every bit — true for all
ten digits.
Next: a code converter
Inputs: a BCD digit A B C D (A = 8). Outputs: its excess-3 code w x y
z. The inputs 1010–1111 never happen.
PART 4 · BCD AND EXCESS-
K-maps with don't-cares
Wrap-around: the left and right columns are neighbours, and so are the top and bottom rows (x's B̅C and B̅D, z's D̅).
PART 4 · BCD AND EXCESS-
Two circuits for the same converter
PART 5 · BCD ADDER
BCD digits: add 6 when the sum is over 9
sum
0–9: binary = BCD, nothing to fix (C = 0)
K: sums 16–19. Z
8
4
8
2
Why add 6?
The digit should be sum − 10. In 4 bits, −10 =
+6 (16 − 10). Adding 0110 skips the six unused
codes and makes the carry the decimal carry.
PART 5 · BCD ADDER
The BCD adder: two binary adders and a correction
binary: K Z = 1 0001
answer: 1 0111 = 17
5 + 7 (the bottom carry (1) is ignored)
binary: K Z = 0 1100
8
4
answer: 1 0010 = 12