Chapter 2 - SV
Chapter 2 - SV
DIGITAL
ELECTRONICS
Chapter 2:
Combinational logic
circuits
Excess-3 Code
Gray Code
The Gray code was designed by Frank Gray at Bell Labs and
patented in 1953. It is an unweighted binary code in which two
successive values differ only by 1 bit.
Binary–Gray Code Conversion
BCD Codes
2.2.
4. The truth table is prepared that completely defines the relationship between
the input variables and output functions.
5. The simplified Boolean expression is obtained by any method of
minimization—algebraic method, Karnaugh map method, or tabulation method.
6. A logic diagram is realized from the simplified expression using logic gates
6
0 1 1 0
6
7
0 1 1 1
7
8
1 0 0 0
8
9
1 0 0 1
9
0 1 0 1
5 D = 1 + 3 + 5 + 7 + 9 = (1,3,5,7,9)
6
0 1 1 0
7
0 1 1 1
8
1 0 0 0
9
1 0 0 1
A 8 9 8 . 9
1
B 4 5 6 7 4 . 5 . 6 . 7
2
C 2 3 6 7 2 . 3 . 6 . 7
3
D 1 3 5 7 9 1 . 3 . 5 . 7 . 9
4
5
6
7
8
9
A B C D
a
a a a
a a
f b f b f b f b f b
f b
g g g g g
c e c e c e c e c
g
e c d d d d d
a a a
a a
d
f b f b f b f b f b
Seven-segment LED display
g g g g g
e c e c e c e c e c
d d d d d
a a a a
a a a a a a
f b f b f b f b f b f b f b f b f b f b
g g g g g g g g g g
c e c e c e c e c e c e c e c e c e c
d d d d d d d d d d
Deci
mal
A B C D a b c d e f g
Num
bers
0 0 0 0 0 0 0 0 0 0 1 0
0 0 0 1 1 0 0 1 1 1 1 1
0 0 1 0 0 0 1 0 0 1 0 2
0 0 1 1 0 0 0 0 1 1 0 3
0 1 0 0 1 0 0 1 1 0 0 4
0 1 0 1 0 1 0 0 1 0 0 5
0 1 1 0 0 1 0 0 0 0 0 6
0 1 1 1 0 0 0 1 1 1 1 7
1 0 0 0 0 0 0 0 0 0 0 8
1 0 0 1 0 0 0 0 1 0 0 9
b (0,1,3, 4, 7,8,9)
c (0,1,3, 4,5, 6, 7,8,9)
D3
A1 A0 D0 D1 D2 D3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
True Table
D0 A1.A 0
D1 A1 .A 0
D 2 A1.A 0
D3 A1.A 0
D0 Example
D1
A0
D2
A1 D3 a) Construct a 5-to-32 line
A2 Inputs
A3
D4 decoder with the use of a
D5
D6 4-to-16 line decoder.
74154 D7
Lối ra
D8
E1 D9 b) Construct a 6-to-64 line
Inputs D10 decoder with the use of a
Control D11
E2 D12 4-to-16 line decoder.
D13
D14
D15
The bit combinations 3-bit binary code and its equivalent bit
combinations of gray code are listed in the table in Figure
Deci Deci Binary Gray
Binary Gray
mal mal
B2 B1 B0 G2 G1 G0 B2 B1 B0 G2 G1 G0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 1 1 0 0 1 0 0 1
2 0 1 0 2 0 1 0 0 1 1
3 0 1 1 3 0 1 1 0 1 0
4 1 0 0 4 1 0 0 1 1 0
5 1 0 1 5 1 0 1 1 1 1
6 1 1 0 6 1 1 0 1 0 1
7 1 1 1 7 1 1 1 1 0 0
Truth Table Truth Table
www.ptit.edu.vn TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
Binary-to-gray Converter
G 2 B2
G1 B2 B1
G 0 B1 B0
B2 G2
B1 G1
B0 G0
Circuit diagram
www.ptit.edu.vn TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
The bit combinations 3-bit binary code and its equivalent bit
combinations of gray code are listed in the table in Figure
Deci Gray Binary Deci Gray Binary
mal mal
G2 G1 G0 B2 B1 B0 G2 G1 G0 B2 B1 B0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 1 1 0 0 1 0 0 1
2 0 1 1 2 0 1 1 0 1 0
3 0 1 0 3 0 1 0 0 1 1
4 1 1 0 4 1 1 0 1 0 0
5 1 1 1 5 1 1 1 1 0 1
6 1 0 1 6 1 0 1 1 1 0
7 1 0 0 7 1 0 0 1 1 1
www.ptit.edu.vn Truth Table TRẦN THÚY HÀ Truth Table
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
Binary-to-gray Converter
B2 G 2
B1 G1 B2
B0 G 0 B1
G2 B2
G1 B1
G0 B0
Circuit diagram
www.ptit.edu.vn TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
2.7. MULTIPLEXERS AND DEMULTIPLEXERS
2.7.1. MULTIPLEXERS OR DATA SELECTORS
A multiplexer or MUX, also called a data selector, is a
combinational circuit with more than one input line, one output
line and more than one selection line.
The term multiplex means “many into one.”
A digital multiplexer of 2n input channels can be controlled by n
numbers of select lines and an input line is selected according to
the bit combinations of select lines
D0
EN A1 A0 Y
D1 4-to-1 0 x x 0
MULTIPLEXER Y
1 0 0
D2
1 0 1
D3 1 1 0
1 1 1
Block diagram
MUX 4:1
D0
EN A1 A0 Y
D1 4-to-1 0 x x 0
MULTIPLEXER Y
1 0 0 D0
D2
1 0 1 D1
D3 1 1 0 D2
1 1 1 D3
Output function:
A1 A0 Y0 Y1 Y2 Y3
0 0
0 1
1 0
1 1
Truth Table – DEMUX 1:4
A1 A0 Y0 Y1 Y2 Y3
0 0 D 0 0 0
0 1 0 D 0 0
1 0 0 0 D 0
1 1 0 0 0 D
Truth Table – DEMUX 1:4
Y0 A1 .A 0 .D
Y1 A1 .A 0 .D
Y2 A1 .A 0 .D
Y3 A1 .A 0 .D
1
D
MUX 16:1.
MUX 8:1 (selection inputs: A,B,C).
MUX 4:1 (selection inputs: A,B).
MUX 4:1 (selection inputs: A,B,C).
MUX 2:1 (selection inputs: A,B,C,D).
Decoder 4:16.
Decoder 3:8
Decoder 2:4
Decoder 1:2
A B C D F
0 0 0 0 1
0 0 0 1 0
0 0 1 0 0 1
D0
0 0 1 1 1 D1
0
0 1 0 0 0 0
D2 MUX
0 1 0 1 1 D3
0 1 1 0 0
1
D4 16:1
0 Y
0 1 1 1 1 1
D5 F
1 0 0 0 0 0
D6
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1 1 A 3 A2 A 1 A0
D15
1 1 0 0 1
1 1 0 1 1 A B C D
1 1 1 0 0
1 1 1 1 1
Bảng 4-22.
www.ptit.edu.vn Bảng trạng thái TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
A B C F
D D0
0 0 0 D
D1
0 0 1 D D
0 1 0 D D
D2 MUX
D3
0 1 1 D
D
D4 8:1
0 Y
1 0 0 0 D
D5 F
1 0 1 D 1
D6
1 1 0 1 D
D7
1 1 1 D A2 A 1 A0
A B C
Truth table
MUX
D2
4:1
D3
A1 A0
A B
D D2 MUX
4:1
D D3
A F
A1 A0
E
B C
“0” D4 A1 A0
Y
D5 F2
D
D6 MUX
“1”
D7
4:1
D
Decoder 4:16
D0
A A3
MUX
16:1 D3
F
B D5
A2
D7
C A1
D11
A0 D12
D D13
D15
Decoder 3:8
D0
Giải
D3
mã
D5
3:8
D7
A
A2 A1 A0
E
B C D
F
A2 A1 A0
Giải D11
mã D12
D13
3:8
D15
E
a0 b0 S0 C0
0 0
0 1
1 0
1 1
Truth table of Half-adder
a0 b0 S0 C0
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
True table of Half-adder
S0 a 0 b0
C0 a 0 .b 0
a0 S0
a)
HA
b0 C0
a0
S0
b0
b)
C0
Truth Table
ai bi Ci S0 C0
0 0 0 0 0
0 1 0
1 0 0
1 1 0
0 0 1
0 1 1
1 0 1
1 1 1
Truth Table
ai bi Ci S0 C0
0 0 0 0 0
0 1 0 1 0
1 0 0 1 0
1 1 0 0 1
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 1
Truth Table
ai bi Ci S0 C0
0 0 0 0 0
S0 ai bi Ci ai bi Ci ai bi Ci ai bi Ci
0 1 0 1 0
1 0 0 1 0
Ci (ai bi ai bi ) Ci (ai bi ai bi )
1 1 0 0 1 Ci (ai bi ) Ci (ai bi ) ai bi Ci
0 0 1 1 0
0 1 1 0 1
1 0 1 0 1 C0 ai bi Ci ai bi Ci ai bi Ci ai bi Ci
1 1 1 1 1
C0 ai bi (Ci Ci ) Ci (ai bi ai bi )
ai bi ai bi Ci
Ci
ai S0
bi
C0
a) Logic diagram
Si
C0 FA Ci
ai bi
b) Block diagram
A3 B3 A2 B2 A1 B1 A0 B0
C3
FA C2
FA C1
FA C0
FA C-1
S3 S2 S1 S0
Carry out ( 23 ) ( 22 ) ( 21 ) ( 20 )
a0 b0 S0 B0
0 0
0 1
1 0
1 1
Truth table of Half-subtractors
a0 b0 S0 B0
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0
Truth table of Half-subtractors
S0 a 0 b 0
B0 a 0 .b 0
a0 S0
a)
HS
b0 B0
a0
S0
b0
b)
B0
a0
S0
b0
C0 / B 0
M=0: a + b
M=1: a - b
Truth table
ai bi Bi S0 B0
0 0 0 0 0
0 1 0
1 0 0
1 1 0
0 0 1
0 1 1
1 0 1
1 1 1
Truth table
ai bi Bi S0 B0
0 0 0 0 0
0 1 0 1 1
1 0 0 1 0
1 1 0 0 0
0 0 1 1 1
0 1 1 0 1
1 0 1 0 0
1 1 1 1 1
Outputs function:
Truth table
ai bi Bi S0 B0 S0 ai bi Bi ai bi Bi ai bi Bi ai bi Bi
0 0 0 0 0 Bi (ai bi ai bi ) Bi (ai bi ai bi )
0 1 0 1 1
Bi (ai bi ) Bi (ai bi ) ai bi Bi
1 0 0 1 0
1 1 0 0 0
B0 ai bi Bi ai bi Bi ai bi Bi ai bi Bi
0 0 1 1 1
0 1 1 0 1
B0 ai bi ( Bi Bi ) Bi (ai bi ai bi )
1 0 1 0 0 ai bi ai bi Bi
1 1 1 1 1
Truth table
ai bi f< f= f>
0 0
0 1
1 0
1 1
Truth table
ai bi f< f= f>
0 0 0 1 0
0 1 1 0 0
1 0 0 0 1
1 1 0 1 0
Outputs function: f a i . b i
f a i bi
f a i . b i
www.ptit.edu.vn TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics 77
DIGITAL ELECTRONICS
2.9.1. Design a 1-bit magnitude comparator
A > B if:
A > B if:
or a3 > b3,
or a3 = b3, and a2 > b2,
or a3 = b3, and a2 = b2, and a1 > b1,
or a3 = b3, and a2 = b2, and a1 = b1, and a0 > b0.
f a3 .b3 a3 b3 .a2 .b2 a3 b3 .a2 b2 .a1.b1 a3 b3 .a2 b2 .a1 b1.a0 .b0
a3
b3
a2
b2
f>
a1
b1
a0
b0
Logic diagram
Parity Checker
The message bits with the parity bit are transmitted to their
destination, where they are applied to a parity checker circuit.
The circuit that checks the parity at the receiver side is called the
parity checker.
The parity checker circuit produces a check bit and is very
similar to the parity generator circuit. If the check bit is 1, then it
is assumed that the received data is incorrect. The check bit will
be 0 if the received data is correct
Even
Even
Inputs Parity Parity
Checker
D3 D2 D1 Pe Ce
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 0
1 0 0 1 0
1 0 1 0 0
1 1 0 0 0
1 1 1 1 0
Ce D3 D2 D1 Pe
www.ptit.edu.vn TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
Logic diagram:
Odd
Odd
Inputs Parity Parity
Checker
D3 D2 D1 Po Co
0 0 0 1 0
0 0 1 0 0
0 1 0 0 0
0 1 1 1 0
1 0 0 0 0
1 0 1 1 0
1 1 0 1 0
1 1 1 0 0
C0 D3 D2 D1 Po
Logic diagram:
I0 I1 I2 I3 I4 I5 I6 I7
4 OI
54/74180
3 EI
SE SO
5 6
VCC = 14
GND = 7
9 8 7 6 5 4 3 2 1
D5 P8 D4 D3 D2 P4 D1 P2 P1
Bits P1 produce parity bits for the bit fields: 1,3,5,7,9…
Pe D1 D2 D3 ....
Po D1 D2 D3 ....
10 9 8 7 6 5 4 3 2 1
1 0 P8 1 1 0 P4 1 P2 P1
P?
P1:
P1 = 1 0 1 0 → P1 = 0
P2:
P2 = 1 1 1 1 → P2 = 0
P4 = D2 D3 D4
P4 = 0 1 1 → P4 = 0
P8:
P8 = pos. 9 pos. 10
P8 = D5 D6
P8 = 0 1 → P8 = 1
=>>
1 0 1 1 1 0 0 1 0 0
www.ptit.edu.vn TRẦN THÚY HÀ
V1.0 FacultyBàiofgiảng Điện tử số Engineering
Electronics
DIGITAL ELECTRONICS
Ex: Encode data bits 11001 into a odd parity Hamming code
9 8 7 6 5 4 3 2 1
1 P8 1 0 0 P4 1 P2 P1
P1 = 0
P2 = 1
P4 = 0
P8 = 0
D6 D5 D4 D3 D2 D1 P1 P2 P4 P8
+
+
+
+
1 0 0 1 1 0 0 1 0 0
Si
10 9 8 7 6 5 4 3 2 1
1 0 0 1 1 0 0 1 0 0
S1 = 0
S2 = 0
S4 = 0
S8 = 1
D6 D5 P8 D4 D3 D2 P4 D1 P2 P1 S1 S2 S4 S8
+
+
+
+
9 8 7 6 5 4 3 2 1
1 1 1 0 0 0 1 1 0
S1 = 1
S2 = 1
S4 = 1
S8 = 0
S8S4S2 S1 = 01112
S8 S 4 S 2 S1 10002 810
Bit position in error: