Digital System Design Using Verilog�(21EC32)
Lesson Plan
2
SN | DATE PLANNED | TOPIC | DATE ENGAGED | REMARKS |
2.1 | | General Approach to Combinational Logic design | | |
2.2 | | Decoders | | |
2.3 | | BCD Decoders | | |
2.4 | | Encoders | | |
2.5 | | Digital Multiplexers | | |
2.6 | | Using Multiplexers as Boolean function Generators | | |
2.7 | | Adders and Subtractors | | |
2.8 | | Cascading Full Adders | | |
2.9 | | Binary Comparators | | |
2.10 | | Programmable Logic Devices | | |
Combinational Circuits
To Design a combinational circuit the following steps are followed
3
Combinational Circuits
output signal F is specified as follows:
• F = 1 when the input number is less than (3)
• F = 0 otherwise.
• Implement F using only NAND gates
4
Combinational Circuits
5
Binary Adder
6
Half Adder
7
X
0
0
1
1
Y
0
1
0
1
S
0
1
1
0
C-out
0
0
0
1
Half Adder Truth Table
Inputs
Outputs
S(X,Y) = Σ (1,2)
S = X’Y + XY’
S = X ⊕ Y
C-out(x, y, C-in) = Σ (3)
C-out = XY
X
Y
Sum S
C-out
Half
Adder
X
Y
S
C-OUT
Full Adder
8
X
0
0
0
0
1
1
1
1
Y
0
0
1
1
0
0
1
1
S
0
1
1
0
1
0
0
1
C-out
0
0
0
1
0
1
1
1
C-in
0
1
0
1
0
1
0
1
Full Adder Truth Table
S(X,Y, C-in) = Σ (1,2,4,7)
C-out(x, y, C-in) = Σ (3,5,6,7)
Inputs
Outputs
Sum S
C-in
X
0
1
00 01 11 10
Y
C-in
XY
0
1
2
3
6
7
4
5
1
1
1
1
C-in
X
0
1
00 01 11 10
Y
C-in
XY
0
1
2
3
6
7
4
5
1
1
1
1
Carry C-out
S = X’Y’(C-in) + XY’(C-in)’ + XY’(C-in)’ + XY(C-in)
S = X ⊕ Y ⊕ (C-in)
C-out = XY + X(C-in) + Y(C-in)
Full Adder Circuit Using AND-OR
9
XY
YC-in
C-out
XC-in
X
X
Y
C-in
Y
C-in
Y
Y’
Y
X
X’
X
C-in
C-in’
C-in
X’Y’C-in
XY’C-in’
Sum S
X’YC-in’
XYC-in
X’
X’
X
X
Y’
Y
Y
C-in
Y
C-in’
C-in’
C-in’
Full
Adder
X
Y
S
C-in
C-out
Full Adder Circuit Using XOR
10
Full
Adder
X
Y
S
C-in
C-out
XY
YC-in
C-out
XC-in
X
X
Y
C-in
Y
C-in
Sum S
X
Y
C-in
Binary parallel Adder
11
Full
Adder
X1
Y1
S1
C-in
C-out
Full
Adder
X0
Y0
S0
C-in
C-out
C0 =0
Full
Adder
X2
Y2
S2
C-in
C-out
Full
Adder
X3
Y3
S3
C-in
C-out
C1
C2
C3
C4
Data inputs to be added
Sum output
Adds two 4-bit numbers:
X = X3 X2 X1 X0
Y = Y3 Y2 Y1 Y0
producing the sum S = S3 S2 S1 S0 ,
C-out = C4 from the most significant
position j=3
4-bit parallel
Adder
X3X2X1X0
S3 S2 S1 S0
C-in
C-out
C4
Y3Y2Y1Y0
C0 =0
Inputs to be added
Sum Output
Look-Ahead Carry Binary Adders
C-out = C i+1 = Xi . Yi + (Xi + Yi) . Ci
C-out = C i+1 = Gi + Pi . Ci
12
Carry Look-Ahead Adders
C1 = G0 + P0.C0
C2 = G1 + P1.C1 = G1 + P1.G0 + P1.P0.C0
C3 = G2 + P2.G1 + P2.P1.G0 + P2.P1.P0.C0
C4 = G3 + P3.G2 + P3.P2.G1 + P3 . P2.P1.G0 + P3.P2.P1.P0.C0
where Gi = Xi . Yi Pi = Xi + Yi
13
Carry Look-Ahead Circuit
14
Ci = Gi-1 + Pi-1. Gi-2 + …. + Pi-1.P i-2. …P1 . G0 + P i-1.P i-2. …P0 . C0
Binary Arithmetic Operation: Subtraction
0 0 1 1 1 1 1 0 0 Borrow
X 229 1 1 1 0 0 1 0 1
Y - 46 - 0 0 1 0 1 1 1 0
183 1 0 1 1 0 1 1 1
15
Half Subtractor
16
X
0
0
1
1
Y
0
1
0
1
D
0
1
1
0
B-out
0
1
0
0
Half Subtractor Truth Table
Inputs
Outputs
D(X,Y) = Σ (1,2)
D = X’Y + XY’
D = X ⊕ Y
B-out(x, y, C-in) = Σ (1)
B-out = X’Y
Half
Subtractor
X
Y
D
B-OUT
X
Y
Difference D
B-out
Full Subtractor
17
X
0
0
0
0
1
1
1
1
Y
0
0
1
1
0
0
1
1
D
0
1
1
0
1
0
0
1
B-out
0
1
1
1
0
0
0
1
B-in
0
1
0
1
0
1
0
1
Full Subtractor Truth Table
S(X,Y, C-in) = Σ (1,2,4,7)
C-out(x, y, C-in) = Σ (1,2,3,7)
Inputs
Outputs
Difference D
B-in
X
0
1
00 01 11 10
Y
B-in
XY
0
1
2
3
6
7
4
5
1
1
1
1
B-in
X
0
1
00 01 11 10
Y
B-in
XY
0
1
2
3
6
7
4
5
1
1
1
1
Borrow B-out
S = X’Y’(B-in) + XY’(B-in)’ + XY’(B-in)’ + XY(B-in)
S = X ⊕ Y ⊕ (C-in)
B-out = X’Y + X’(B-in) + Y(B-in)
Full Subtractor Circuit Using AND-OR
18
X’Y
YB-in
B-out
X’B-in
X’
X’
Y
B-in
Y
B-in
Y
Y’
Y
X
X’
X
B-in
B-in’
B-in
X’Y’B-in
XY’B-in’
Difference D
X’YB-in’
XYB-in
X’
X’
X
X
Y’
Y
Y
B-in
Y
B-in’
B-in’
B-in’
Full
Subtractor
X
Y
D
B-in
B-out
Full Subtractor Circuit Using XOR
19
Difference D
X
Y
B-in
X’Y
YB-in
B-out
X’B-in
X’
X’
Y
B-in
Y
B-in
Full
Subtractor
X
Y
D
B-in
B-out
n-bit Subtractors
An n-bit subtracor used to subtract an n-bit number Y from another
n-bit number X (i.e X-Y) can be built in one of two ways:
20
4-bit Borrow Subtractor
21
Subtracts two 4-bit numbers:
Y = Y3 Y2 Y1 Y0 from
X = X3 X2 X1 X0
Y = Y3 Y2 Y1 Y0
producing the difference D = D3 D2 D1 D0 ,
B-out = B4 from the most significant
position j=3
4-bit
Subtractor
X3X2X1X0
D3 D2 D1 D0
B-in
B-out
B4
Y3Y2Y1Y0
B0 =0
Inputs
Difference Output D
Full
Subtractor
X1
Y1
D1
B-in
B-out
X0
Y0
D0
B-in
B-out
B0 =0
X2
Y2
D2
B-in
B-out
X3
Y3
D3
B-in
B-out
B1
B2
B3
B4
Data inputs to be subtracted
Difference output D
Full
Subtractor
Full
Subtractor
Full
Subtractor
4-bit Subtractor Using 4-bit Adder
22
4-bit
Adder
X3 X2 X1 X0
D3 D2 D1 D0
C-in
C-out
C4
Y3 Y2 Y1 Y0
C0 = 1
Inputs to be subtracted
Difference Output
S3 S2 S1 S0
Comparator-one bit
23
Decoders
24
Decoder
Map
Input
Code word
Enable
inputs
Output
code word
Binary n-to-2n Decoders
25
:
:
n
inputs
n to 2n
decoder
2n
outputs
2-to-4 Binary Decoder
26
F0 = X'Y'
F1 = X'Y
F2 = XY'
F3 = XY
X
Y
Truth Table:
2-to-4
Decoder
X
Y
F0
F1
F2
F3
3:8 Decoder
27
ABC
ABC
ABC
ABC
ABC
ABC
ABC
ABC
3:8
dec
O0
O1
O2
A
B
C
Enb
S2
S1
S0
O3
O4
O5
O6
O7
A
B
C
O0
O1
O2
O3
O4
O5
O6
O7
0
X
X
X
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1
1
0
0
0
0
0
0
0
1
E
1
1
1
1
1
1
1
1
3:8 Decoder
28
3-to-8 Binary Decoder
29
F1 = x'y'z
x
z
y
F0 = x'y'z'
F2 = x'yz'
F3 = x'yz
F5 = xy'z
F4 = xy'z'
F6 = xyz'
F7 = xyz
Truth Table:
3-to-8
Decoder
X
Y
F0
F1
F2
F3
F4
F5
F6
F7
Z
Encoders
e.g. 2n-to-n, priority encoders.
Y0 = I1 + I3 + I5 + I7
Y1= I2 + I3 + I6 + I7
Y2 = I4 + I5 + I6 +I7
30
.
.
.
.
.
.
2n
inputs
n
outputs
Binary
encoder
8-to-3 Binary Encoder
31
At any one time, only
one input line has a value of 1.
Inputs
Outputs
I
0
I
1
I
2
I
3
I
4
I
5
I
6
I
7
y2
y1
y2
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
0
0
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
1
1
1
1
I0
I1
I2
I3
I4
I5
I6
I7
Y0 = I1 + I3 + I5 + I7
y1 = I2 + I3 + I6 + I7
Y2 = I4 + I5 + I6 + I7
Multiplexers
32
Multiplexer
b bits
b bits
b bits
.
.
Data
output
n Data
Sources
s bits
Select
Enable
EN
SEL
D0
D1
Dn-1
Y
EN
.
.
.
D0
D1
Dn-1
.
.
.
1Y
2Y
bY
SEL
2:1 Multiplexer and 4:1 Multiplexer
Truth table for a 4-to-1 multiplexer and 2:1 Multiplexer
33
mux
Y
Inputs
select
S1 S0
I0
I1
I2
I3
4:1
MUX
Y
Inputs
select
S1 S0
I0
I1
I2
I3
0
1
2
3
Output
4-to-1 MUX Circuit
34
S1
S0
0 1 2 3
2-to-4 Decoder
I0
I1
I2
I3
Y
S1
S0
I0
I1
I2
I3
Y
Larger Multiplexers
35
4:1 MUX
I0
I1
I2
I3
S1 S0
4:1 MUX
I4
I5
I6
I7
S1 S0
2:1 MUX
S2
Y
Demultiplexers
36
2X4
Decoder
Select
lines
Input
data (1bit)
Enable
One of
four 1-bit
outputs
One of n
Data
Sources
selected
s bits
Select
b bits
b bits
b bits
.
.
Data
Input
Demux
One of n outputs
1-bit 4-output demultiplexer using
a 2x4 binary decoder.
1-to-4 Demultiplexer
37
demux
Data D
Outputs
select
S1 S0
Y0 = D.S1'.S0'
Y1 = D.S1'.S0
Y2 = D.S1.S0'
Y3 = D.S1.S0
2x4 Decoder
D
S1
S0
Y0 = D.S1'.S0'
Y1 = D.S1'.S0
Y2 = D.S1.S0'
Y3 = D.S1.S0
E
38
PLDs (Programmable Logic Devices)
General Structure of PLD
39
General Structure of PLD
40
General Structure of PLD
41
Device | AND-array | OR-array |
PROM | Fixed | Programmable |
PLA | Programmable | Programmable |
PAL | Programmable | Fixed |
Programming a PLD
42
Programming a PLD
43
PLD Notation
44
PLD Notation
45
PLD Notation
46
Programmable Read-Only Memory (PROM)
47
PROM Structure
48
Logic Diagram
PROM Structure
49
PLD Notation
Example
50
Why is it called PROM?
51
Programmable Logic Array
52
Programmable Logic Array
53
Programmable Logic Array
54
PROM vs PLA
55
Logic Design Example
56
Logic Design Example
57
Logic Design Example
58
Additional Features
59
Example of Use of Complemented Functions
60
Example of Use of Complemented Functions
61
PLA Table
62
Programmable Array Logic (PAL) Devices
63
Example of Logic Design with PAL
64
Example of Logic Design with PAL
65
University Questions
F(A,B,C,D)=Σm(0,1,3,4,7,10,12,14) with A,B,C select lines. 10M
66
Assignment Questions
67