Fundamentals of Digital Logic With VHDL
Fundamentals of Digital Logic With VHDL
July 2000 Univ. of Stellenbosch - Digital 1 July 2000 Univ. of Stellenbosch - Digital 2
Systems 144 Systems 144
Chapter 2
2.1 Variables and Functions
Introduction to Logic Circuits
• Reference figure 2.1
• Digital versus analog circuits
• Controlled switches
• Binary logic (Afr. Binêre logika)
• Input variable controls a switch
• Switches
• Logic expression e.g. L(x) = x describes the
• 0 or 1, ON or OFF, HIGH or LOW output as a function of the input variable
• If x = 0, L = 0 and light is off
• If x = 1, L = 1 and light is on
July 2000 Univ. of Stellenbosch - Digital 3 July 2000 Univ. of Stellenbosch - Digital 4
Systems 144 Systems 144
S
Battery x L Light
x = 0 x = 1
S
S
x Power
supply x L
(b) Symbol for a switch
July 2000 Figure 2.1 A binary switch 5 July 2000 Figure 2.2 A light controlled by a switch 6
1
Other functions Power
S S
supply x x L Light
1 2
x
2
(b) The logical OR function (parallel connection)
July 2000 Univ. of Stellenbosch - Digital 7 July 2000 Figure 2.3 Two basic functions 8
Systems 144
July 2000 Figure 2.4 A series-parallel connection 9 July 2000 Univ. of Stellenbosch - Digital 10
Systems 144
July 2000 Figure 2.5 An inverting circuit 11 July 2000 Univ. of Stellenbosch - Digital 12
Systems 144
2
July 2000 Figure 2.6 A truth table for AND and OR 13 July 2000 Figure 2.7 Three-input AND and OR 14
x1
x2
2.4 Logic gates and networks x1 ⋅ x2 x1 ⋅ x2 ⋅ … ⋅ xn
x1
x2
• The three basic functions (AND, OR and NOT) (a) AND gates
f = (x + x ) ⋅ x
x
2
1 2 3
• Synthesis (Afr. sintese)
x
3
– Create a new circuit for an application (main
task of an engineer!)
– Optimization is important
• Reference figure 2.10a
July 2000 Figure 2.9 An OR-AND function 17 July 2000 Univ. of Stellenbosch - Digital 18
Systems 144
3
Timing diagram
0→ 0→1→ 1 1→ 1→0→ 0
x
1 A
1→1→ 0→ 1
(Afr. tyddiagram)
f
0→ 0→0→ 1
0→ 1→0→ 1 • Reference figure 2.10b
B
x
2
0 0 1
0 1 1
1 0 0
1 1 1
July 2000 Figure 2.10 a Logic network 19 July 2000 Univ. of Stellenbosch - Digital 20
Systems 144
1
x
1 0
x 1
2 0 Functional equivalent networks
1
A
0
B
1 • Reference figure 2.10d
0
f
1 • Function g is functionally equivalent to f,
0 Time
(c) Timing diagram
but timing, cost, etc. can be different.
• Optimization offunctions (later).
0→ 0→1→ 1 1→ 1→ 0→ 0
x
1→1→ 0→ 1
1
0→ 1→0→ 1 g
x
2
July 2000 Figure 2.10 b Logic network 21 July 2000 Univ. of Stellenbosch - Digital 22
Systems 144
4
Single variable theorems Duality
• x• 0=0 • Replace all 0’s with 1’s,all 1’s with 0’s, all
• x+1 = 1 AND’s with OR’s and all OR’s with AND’s
• x• 1=x
• More later
• x+0 = x
• x• x=x
• x+x = x
• x • x’ = 0
• x+x’ = 1
• x’’ = x
July 2000 Univ. of Stellenbosch - Digital 25 July 2000 Univ. of Stellenbosch - Digital 26
Systems 144 Systems 144
DeMorgan’s Theorem
• (x • y)’ = x’ + y’
• (x+y)’ = x’ • y’
July 2000 Univ. of Stellenbosch - Digital 29 July 2000 Figure 2.11 Proof of DeMorgan’s theorem 30
Systems 144
5
Applying identities (a) Constant 1 (b) Constant 0
x x x x
(e) x ⋅ y (f) x + y
x y
x y
z
x y x y
x y x y z z
z z x⋅y x⋅y
(a) x (d) x ⋅ y
x y x y
x y x y z z
z z x⋅z x⋅z
(b) y + z (e) x ⋅ z
x y x y
x y x y z z
z z
y⋅z x⋅y+x⋅z
(c) x ⋅ ( y + z ) (f) x ⋅ y + x ⋅ z
x y
x⋅y+x⋅z+y⋅z
Verification of x ⋅ y + x ⋅ z + y ⋅ z = x ⋅ y + x ⋅ z
July 2000 33 July 2000 34
Figure 2.13 Verification of the distributive property Figure 2.14
July 2000 Univ. of Stellenbosch - Digital 35 July 2000 Univ. of Stellenbosch - Digital 36
Systems 144 Systems 144
6
2.6 Synthesis using AND, OR
and NOT gates
July 2000 Univ. of Stellenbosch - Digital 37 July 2000 Figure 2.15 A function to be synthesized 38
Systems 144
x1
x2
Example
f
• Reference figure 2.15 and 2.16
• Concept of sum-of-products
• Simplify expression using theorems
• f(x1,x2) = x1 • x2 + x1’ • x2’ + x1’ • x2 (a) Canonical sum-of-products
7
Another example
• See figure 2.18 and 2.19
• f(x1,x2,x3) = x1’ • x2’ • x3 + x1 • x2’ • x3’
+ x1 • x2’ • x3 + x1 • x2 • x2’
• This form is not minimal, but can be
reduced to: f = x2’ • x3 + x1 • x3’
• Alternative forms:
– f=
July 2000 Figure 2.18 A three-variable function 43 July 2000 Univ. of Stellenbosch - Digital 44
Systems 144
8
2.7 Design examples 2.7.1 Three-way light control
• Design process: • Three doors in room each with switch
– Specification of solution to a problem in words • One or three on switches must turn light on
– Formal specification with truth table • See truth table in figure 2.20
– Synthesis
• f = m1 + m2 + m4 + m7
– Implementation
• or f = M0• M3 • M5 • M6
– Testing
– Possible iteration • See figure 2.21. For implementation
July 2000 Univ. of Stellenbosch - Digital 49 July 2000 Univ. of Stellenbosch - Digital 50
Systems 144 Systems 144
x
1
x
2
x
3
July 2000 Figure 2.20 Truth table for a three-way light controller 51 July 2000 Figure 2.21 SOP implementation of the three-way light controller 52
x
3
2.7.2 Multiplexer Circuit
x
2
x
1
• Circuit often used in digital and computer
f
designs
• Switches one of multiple sources of data to
a single destination
• See figure 2.22
(b) Product-of-sums realization
July 2000 Figure 2.21 POS implementation of the three-way light controller 53 July 2000 Univ. of Stellenbosch - Digital 54
Systems 144
9
s x1 x2 f (s, x1, x2)
000 0
001
010
0
1
x1 2.8 Introduction to CAD tools
011 1 f
100 0 s • Lecturers comment: Read only at this stage
101 1 x2
110 0 • 2.8.1 Design Entry
111 1
– Truth table (figure 2.23)
(a)Truth table (b) Circuit
– Schematic entry (figure 2.24)
s
s f (s, x1, x2) – Hardware description languages (HDL)
x1 0 0 x1
x2
f
1 x2
• 2.8.2 Synthesis
1
• 2.8.3 Functional simulation
(c) Graphical symbol (d) More compact truth-table representation
July 2000 Figure 2.22 Multiplexer 55 July 2000 Univ. of Stellenbosch - Digital 56
Systems 144
July 2000 Figure 2.23 Screen capture of the Waveform Editor 57 July 2000 Figure 2.24 Screen capture of the Graphic Editor 58
Design conception
Truth table
DESIGN ENTRY
Merge
• Used for the algorithmic description of
INITIAL SYNTHESIS TOOLS Boolean equations digital circuits
Functional simulation
• Used for synthesis and simulation
No
• See figures 2.27 to 2.31
Design correct?
Yes
10
x1
x2
f
x3
July 2000 Figure 2.26 A simple logic function and corresponding VHDL code 61 July 2000 Figure 2.30 VHDL code for a four-input function 62
x1
x3
x2
x4
11