LectureNotes DigitalDesign
LectureNotes DigitalDesign
Mano, M. M., Ciletti, M. D., 2007. Digital design, 4th Edition. Prentice-Hall, Upper
Saddle River, NJ
• Detailed study of Chapters 2-7; very few sections will be skipped. At the end of each chapter Verilog
code for some circuits will be explained.
This course combines three approaches to teach students Digital Design, which is the fundamental prereq-
uisite to understand computer design and architecture:
1. Theoretical aspects of the subject will be covered in lectures, along with exercises in sections. Stu-
dents, by the end of the course, should be able to design, analyze, and implement combinational and
synchronous digital circuits.
2. A second objective is to teach students the digital design using a Hardware Descriptive Language
(HDL). Students by the end of the semester will be able to analyze logic circuits with Verilog (one of
the available HDLs).
3. A third objective is to develop the practical sense of the students through lab. experiments. Students
will be able to implement logic circuits using breadboards and ICs.
Contents iii
3 Gate-Level Minimization 36
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2 The Map Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.2.1 Two-Variable Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
iii Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
3.2.2 Three-Variable Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.3 Four-Variable Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
3.4 Five-Variable Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
3.5 Product-of-Sums Simplifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
3.6 Don’t-Care Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
3.6.1 More Examples on K-Map Simplifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
3.7 Two-Level Implementation in NAND and NOR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
3.7.1 NOR Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.9 Exclusive-OR (XOR) Function: revisit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.9.1 Parity Generation and Checking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.10 Hardware Descriptive Language (HDL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4 Combinational Logic 66
4.1 Introduction: types of logic circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
4.2 Combinational Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
4.3 Analysis Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
4.4 Design Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4.4.1 Code Conversion Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
4.5 Binary Adder-Subtractor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.5.1 Half Adder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
4.5.2 Full Adder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
4.5.3 Implementing FA using ONLY HA => modular design => very interesting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
4.5.4 Binary Adder: => more modular design => wonderful! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
4.5.5 Carry Propagation: complexity-speed trade off! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
4.5.6 Binary Subtractor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.5.7 Binary Adder-Subtractor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
4.6 Decimal Adder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
4.7 Binary Multiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.7.1 2-bit x 2-bit Multiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.7.2 3-bit x 4-bit Multiplier: How many bits? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
4.8 4-bit x 4-bit Magnitude Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.9 n
n × 2 Decoder: D i = m i . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.10 2n to n Encoders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.10.1 Priority Encoder: 4 x 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.11 Multiplexers: 2n × 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.11.1 Two-to-one-line Mux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.11.2 Four-to-one-line Mux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.11.3 Quadrable two-to-one-line Mux (block-reuse design) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.11.4 Boolean Function Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.12 Demultiplexers (DEMUX) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
4.13 HDL Models of Combinational Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
Bibliography
Hardware Implementation
7 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
8 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Chapter 2
• Denote True and False by 1 and 0 that represent Vcc and 0 voltages.
• A Boolean Variable is a variable that is either True or False (or simply 1 or 0); hence a bit.
• A truth table is the table that represents all the possi- ble combinations of the input to a logical (Boolean)
function.
2. Identity element:
a) 0 + x = x.
b) 1 · x = x.
3. Commutative:
a) x + y = y + x.
b) x · y = y · x.
4. Distributive:
a) x · (y + z) = x · y + x · z.
b) x + (y · z) = (x + y)(x + z).
5. Complement:
a) x + x ′ = 1.
b) x · x ′ = 0
11 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Proof. :
3. is from definition.
Proof. (algebraically and by truth table. Some algebraic proofs are tedious and truth table is sufficient):
x +xy = x ·1+xy
= x · (1 + y)
= x ·1
=x
14 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Theorem 5(a) DeMorgan : truth table
Theorem 4 (Generalization) . It can be easily shown that Theorems 4, 5 in the above table are generalize to
more than 2 variables.
Example 5
(A 1 + A 2 + · · · + A n )′ = A ′1 A ′2 · · · A ′n
(A 1 A 2 · · · A n )′ = A ′1 + A ′2 + · · · + A ′n .
Example 6
x + y · (x + z)′
15 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
2.5 Boolean Functions and Gate Implementation
Example 7 Evaluate and implement the functions:
F1 = x + y ′ z
F2 = x ′ y ′ z + x ′ y z + x y ′
F2 = x ′ y ′ z + x ′ y z + x y ′
= x ′ z(y ′ + y) + x y ′
= x ′ z + x y ′,
which has only 4 literals, where a literal is a single variable (complemented or un-complemented).
• low cost.
• simpler implementation.
F 1 = x(x ′ + x y)
= xx ′ + xx y
= 0 + x y = x y.
F2 = x y + x ′ z + y z
= x y + x′z + x y z + x′ y z
= x y(1 + z) + x ′ z(1 + y)
= x y + x ′ z.
F 3 = (x(y ′ z ′ + y z))′
= x ′ + (y ′ z ′ + y z)′
= x ′ + (y + z)(y ′ + z ′ )
= x ′ + y z ′ + y ′ z.
Hint: for simplicity apply DeMorgan by duality followed by inverting each literal:
F 3 = x(y ′ z ′ + y z)
dual of F 3 = x + (y ′ + z ′ )(y + z)
F 3′ = x ′ + (y + z)(y ′ + z ′ ).
• a minterm (or maxterm) equals one (or zero) only at one combination.
• the minterm (or maxterm) subscript is the order and value of this combination.
• m i = M i′ .
• Each function, then, can be expressed as either: sum of minterms or product of maxterms!
20 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
From Truth Table:
ANDing maxterms
∏ ∏
f1 = = (0, 2, 3, 5, 6) = M 0 · M 2 · M 3 · M 5 · M 6
0 o f f1
= (x + y + z)(x + y ′ + z)(x + y ′ + z ′ )(x ′ + y + z ′ )(x ′ + y ′ + z),
∏ ∏ ∏
f 1′ = = = (1, 4, 7) = M 1 M 4 M 7 .
0 o f f 1′ 1 o f f1
= m i′ · m ′j · · ·
= Mi · M j · · ·
∏
=
1
Gate Implementation ∑
f1 = (1, 4, 7) = m 1 + m 4 + m 7 = x ′ y ′ z + x y ′ z ′ + x y z
A = A(B ′ + B ) = AB ′ + AB
= m2 + m3 .
Example 11
A = A(B ′C ′ + B ′C + BC ′ + BC )
= AB ′C ′ + AB ′C + ABC ′ + ABC
= m4 + m5 + m6 + m7 .
• We should minimize and keep it as sum of products (SOP) or product of sums (POS), because it is only
two-level implementation; e.g.,
F1 = y ′ + x y + x ′ y z ′ ,
F 2 = x(y ′ + z)(x ′ + y + z ′ ).
• So, implement any function as SOM (POM), then simplify to SOP (POS).
24 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Example 12 (2- vs. 3-level implementation)
F 3 = AB +C (D + E )
F 3 = AB +C D +C E .
F 0 = 0,
F1 = m3 = x y,
F2 = m2 = x y ′,
F3 = m2 + m3 = x y′ + x y = x,
′
F4 = m1 = x y,
F5 = m1 + m3 = x′ y + x y = y,
′ ′
F6 = m1 + m2 = x y +xy = x ⊕ y,
F7 = M0 = x + y.
The other functions can be obtained, of course, by complementing the previous functions (Why?)
26 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
27 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Special offer for Mathematics lovers: from our study in Discrete Mathematics we have already learned that
(Ch1. Rosen, 2007, P. 6):
x = IX = e ∈ X ,
y = IY = e ∈ Y ,
• X ⊂Y (typo in book),
• If x then y, y if x, y when x,
• F = M 2 = x ′ + y.
HW: what is the logic function F that represent the case that X ∩ Y = ϕ and X ∪ Y ̸= Ω.
Problem 13 (Sec. 1.2 Rosen, 2007, Prob.: 43–45): Show that NOT, OR, AND form a functionally complete
collection of logical operators.
• Motivation: why, then, introducing new logic gates: NAND, NOR (next figure)? As we will see in Sec. 3.7:
• We already know AND, OR, NOT gates, with direct hardware implementation. NAND, NOR have their hard-
ware implementation as well.
(x + y) + z = x + (y + z),
(x y)z = x(y z).
Therefore, we DEFINE:
x + y + z = (x + y) + z = x + (y + z),
x y z = (x y)z = x(y z).
x ↓ y ↓ z = (x + y + z)′ ,
x ↑ y ↑ z = (x y z)′ .
• Hence, we DEFINE:
x ⊕ y ⊕ z = (x ⊕ y) ⊕ z = x ⊕ (y ⊕ z)
• After settling on particular design, this circuit can be fabricated on an IC using sophisticated engineer-
ing tools and industry
Gate-Level Minimization
Simplify the following functions both algebraically and with K-Map and observe the visual power:
F1 = m1 + m2 + m3 = x′ y + x y ′ + x y = x y + x ′ y + x y ′ + x y = y + x.
F2 = m3 = x y.
F3 = m0 + m3 = x ′ y ′ + x y.
• Only one-bit (variable) change for any two adjacent squares! Therefore, e.g.,
F = m 5 + m 7 = x y ′ z + x y z = xz(y ′ + y) = xz
• Make sure of number of variables (e.g., m 2 + m 3 for 2 or 3 variables) and their order
F = x ′ y + x y ′ = x ⊕ y.
F = xz ′ + y z.
1. Simplify F . (Hint: a group should have (2m ) ones and its resulting SOP has (n − m) literals.
3. Observe the number of AND and OR gates (ignore inverters for now).
F = x y ′ + z ′.
∑
F (A, B,C ) = (1, 2, 3, 5, 7)
F = C + A ′ B.
• A group of ones should be 2m , where m is the number of removed variables in this group (SOP), and
the SOP will have n − m literals.
• Therefore, maximize the number of 1s in each group to minimize the number of literals in the SOP.
• The number of literals in each group (SOP) is the number of inputs to its AND gate.
• The number of groups is the number of SOP terms is the number of AND gates is the number of inputs
to the OR gate.
m 0 + m 2 + m 8 + m 10 = w ′ x ′ y ′ z ′ + w ′ x ′ y z ′ + w x ′ y ′ z ′ + w x ′ y z ′
= (w ′ y ′ + w ′ y + w y ′ + w y)x ′ z ′
= x ′ z ′.
F = y ′ + w ′ z ′ + xz ′ .
F = B ′ D ′ + B ′C ′ + A ′C D ′ .
∑
Example 20 Simplify the function F (A, B,C , D, E ) = (0, 2, 4, 6, 9, 13, 21, 23, 25, 29, 31).
F = A ′ B ′ E ′ + B D ′ E + AC E .
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 x 1
1 1 1 1
1 1 1
1 1
1 1 1
Example: F = AB +C D.
x ⊕ y = x y ′ + x ′ y,
x ⊕ 0 = x,
x ⊕ 1 = x ′,
x ⊕ x = 0,
x ⊕ x ′ = 1.
F n+1 = A 0 ⊕ A 1 · · · A n+1
F n+1 = F n ⊕ A n+1 .
• HW: How many 2-input XORs are needed to implement an even parity generator?
• When circuits become complicated and hard to analyze either on paper or by HW implementation.
• The basic two languages supported by IEEE are VHDL and Verilog
• Verilog CD comes with the book, or you can download the SW and a free 6-months license from:
http://www.syncad.com/
module Simple_Circuit (A , B , C, D, E) ; module Simple_Circuit_prop_delay (A , B , C, D, E) ;
output D, E ; output D, E ;
input A , B , C; input A, B, C;
wire w1 ; wire w1 ;
initial
begin
A = 1 ’b0 ; B = 1 ’b0 ; C = 1 ’b0 ;
#100 A = 1 ’b1 ; B = 1 ’b1 ; C = 1 ’b1 ;
#100 $finish ;
end
E = A + BC + B ′ D,
F = B ′C + BC ′ D ′ .
// Verilog model : Circuit_Boolean_CA
module Circuit_Boolean_CA ( E , F , A , B , C, D) ;
output E, F;
input A , B , C, D;
UDP_02467 M0 ( e , a , b , c ) ;
and ( f , e , d) ; // instance name omitted
endmodule
65 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Chapter 4
Combinational Logic
• sequential: output is function of input and previous output => MEMORY (Ch. 5–9)
• In Ch. 4 we will employ the previous chapters to analyze, design, and simplify these circuits.
F 1 = T3 + T2
= F 2′ T1 + ABC
= ABC +
(AB + AC + BC )′ (A + B +C )
.
= ..
= A ′ B ′C + A ′ BC ′ + AB ′C ′ + ABC
∑
= (1, 2, 4, 7).
• Some circuits use excess-3 code and we need to feed this circuit with the right input.
Let’s draft it on a clean page, then see the complete solution to save time.
C3 = 0
S = S2 = S1 ⊕ z
= x ⊕y ⊕z
C = S 3 = C 1 +C 2
= x y + S1 z
= x y + (x ⊕ y)z
.
= ..
∑
= (3, 5, 6, 7)
74 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
4.5.4 Binary Adder: => more modular design => wonderful!
Hint:
• without observing this modularity, it would be extremely difficult to design, e.g., 8-bit binary adder!
Pi = Ai ⊕ Bi
Gi = Ai Bi
S i = P i ⊕C i
C i +1 = G i + P i C i
C 1 = G 0 + P 0C 0
C 2 = G 1 + P 1C 1
= G 1 + P 1G 0 + P 1 P 0C 0
C 3 = G 2 + P 2C 2
= G 2 + P 2G 1 + P 2 P 1G 0 + P 2 P 1 P o C o .
A − B = A − B + 2n − 2n
( )
= A + (2n − 1 − B ) + 1 − 2n
( )
= A + (1’s comp of B ) + 1 − 2n
= (A + B ′ + 1) − 2n .
6 0110 0110
2 0010 1101
1
10100 FAs level
• For signed numbers, we
use 2’s Comp.
x y f x y f
0 0 0 0 0 0 0 1 0 1 0 0 1 1
0 1 1 0 1 1 A B A x x A x x
1 0 1 1 0 A
1 1 1 1 1 B
M Op xi yi C0
0 A +B Ai Bi 0
1 A + B′ + 1 Ai B i′ 1
xi = A i
y i = M ′ B i + M B i′ = M ⊕ B i
Co = M .
cin b3 b2 b1 b0 a3 a2 a1 a0 cout s8 s4 s2 s1
Design 1: very goofy 0 0 0 0 0 0 0 0 0 0 0 0 0 0
5 functions, each: 0 0 0 0 0 0 0 0 1 0 0 0 0 1
29 = 512 rows! .. ..
. .
X X
C abcd
0 0000
1 0110
Design 2: smart
B3 B2 B1 B0
A2 A1 A0
0 0 0 A0B3 A0B2 A0B1 A0B0
0 0 A1B3 A1B2 A1B1 A1B0 0
C6 C5 C4 C3 C2 C1 C0
Design 1: using the 1-bit comparator very similar to what we have done.
A7 A6 A5 A4 A3 A2 A1 A0
B7 B6 B5 B4 B3 B2 B1 B0
L = L1 + E1L0,
S = S1 + E1S0,
E = E1E0.
∑
S= (1, 2, 4, 7)
∑
C = (3, 5, 6, 7)
∑
K = (0, 1, 2, 3, 4, 5) (# minterms > 2n /2)
∑
K ′ = (6, 7)
E Inv-E E Inv-E
Out Out Inv-Out Inv-Out
w x y z
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
• V is 1 to indicate “Valid”.
cond. X Y
A>B 1 0
A=B 1 1
A<B 0 1
Y = S ′ I 0 + SI 1
4×1
S1 S0 Y MUX
0 0 I0
0 1 I1
1 0 I2
1 1 I3
Y = I 0 S 1′ S 0′ + I 1 S 1′ S 0 + I 2 S 1 S 0′ + I 3 S 1 S 0
= I 0 m0 + I 1 m1 + I 2 m2 + I 3 m3
2∑
n
−1
= I i mi .
i =0
2×1 2×1
MUX MUX
2×1
MUX
2×1
MUX
2×1
MUX
2×1
MUX
Fi = I mi
1 × 22
DEMUX
• HENCE: 1 × 2n DEMUX is nothing but Enabled n × 2n DEC, where the “Enable” is the input! (see Section
4.9)
Homework
• In “Sequential” the new output is a function of its current value (“state”) and the input.
( )
• Q(t + 1) Q(t ), S, R
• Q = 1 => “set”.
• Q = 0 => “reset”.
Graphic Symbols
From Gates:
General Notes:
• Either way, clock frequency (hence system speed) is
confined to gate delay.
• f = 1/T
• The function table is the same as D-Latch with re-
placing En with Clk
• How to reach the design of these and other Flip-Flops and convert from any Flip-Flop to others is
detailed in Section 5.9
Input Equation
D = JQ ′ + K ′Q
Characteristic Equation
Q(t + 1) = D
= JQ ′ (t ) + K ′Q(t ).
Characteristic Table
J K Q(t + 1)
0 0 Q(t ) (no change)
0 1 0 (reset)
1 0 1 (set)
1 1 Q ′ (t ) (complement)
Input Equation
D = T ⊕Q
Characteristic Equation
Q(t + 1) = D
= T ⊕Q(t ).
Characteristic Table
T Q(t + 1)
0 Q(t ) (no change)
1 Q ′ (t ) (complement)
Function Table
R Clk D Q Q′
0 X X 0 1
1 ↑ 0 0 1
1 ↑ 1 1 0
2- Flip-Flop Characteristic Equation: 6- Timing Diagram: A(0) = 0, x = (1, 0, 1), y = (0, 1, 1).
A(t + 1) = D A
Mealy:
y
116 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
5.6 HDL Modles of Sequential Circuits
Homework
D Q(t + 1)
0 0 (reset)
1 1 (set)
Q(t + 1) = D
• Compiler Design
• Formal Languages
..
• .
S 3 /1 S 2 /0 S2 Y (Mealy)
1
123 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Example 37 (Using a T FF, design a circuit that counts from 0 to 7. comp. to D and JK P. 109) .
Q Q(t+1) T
0 0 0
0 1 1
1 0 1
1 1 0
T0 = 1
∏−1
J =i
Ti = Aj, i >0
j =0
124 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Example 38 (Using a T FF, design a circuit that counts from 0 to 4 and check for unused states!) .
Q Q(t+1) T
0 0 0
0 1 1
1 0 1
1 1 0
0 0 1 0 0 1 1 0 1 1 1 1
T A2 = A 2 + A 1 A 0 T A1 = A 0 T A 0 = A ′2
1 X X X 0 X X X 0 X X X
P.S. T N.S.
A2 A1 A0 T A2 T A1 T A0 A2 A1 A0
101 110 011
110 100 010
111 110 001
0/0 1/1
0/0
1/0 1/0
0,1/0 x
0,1/0 0,1/0
E (#1) F (#2) G (#3) y
0 X X 0
J =T K =T
1 X X 1
Same as P. 109
2×1
MUX
T0 = 1 (Up/Down)
∏−1
J =i
Ti = Aj, i >0 (Up)
j =0
∏−1
J =i
Ti = A ′j , i >0 (Down)
j =0
• As in Example 37 C Function T
• Clock could be +/- 0 no change 0
• Other complementing FF (P. 109) 1 count up EQ
• Count-Down counter is immediate by: T = C · EQ
• Count-enable (C)
130 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
6.2.2 Up-Down Binary Counter
U D Function Ti
0 0 no change 0
∏i −1 ′
0 1 down A , T 0 = 1 (EqD)
∏i0−1 j
1 x up 0 A j , T0 = 1 (EqU)
Ti = U ′ D · E qD +U · E qU ,
T1 = U ′ D +U = U + D
0 EqD
EqU EqU
4×1
MUX
4×1 4×1
MUX MUX
0 0 0 0 1 1 1 1
0 0 0 0 1 1 1 1
X X X X X X X X
0 1 X X 1 1 X 0
L = A3 A0 C = A 3 + A 1 = (A 3 A 1 )′
′ ′
A3 A3
A2 A2
A1 A1
A0 A0
L C
• A = A + SI (cumulatively).
• Initially: A = 0, B = SI .
C = Qx +Q y + x y
S = x ⊕ y ⊕Q.
137 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
Design 2 (longer):
• The summation x + y depends
on the carry (0 or 1) so it should
be represented by a state Q of a
single FF; draw the truth table:
• Using D FF:
D = Q(t + 1) = Qx +Q y + x y
S = x ⊕ y ⊕Q.
• Using JK FF:
J = x y,
K = (x + y)′ ,
S = x ⊕ y ⊕Q.
Using T FF: C l k i = A ′i −1 , C l k 0 = C l k ′ , Ti = 1.
Using D FF: C l k i = A ′i −1 , C l k o = C l k ′ , D i = A ′i
Ripple:
A 0 appears after ∆1
A 1 appears after ∆1 + ∆1 = 2∆1 , and so on...
Then, A nr −1 appears after n r ∆1 .
The last bit should appear before T (the next edge) => n r ∆1 < T .
x 1 1 x x 0 0 x
x 1 1 x x 0 1 x
x x x x x x x x
x 0 x x x x x x
J 2 = Q 8′ J 8 = Q 4Q 2
Design 2 :
one n-bit binary counter + one n × 2n -decoder
=> (n FFs + 2n n-input AND gates).
Advantages : It is half the number of FFs than the ring counters with additional AND gates. The AND gates
are 2-input (to be compared with the n-input of Design 2)
Homework
Memory : collection of cells for storing information (bits) to be fetched from/to processor
Programmable Logic Device (PLD) : programming is a hardware procedure specifying bits inserted into
the device for future use. PLD may has 100s–1000,000s of gates.
• “Byte”: 8 bits
Si ze = 210 Words
= 1024 Words
= 1 K Words
= 1 K × 2 Bytes
= 2 KB
• 1 G = 1024 M = 210 M
• 1 M = 1024 K = 210 K
• 1 K = 1024 = 210
• 1 G = 230
148 Copyright © 2015, 2019 Waleed A. Yousef. All Rights Reserved.
7.3 Memory Decoding
7.3.1 Internal Construction of 1-bit RAM
• RAM is fabricated directly not implemented as connected components (this is just a logic diagram)
• Registers vs. RAM (inside processor, sync. with clock, faster, not expandable, etc.)
• So, memory cells are arranged in a • but addressed as X = 01100 and Y = 10100 in coincident de-
matrix (a dot is a word). coding.
Combinational functions : if we
look at the table column-wise. The
k-bit input has n corresponding
functions A 1 -A n . For a particular
input, each function provides a
value.
• We need the same for sequential circuits; otherwise, we will do state table for hundreds of states.
• We will provide essential tools here in this chapter and leave the rest to the whole course of “Computer
Organization”.
R2 ←− R1
If (T 3 = 1) then R2 ←− R1
If (T 3 = 1) then R2 ←− R1, R1 ←− R2
If (T 2 = 1) then R1 ←− R1 + R2
Homework
• Patterson, D. A., Hennessy, J. L., 2007. Computer Organization And Design : The Hardware/Software
Interface, 3rd Edition. MORGAN KAUFMANN, Boston
• “The hardware/software interface” wow!. Look at the branching statements and connection to func-
tion call, if conditions, etc.
Boolean Algebra
Mano, M. M., Ciletti, M. D., 2007. Digital design, 4th Edition. Prentice-Hall, Upper Saddle River, NJ.
Patterson, D. A., Hennessy, J. L., 2007. Computer Organization And Design : The Hardware/Software Inter-
face, 3rd Edition. MORGAN KAUFMANN, Boston.
Rosen, K. H., 2007. Discrete mathematics and its applications, 6th Edition. McGraw-Hill Higher Education,
Boston.
Sipser, M., 2006. Introduction to the theory of computation, 2nd Edition. Thomson Course Technology,
Boston.