2Chapter Basic Digital Logic 1
Basic Digital Logic
Chapter 2
2Chapter Basic Digital Logic 2
Outlines Basic Digital Logic Gates Two types of digital logic circuits
Combinational logic circuits Sequential logic circuits
Combinational logic circuit design Using sum of product Using product of sum
Karnaugh map: Minimization of logic circuits Without don’t care term With don’t care term
Construction from smaller components Sequential logic circuit
2Chapter Basic Digital Logic 3
Switches
Abstraction of building block of digital computers
Basic logic functions AND OR NOT
B
A
A
A B
2Chapter Basic Digital Logic 4
Basic Digital Logic Gates
NOT gate
AND gate OR gate XOR gate
NAND gate NOR gate XNOR gate
2Chapter Basic Digital Logic 5
Two types of digital logic circuits Combinational logic circuits
Output depends only on its input at that time.
Sequential logic circuits Output depends both on
its previous output and its input at that time
CombinationalLogic Circuit
SequentialLogic Circuit
2Chapter Basic Digital Logic 6
Combinational Logic Circuit
2Chapter Basic Digital Logic 7
How to design a combinational logic circuit
Decide how to encode input and output in 0 and 1
Describe each bit of the output in term of input Truth table Logical function
Construct a logic circuit from the logical function
2Chapter Basic Digital Logic 8
Truth table and logical function
out = f (in1, in2, …)
in1 in2 … out
0 0 0 1
0 0 1 0
0 1 0 …
… … … …
1 1 1 0
2Chapter Basic Digital Logic 9
Boolean Logic Basic Boolean operations
AND: X Y, X & Y, X Y, X Y OR: X Y, X + Y NOT: ~X, X’, X
Any Boolean expressions can be described in: Disjunctive normal form (DNF) /sum of product Conjunctive normal form (CNF) / product of
sum
2Chapter Basic Digital Logic 10
Example: Exclusive OR (XOR)
output = X Y + XY
X Youtpu
t
0 0 0
0 1 1
1 0 1
1 1 0
2Chapter Basic Digital Logic 11
Construct Sum of Products
Find out all conditions when the function is true X Y = T(1) when
X=0, Y=1 => X Y =1 X=1, Y=0 => XY = 1
OR the conditions X Y + XY
Sum of products
X Youtpu
t
0 0 0
0 1 1
1 0 1
1 1 0
minterm
2Chapter Basic Digital Logic 12
Exclusive OR (XOR): Sum of products
output =X Y + XY mintern
X Y output
XY 0 0 0
X Y 0 1 1
XY 1 0 1
X Y 1 1 0
X
Y
output
2Chapter Basic Digital Logic 13
Construct Product of Sums
Find out all conditions when the negation of the function is true X Y = F(0) when
X=0, Y=0 => X + Y = 0 X=1, Y=1 =>X +Y = 0
AND the conditions ( X + Y )(X +Y)
Product of sum
X Y output
0 0 0
0 1 1
1 0 1
1 1 0
maxterm
2Chapter Basic Digital Logic 14
Exclusive OR (XOR) output = ( X + Y )(X +Y )
X
Y
output
maxterm
X Youtpu
t
X + Y 0 0 0
X +Y 0 1 1
X +Y 1 0 1
X +Y 1 1 0
2Chapter Basic Digital Logic 15
Karnaugh Map (K-map)
2Chapter Basic Digital Logic 16
2-variable K-map A
B0 1
0
1
A B X
0 0
0 1
1 0
1 1
2Chapter Basic Digital Logic 17
3-variable K-mapA B C X
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
AB
C00 01 11 10
0
1
2Chapter Basic Digital Logic 18
4-variable K-map
A B C D X0 0 0 00 0 0 10 0 1 00 0 1 10 1 0 00 1 0 10 1 1 00 1 1 11 0 0 01 0 0 11 0 1 01 0 1 11 1 0 01 1 0 11 1 1 01 1 1 1
AB
CD00 01 11 10
00
01
11
10
2Chapter Basic Digital Logic 19
Full Adder
Full
ad
der
ABCi
SCo
A B Ci S Co
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
2Chapter Basic Digital Logic 20
Full AdderA B C S Co
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
ABC 00 01 11 10
0 0 1 0 1
1 1 0 1 0
AB
C 00 01 11 10
0 0 0 1 0
1 0 1 1 1
S=A’B’C+A’BC’+ABC+AB’C’
Co=AB+BC+AC
2Chapter Basic Digital Logic 21
Encoder
Encoder
A3
A2
A1
X1
A0X0
A3 A2 A1 A0 X1 X0
0 0 0 0 X X
0 0 0 1 0 0
0 0 1 0 0 1
0 0 1 1 X X
0 1 0 0 1 0
… X X
1 0 0 0 1 1
… X X
1 1 1 1 X X
2Chapter Basic Digital Logic 22
Encoder
A3 A2 A1 A0 X1 X0
0 0 0 0 X X
0 0 0 1 0 0
0 0 1 0 0 1
0 0 1 1 X X
0 1 0 0 1 0
… X X
1 0 0 0 1 1
… X X
1 1 1 1 X X
A3A2
A1A0
00 01 11 10
00 X 1 X 1
01 0 X X X
11 X X X X
10 0 X X X
X1 = A1A0
2Chapter Basic Digital Logic 23
Encoder
A3 A2 A1 A0 X1 X0
0 0 0 0 X X
0 0 0 1 0 0
0 0 1 0 0 1
0 0 1 1 X X
0 1 0 0 1 0
… X X
1 0 0 0 1 1
… X X
1 1 1 1 X X
A3A2
A1A0
00 01 11 10
00 X 0 X 1
01 0 X X X
11 X X X X
10 1 X X X
X0 = A1+A3
2Chapter Basic Digital Logic 24
Decoder
2 - 4 decoder
b3
b2
b1
b0
a1
a0
If a1 a0 is a binary i,
•bi is 1 and
•bj is 0 when ji.
a1 a0 b3 b2 b1 b0
0 0 0 0 0 1
0 1 0 0 1 0
1 0 0 1 0 0
1 1 1 0 0 0
2Chapter Basic Digital Logic 25
Decoder
a1 a0 b3 b2 b1 b0
0 0 0 0 0 1
0 1 0 0 1 0
1 0 0 1 0 0
1 1 1 0 0 0
b3 = a1 a0
b2 = a1a0
b1 =a1 a0
b0 =a1a0
b3
b2
b0
b1
a0
a1
2Chapter Basic Digital Logic 26
Multiplexor
2-1 multiplexor
D1
D0
x
S
X = Ds
S D1 D0 x
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
2Chapter Basic Digital Logic 27
MultiplexorS D1 D0 x
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
D1D0
S
00 01 11 10
0 0 1 1 0
1 0 0 1 1
X = S D0 + S D1
2Chapter Basic Digital Logic 28
Multiplexor
X = S D0 + S D1
D1
D0
S
X
2Chapter Basic Digital Logic 29
Construction from Smaller Components
2Chapter Basic Digital Logic 30
2-bit Full Adder
1 1 A1 A0
0 1 + B1 B0 +
1 0 0 C S1 S0FA0FA1
A1 B1 A0 B0 Ci=0
C S1 S0
A B Ci
Co S
A B Ci
Co S
2-bit full adder
2Chapter Basic Digital Logic 31
4-bit Full Adder
1 0 1 1 0 1 1 1 + 1 0 0 1 0
A1 A0
B1 B0 +
C S1 S0
2FA02FA1
A1 B1 A0 B0 Ci=0
C S1 S0
A B Ci
Co S
A B Ci
Co S
2
22
2
2 2
4-bit full adder
2Chapter Basic Digital Logic 32
Sequential Circuit
2Chapter Basic Digital Logic 33
ClockSignal oscillating between 0 and 1
clock cycle time / clock period
Rising edge Falling edge
Edge-triggered clockingThe state of the sequential circuits changes on the clock edge.
2Chapter Basic Digital Logic 34
Types of sequential circuits Synchronous circuits
With clock Use in digital computers
Asynchronous circuits Without clock
2Chapter Basic Digital Logic 35
SR LatchR
Q’S
Q0
1
1
0
0
1
set
R
Q’S
Q1
0
0
1
1
0
reset
R
Q’S
Q0
0
1/0
0/1
0/1
1/0
hold
R
Q’S
Q1
1
?
?
?
?
unstable
2Chapter Basic Digital Logic 36
D LatchC
D
Q
Q
0
0
Q0
0
0
Q0
Q0
C
D
Q
Q
0
1
Q0
0
0
Q0
Q0
C
D
Q
Q
1
0
0
0
1
0
C
D
Q
Q
1
1
1
1
0
0
Q0 0
CDQ
C=0 hold dataC=1 load data
2Chapter Basic Digital Logic 37
D Flip-flop
D latch D latchD
C
D
C
Q QD
C
10
xD QD
D latch D latchD
C
D
C
Q QD
C
01
xx QQ
D latch D latchD
C
D
C
Q QD
C
00
xx xx
D latch D latchD
C
D
C
Q QD
C
11
xD DD
C
D
Q
C=1 0 load data
2Chapter Basic Digital Logic 38
Registers
D flip-flop
D flip-flop
D flip-flop
D flip-flop
D flip-flop
D flip-flop
D flip-flop
D flip-flop
clkD7 D
6 D
5 D
4 D3 D2 D1 D0
O7 O
6 O
5 O
4 O3 O2 O1 O0
8-bit REGISTERDin Dout
clk
8 8 C
D
Q
Set-up time
Hold time
2Chapter Basic Digital Logic 39
Register Files
n-2n
decoder
Register n-1
Register n-2
Register 0
. . .
nn-1n-2
0
Write
Register number
Datain8
n-1MUX
Dataout8
2Chapter Basic Digital Logic 40
Finite State Machines
Next-state function
(Combinational)
Current State(registers)
Outputfunction
(Combinational)Inputs
Outputs
2Chapter Basic Digital Logic 41
Counter 0 -> 3
clka
b
Current State
Next State
a b A B
0 0 0 1
0 1 1 0
1 0 1 1
1 1 0 0
A = a bB =b
D Q
Q
D Q
Q
clk
a b
2Chapter Basic Digital Logic 42
Counter with resetR
clk
a
b resetR
Current State
Next State
a b A B
0 0 0 0 1
0 0 1 1 0
0 1 0 1 1
0 1 1 0 0
1 0 0 0 0
1 0 1 0 0
1 1 0 0 0
1 1 1 0 0
A = R (a b)B = Rb
D Q
Q
D Q
QR
clk
a b