Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

DIGITAL LOGIC CIRCUITS

Digital logic circuits electronic circuits that handle information


encoded in binary form (deal with signals
that have only two values, 0 and 1)
Digital …. computers, watches, controllers, telephones, cameras, ...

BINARY NUMBER SYSTEM

Number ….in
whatever base Decimal value of the given number
___________________________________________________________________________________________________________________________________________________________________

Decimal: 1,998 = 1x103 +9x102 +9x101 +8x100 =1,000+900+90+8 =1,998


Binary:
11111001110 = 1x210 +1x29 +1x28 +1x27 +1x26 +1x23 +1x22 +1x21 =
1,024+512+258+128+64+8+4+2 = 1,998

© Emil M. Petriu Prof. Emil M. Petriu, School of Electrical Engineering and Computer Science, University of Ottawa
Powers of 2
____________________________________________________________________________________________________________________________________________________________________

N 2N Comments
_____________________________________________________________________________________________________________________________________________________________________

0 1
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1,024 “Kilo”as 210 is the closest power of 2 to 1,000 (decimal)
11 2,048
……………………………………………………….....
15 32,768 215 Hz often used as clock crystal frequency in digital watches
…………………………………………………….....

20 1,048,576 “Mega” as 220 is the closest power of 2 to 1,000,000 (decimal)


…………………………………………………...
30 1,073,741,824 “Giga” as 230 is the closest power of 2 to 1,000,000,000(decimal)
____________________________________________________________________________________________________________________________________________________________________

© Emil M. Petriu
Negative Powers of 2
_____________________________________________________________

N <0 2N
____________________________________________________________ Binary numbers less than 1
-1 2-1 = 0.5 Binary Decimal value
-2 2-2 = 0.25 -----------------------------------------------------------------------------------------------------------------

-3 2-3 = 0.125 0.101101 = 1x2-1 +1x2-3 + 1x2-4 +


-4 2-4 = 0.0625 1x2-6 = 0.703125
-5 2-5 = 0.03125
-6 2-6 = 0.015625
-7 2-7 = 0.0078125
-8 2-8 = 0.00390625
-9 2-9 = 0.001953125
-10 2-10 = 0.0009765625

_____________________________________________________________

© Emil M. Petriu
HEXADECIMAL
----------------------------------------------------------------------------------------------------

Binary Decimal Hexadecimal


Binary: ----------------------------------------------------------------------------------------------------

11111001110 0000 0 0
0001 1 1
0010 2 2
0011 3 3
111 1100 1110 0100 4 4
7 12 14 <== Decimal 0101 5 5
0110 6 6
0111 7 7
Hexadecimal: 7CE = 7x162 +12x161 1000 8 8
+14x160 = 1998 1001 9 9
1010 10 A
1011 11 B
1100 12 C
1101 13 D
1110 14 E
1111 15 F
----------------------------------------------------------------------------------------------------

© Emil M. Petriu
LOGIC OPERATIONS AND TRUTH TABLES

Digital logic circuits handle data encoded in binary form, i.e. signals
that have only two values, 0 and 1.

Binary logic dealing with “true” and “false” comes in handy to describe
the behaviour of these circuits: 0 is usually associated with “false” and
1 with “true.”

Quite complex digital logic circuits (e.g. entire computers) can be built
using a few types of basic circuits called gates, each performing a single
elementary logic operation : NOT, AND, OR, NAND, NOR, etc..

Boole’s binary algebra is used as a formal / mathematical tool to


describe and design complex binary logic circuits.

© Emil M. Petriu
GATES

A B A.B AND
A A NOT _____________________________________

______________________ 0 0 0 A
0 1 A F =A 0 1 0 F =A . B
1 0 1 0 0 B
1 1 1
_____________________________________

A B A+B OR
_____________________________________

0 0 0 A
0 1 1 F=A+ B
1 0 1 B
1 1 1
_____________________________________

© Emil M. Petriu
… more GATES

A B A.B NAND
_____________________________________

0 0 1 A
0 1 1 F =A . B
1 0 1 B
1 1 0
_____________________________________

A B A+B NOR
_____________________________________

0 0 1 A
0 1 0 F=A+ B
1 0 0 B
1 1 0
_____________________________________

© Emil M. Petriu
… and more GATES

XOR
A B A ⊕B
_____________________________________

0 0 0 A
0 1 1 F = A ⊕B
1 0 1 B
1 1 0
_____________________________________

A B A ⊕B EQU or XNOR
_____________________________________

0 0 1
A
0 1 0 F = A ⊕B
1 0 0 B
1 1 1
_____________________________________

© Emil M. Petriu
GATES … with more inputs EXAMPLES OF
GATES WITH
THREE INPUTS

A B C A. B.C A+B+C A.B.C A+B+C


______________________________________________ ___________________ ___________________ ___________________

0 1 1 A
0 0 0 0 F =A.B.C
0 0 1 0 1 1 0 B AND
0 1 0 0 1 1 0 C
0 1 1 0 1 1 0
1 0 0 0 1 1 0
1 0 1 0 1 1 0 A
F = A+B+C
1 1 0 0 1 1 0 B OR
1 1 1 1 1 0 0 C
__________________________________________________________________ ___________________ ___________________

A A
F =A.B.C F = A+B+C
B NAND B NOR
C C

© Emil M. Petriu
Logic Gate Array that Produces an Arbitrarily Chosen Output

A B C
F= A.B .C + A.B .C
A B C F + A.B .C + A.B .C
________________________________________

0 0 0 0
0 0 1 0 A.B .C
0 1 0 1
0 1 1 1
1 0 0 0 A.B .C
1 0 1 1 F
1 1 0 0
1 1 1 1 A.B .C
_________________________________________

A.B .C

“Sum-of-products”
A B C
form of the logic circuit.
© Emil M. Petriu
A B C
BOOLEAN ALGEBRA

“ Proof ”:
AND rules

A.A=A A B C A. (B+C) A.B+A.C


____________________________________________________________

A.A= 0 0 0 0 0 0
0 .A=0 0 0 1 0 0
1.A=A 0 1 0 0 0
A.B =B.A 0 1 1 0 0
A . (B . C) = (A . B) . C 1 0 0 0 0
A . (B + C) = A . B + A . C 1 0 1 1 1
1 1 0 1 1
1 1 1 1 1
A.B =A+ B

© Emil M. Petriu
BOOLEAN ALGEBRA … continued

OR rules
A B C A + B.C (A+B) . (A+C)
_____________________________________________________________________
A+A=A 0 0 0 0 0
A+A=1 0 0 1 0 0
0 +A=A 0 1 0 0 0
1+A=1 0 1 1 1 1
A+B=B+A 1 0 0 1 1
A + (B + C) = (A + B) + C 1 0 1 1 1
A + B . C = (A + B) . (A +C) 1 1 0 1 1
1 1 1 1 1

A+B =A. B

© Emil M. Petriu
DeMorgan’s Theorem

A B A.B A+B A+B A.B


_______________________________
A.B =A+ B 1 1
0 0 1 1
0 1 0 0 1 1
A+ B =A. B 1 1
1 0 0 0
1 1 0 0 0 0

© Emil M. Petriu
Simplifying logic functions using Boolean algebra rules

A B C
Sum-of-products form of the logic function:

F =ABC + ABC + ABC + ABC

A.B .C

A.B .C
F
A.B .C

A.B .C

A B C
A B C
© Emil M. Petriu
Simplifying logic functions using Boolean algebra rules … continued

F = ABC + ABC + ABC + ABC F = (ABC + ABC) + (ABC + ABC)

F = A(BC + BC) + A ( BC + BC)

F = AB( C + C) + AC ( B + B)
A B C 1 1

F = AB + AC

A.B
F

A.C

A A
© Emil M. Petriu
Simplifying logic functions using Karnaugh maps

Karnaugh map => graphical representation A B C F


of a truth table for a logic function. (0) 0 0 0 ...
(1) 0 0 1 ...
Each line in the truth table corresponds (2) 0 1 0 ...
to a square in the Karnaugh map. (3) 0 1 1 ...
(4) 1 0 0 ...
(5) 1 0 1 ...
The Karnaugh map squares are labeled so
(6) 1 1 0 ...
that horizontally or vertically adjacent squares (7) 1 1 1 ...
differ only in one variable. (Each square in
the top row is considered to be adjacent to a
corresponding square in the bottom row. Each AB
square in the left most column is considered to
C 00 01 11 10
be adjacent to a corresponding square in the
right most column.) 0 0 2 6 4
1 1 3 7 5
Karnaugh map

© Emil M. Petriu
Simplifying logic functions of 4 variables using Karnaugh maps

A B C D F
(0) 0 0 0 0 ...
(1) 0 0 0 1 ...
AB
(2) 0 0 1 0 ...
(3) 0 0 1 1 ... 00 01 11 10
CD
(4) 0 1 0 0 ...
00 0 4 12 8
(5) 0 1 0 1 ...
(6) 0 1 1 0 ... 01 1 5 13 9
(7) 0 1 1 1 … 11 3 7 15 11
(8) 1 0 0 0 …
(9) 1 0 0 1 … 10 2 6 14 10
(10) 1 0 1 0 …
(11) 1 0 1 1 …
(12) 1 1 0 0 …
(13) 1 1 0 1 …
(14) 1 1 1 0 …
(15) 1 1 1 1 ...

© Emil M. Petriu
Simplifying logic functions using Karnaugh maps … looping

The logic expressions for an output can be simplified by properly


combining squares (looping) in the Karnaugh maps which contain 1s.

Looping a pair of adjacent 1s eliminates the variable that appears in


both direct and complemented form.

A B C F AB
(0) 0 0 0 0 C 00 01 11 10
(1) 0 0 1 0
0 0 1 0 0
(2) 0 1 0 1
(3) 0 1 1 1 1 0 1 1 1
(4) 1 0 0 0
(5) 1 0 1 1
(6) 1 1 0 0
(7) 1 1 1 1 AB AC F = AB + AC

© Emil M. Petriu
Simplifying logic functions using Karnaugh maps … more looping

A B C D F Looping a quad of adjacent 1s eliminates


the two variables that appears in
(0) 0 0 0 0 1 both direct and complemented form.
(1) 0 0 0 1 0
(2) 0 0 1 0 1 AB
(3) 0 0 1 1 0 ABD
CD 00 01 11 10
(4) 0 1 0 0 0
(5) 0 1 0 1 1 00 1 0 1 0
(6) 0 1 1 0 0 01 0 1 1 0
(7) 0 1 1 1 1
AB
(8) 1 0 0 0 0 11 0 1 1 0
(9) 1 0 0 1 0 10 1 0 1 0
(10) 1 0 1 0 0 BD
(11) 1 0 1 1 0
(12) 1 1 0 0 1
(13) 1 1 0 1 1
(14) 1 1 1 0 1
F = A B D + AB + BD
(15) 1 1 1 1 1

© Emil M. Petriu
DeMorgan’s
Theorem Equivalent Gate Symbols

A A.B A A+B
A.B =A+ B =
B B

A A+B A A. B
A+ B =A. B =
B B

© Emil M. Petriu
NAND gate implementation of the “sum-of-product” logic functions

NAND gates are faster than ANDs and


F = AB + AC
ORs in most technologies
A B C
X=(X) A B C

F
A F

A A

© Emil M. Petriu
ADDING BINARY NUMBERS
The binary
Adding two bits: 0+ 0+ 1+ 1+ number 10 is
0 1 0 1 equivalent to
__________ __________ __________ __________
the decimal 2
0 1 1 10
Truth table Carry Sum
Inputs Outputs (over)
A B Carry Sum
A
0 0 0 0 Sum
0 1 0 1 B
1 0 0 1
1 1 1 0
Half-Adder
circuit Carry
Sum = A + B

Carry = A . B

© Emil M. Petriu
Adding multi-bit numbers:

108D + 0 1 1 0 1 1 00 + A7 A6 A5 A4 A3 A2 A1 A0 +
90D 0 1 0 1 1 0 10 B7 B6 B5 B4 B3 B2 B1 B0
____________________________________

198D 11 000 110 Sum S7 S6 S5 S4 S3 S2 S1 S0

01 111 000 Carry

Carry In = 0
A7 B7 A6 B6 A5 B5 A4 B4 A3 B3 A2 B2 A1 B1 A0 B0
Carry Out

A B A B A B A B A B A B A B A B
CO CI CO CI CO CI CO CI CO CI CO CI CO CI CO CI
S S S S S S S S

S7 S6 S5 S4 S3 S2 S1 S0

© Emil M. Petriu
Full Adder

Bits of the same Inputs Outputs AB S


rank of the two A B CI CO S CI 00 01 11 10
numbers
0 0 0 0 0 0 0 1 0 1
0 0 1 0 1
Carry Out

A B Carry In 1 1 0 1 0
0 1 0 0 1
CO CI 0 1 1 1 0
1 0 0 0 1 AB CO A .B
S
1 0 1 1 0 CI 00 01 11 10
1 1 0 1 0 0 0
Sum 0 1 0
1 1 1 1 1
1 0 1 1 1

B. CI A . CI
S = A . B . CI + A . B . CI + A . B . CI + A . B . CI

C = A . B + B . CI + A . CI

© Emil M. Petriu
HEX-TO-7 SEGMENT DECODER
This examples illustrates how a practical problem is analyzed in order to generate
truth tables,and then how truth table-defined functions are mapped on Karnaugh maps.

B3 B2 B1 B0 Four-bit
S1 7-segment display to allow
_________________________ “machine” the user see the natural
(0) 0 0 0 0 representation representation of the
of the hex S6 S7 S2
(1) 0 0 0 1 digits
hex digits.
(2) 0 0 1 0
(3) 0 0 1 1 S5 S4 S3
(4) 0 1 0 0
(5) 0 1 0 1
(6) 0 1 1 0 Binary outputs; when
such a signal is = 1 then
(7) 0 1 1 1 the corresponding segment
(8) 1 0 0 0 S7 S6 S5 S4 S3 S2 S1 in the 7-segment display
(9) 1 0 0 1 is on (you see it), when the
7 SEGMENT signal is = 0 then the
(A) 1 0 1 0 segment is off (you can’t
(B) 1 0 1 1 HEX see it).
(C) 1 1 0 0
(D) 1 1 0 1
(E) 1 1 1 0
(F) 1 1 1 1 The four-bit representation
B3 B2 B1 B0 of the hex digits

“Natural” (i.e.as humans write)


representation of the “hex” digits. © Emil M. Petriu
S1 S1 S1 S1 S1
B3 B2 B1 B0
_________________________

(0) 0 0 0 0 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2
(1) 0 0 0 1
(2) 0 0 1 0 S5 S3 S5 S3 S5 S3 S5 S3 S5 S3
S4 S4 S4 S4 S4
(3) 0 0 1 1
(4) 0 1 0 0 S1 S1 S1 S1 S1
(5) 0 1 0 1
(6) 0 1 1 0 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2
(7) 0 1 1 1
(8) 1 0 0 0 S5 S4 S3 S5 S4 S3 S5 S4 S3 S5 S4 S3 S5 S4 S3
(9) 1 0 0 1
(A) 1 0 1 0 S1 S1 S1 S1 S1
(B) 1 0 1 1
(C) 1 1 0 0 S6 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2
S7
(D) 1 1 0 1
(E) 1 1 1 0 S5 S3 S5 S4 S3 S5 S4 S3 S5 S4 S3 S5 S4 S3
(F) 1 1 1 1 S4
S1

We are developing ad-hoc”binary-hex logic” expressions used S6 S2


S7
just for our convenience in the problem analysis process. Each S3 = 0+1+3+4+5+6+7+8+9+A+B+D
expression will enumerate only those hex digits when the
specific display-segment is “on”: S4 = 0+2+3+5+6+8+9+B+C+D+E S5 S3
S4
S5 = 0+2+6+8+A+B+C+D+E+F
S1 = 0+2 +3+5+6+7+8+9+A+C+E+F S6 = 0+4+5+6+8+9+A+B+C+E+F
S2 = 0+1+2+3+4+7+8+9+A+D S7 = 2+3+4+5+6+8+9+A+B+D+E+F
© Emil M. Petriu
Hex-to-7 segment

B3 B2 B1 B0
_________________________ S1 = 0+2 +3+5+6+7+8+9+A+C+E+F
(0) 0 0 0 0
S2 = 0+1+2+3+4+7+8+9+A+D
(1) 0 0 0 1 B3 B2
(2) 0 0 1 0 S3 = 0+1+3+4+5+6+7+8+9+A+B+D
(3) 0 0 1 1 B1 B0 00 01 11 10
S4 = 0+2+3+5+6+8+9+B+C+D+E
(4) 0 1 0 0
(5) 0 1 0 1 S5 = 0+2+6+8+A+B+C+D+E+F 00 0 4 C 8
(6) 0 1 1 0 01 1 5 D 9
S6 = 0+4+5+6+8+9+A+B+C+E+F
(7) 0 1 1 1
(8) 1 0 0 0 S7 = 2+3+4+5+6+8+9+A+B+D+E+F 11 3 7 F B
(9) 1 0 0 1
(A) 1 0 1 0
10 2 6 E A
(B) 1 0 1 1
(C) 1 1 0 0 As we are using ad-hoc “binary-hex logic”
equations, (i.e. binary S… outputs as functions
(D) 1 1 0 1
of hex variables) it will useful in this case to have
(E) 1 1 1 0 hex-labeled Karnaugh map, instead of the usual 2-D
(F) 1 1 1 1 (i.e. two dimensional) binary labeled K maps. This
will allow for a more convenient mapping of the
“binary-hex” logic equations onto the K-maps.

© Emil M. Petriu
Hex-to-7 segment
B3 B2 S1 B3 B2 S2
Mapping the ad-hoc “binary-hex
logic” equations onto Karnaugh maps: B1 B0 00 01 11 10 B1 B0 00 01 11 10
00 1 0 1 1 00 1 1 0 1

01 0 1 0 1 01 1 0 1 1
B3 B2
11 1 1 1 0 11 1 1 0 0
B1 B0 00 01 11 10
10 1 1 1 1 10 1 0 0 1
00 0 4 C 8
01 1 5 D 9
11 3 7 F B B3 B2 S3 B3 B2 S4

10 2 6 E A B1 B0 00 01 11 10 B1 B0 00 01 11 10
00 1 1 0 1 00 1 0 1 1
S1 = 0+2 +3+5+6+7+8+9+A+C+E+F 01 01
1 1 1 1 0 1 1 1
S2 = 0+1+2+3+4+7+8+9+A+D
11 1 1 0 1 11 1 0 0 1
S3 = 0+1+3+4+5+6+7+8+9+A+B+D
10 0 1 0 1 10 1 1 1 0
S4 = 0+2+3+5+6+8+9+B+C+D+E

© Emil M. Petriu
Hex-to-7 segment
B3 B2 S5 B3 B2 S6

B1 B0 00 01 11 10 B1 B0 00 01 11 10
B3 B2 00 1 0 1 1 00 1 1 1 1

B1 B0 00 01 11 10 01 0 0 1 0 01 0 1 0 1
00 0 4 C 8 11 0 0 1 1 11 0 0 1 1
01 1 5 D 9 10 1 1 1 1 10 0 1 1 1

11 3 7 F B
10 2 6 E A
B3 B2 S7

B1 B0 00 01 11 10
00 0 1 0 1
S5 = 0+2+6+8+A+B+C+D+E+F
01 0 1 1 1
S6 = 0+4+5+6+8+9+A+B+C+E+F
11 1 0 1 1
S7 = 2+3+4+5+6+8+9+A+B+D+E+F
10 1 1 1 1

© Emil M. Petriu
SYSTEMS of LOGIC FUNCTIONS 2- bit Comparator

A1 A0 B1 B0 F1 F2 F3
(0) 0 0 0 0 1 0 0
(1) 0 0 0 1 0 0 1 Compare two 2-bit numbers:
(2) 0 0 1 0 0 0 1
(3) 0 0 1 1 0 0 1
(4) 0 1 0 0 0 1 0 A=B F1 = Σ (0,5,10,15)
(5) 0 1 0 1 1 0 0
(6) 0 1 1 0 0 0 1 A>B F2 = Σ (4,8,9,12,13,14)
(7) 0 1 1 1 0 0 1
(8) 1 0 0 0 0 1 0 A<B F3 = Σ (1,2,3,6,7,11)
(9) 1 0 0 1 0 1 0
(10) 1 0 1 0 1 0 0
(11) 1 0 1 1 0 0 1
(12) 1 1 0 0 0 1 0
(13) 1 1 0 1 0 1 0
(14) 1 1 1 0 0 1 0
(15) 1 1 1 1 1 0 0

© Emil M. Petriu
2- bit Comparator

A=B F1 = Σ (0,5,10,15) A1A0


B1B0 00 01 11 10
A1 A0 00 1 0 0 0
B1 B0 00 01 11 10 01 0 1 0 0
00 0 4 12 8 11 0 0 1 0
01 1 5 13 9 10 0 0 0 1
11 3 7 15 11
10 2 6 14 10
F1 = 1 when both numbers, A and B,
are equal which happens when all
their bits of the same order are identical,
i.e. A0 = B0 AND A1 = B1

F1 = (A0⊕B0) • (A1 ⊕ B1)

© Emil M. Petriu
2- bit Comparator

A<B F3 = Σ (1,2,3,6,7,11)
A1A0

A1 A0 B1B0 00 01 11 10
00 0 0 0 0
B1 B0 00 01 11 10
01 1 0 0 0
00 0 4 12 8
11 1 1 0 1
01 1 5 13 9
10 1 1 0 0
11 3 7 15 11
10 2 6 14 10
F3 = A0B1B0 + A1B1 + A1A0B0

© Emil M. Petriu
2- bit Comparator
A1 A0

A>B F2 = Σ (4,8,9,12,13,14) B1 B0 00 01 11 10
00 0 4 12 8
A1A0
01 1 5 13 9
B1B0 00 01 11 10
11 3 7 15 11
00 0 1 1 1
10 2 6 14 10
01 0 0 1 1
11 0 0 0 0
10 0 0 1 0 F2 = F1 + F3

A1A0 F1+F3
A1A0 F1 A1A0 F3
B1B0 00 01 11 10
B1B0 00 01 11 10 B1B0 00 01 11 10
00 1 0 0 0
00 1 0 0 0 00 0 0 0 0
01 1 1 0 0
01 0 1 0 0 01 1 0 0 0
11 1 1 1 1
11 0 0 1 0 11 1 1 0 1
10 1 1 0 1
10 0 0 0 1 10 1 1 0 0
© Emil M. Petriu
2- bit Comparator F1 = (A0⊕B0) • (A1 ⊕ B1)
F2 = F1 + F3
F3 = A0B1B0+A1B1+A1A0B0
B1 B0 A1 A0

A1 ⊕ B1
F1 = (A0⊕B0) • (A1 ⊕ B1)
A0 ⊕ B0

F2 = F1 + F3

F3 = A0B1B0+A1B1+A1A0B0

© Emil M. Petriu
A B C
3-to-8 Decoder

F0

A B C F0 F1 F2 F3 F4 F5 F6 F7
F1
(0) 0 0 0 1 0 0 0 0 0 0 0
(1) 0 0 1 0 1 0 0 0 0 0 0 F2
(2) 0 1 0 0 0 1 0 0 0 0 0
(3) 0 1 1 0 0 0 1 0 0 0 0
(4) 1 0 0 0 0 0 0 1 0 0 0 F3
(5) 1 0 1 0 0 0 0 0 1 0 0
(6) 1 1 0 0 0 0 0 0 0 1 0 F4
(7) 1 1 1 0 0 0 0 0 0 0 1

F5

F6

F7
© Emil M. Petriu
E A B C
3-to-8 Decoder (74 138)

F0
A B C E F0 F1 F2 F3 F4 F5 F6 F7
(x) x x x 1 1 1 1 1 1 1 1 1 F1
(0) 0 0 0 0 0 1 1 1 1 1 1 1
(1) 0 0 1 0 1 0 1 1 1 1 1 1 F2
(2) 0 1 0 0 1 1 0 1 1 1 1 1
(3) 0 1 1 0 1 1 1 0 1 1 1 1
(4) 1 0 0 0 1 1 1 1 0 1 1 1 F3
(5) 1 0 1 0 1 1 1 1 1 0 1 1
(6) 1 1 0 01 1 1 1 1 1 0 1
F4
(7) 1 1 1 01 1 1 1 1 1 1 0

F5

F6

F7
© Emil M. Petriu
BCD-TO-7 SEGMENT DECODER

S1 B3 B2 B1 B0
_________________________
B3 B2
S6 S7 S2 (0) 0 0 0 0
B1 B0 00 01 11 10
(1) 0 0 0 1
S5 S3 (2) 0 0 1 0 00 0 4 x 8
S4
(3) 0 0 1 1
(4) 0 1 0 0 01 1 5 x 9
(5) 0 1 0 1 11 3 7 x x
(6) 0 1 1 0
(7) 0 1 1 1 10 2 6 x x
S7 S6 S5 S4 S3 S2 S1 (8) 1 0 0 0
7 SEGMENT (9) 1 0 0 1
(x) 1 0 1 0 “Don’t Care” states/situations.
BCD (x) 1 0 1 1 As it is expected that these
(x) 1 1 0 0 states are never going to occur,
(x) 1 1 0 1 then we may just as well use
(x) 1 1 1 0 them as fill-in “1s” in a
B3 B2 B1 B0 (x) 1 1 1 1 Karnaugh map if this helps to
make larger loopings

© Emil M. Petriu
BCD-to-7 segment

S1 S1 S1 S1 S1

S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2
B3 B2 B1 B0
_________________________

(0) 0 0 0 0 S5 S3 S5 S3 S5 S3 S5 S3 S5 S3
S4 S4 S4 S4 S4
(1) 0 0 0 1
(2) 0 0 1 0
(3) 0 0 1 1 S1 S1 S1 S1 S1
(4) 0 1 0 0
(5) 0 1 0 1 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2 S6 S7 S2
(6) 0 1 1 0
(7) 0 1 1 1 S5 S4 S3 S5 S4 S3 S5 S4 S3 S5 S4 S3 S5 S4 S3
(8) 1 0 0 0
(9) 1 0 0 1
(x) 1 0 1 0
(x) 1 0 1 1
(x) 1 1 0 0 S4 = 0+2+3+5+6+8+9
(x) 1 1 0 1 S1 = 0+2 +3+5+6+7+8+9 S5 = 0+2+6+8
(x) 1 1 1 0
S2 = 0+1+2+3+4+7+8+9 S6 = 0+4+5+6+8+9
(x) 1 1 1 1
S3 = 0+1+3+4+5+6+7+8+9 S7 = 2+3+4+5+6+8+9
© Emil M. Petriu
B3 B2
BCD-to-7 segment
B1 B0 00 01 11 10
00 0 4 x 8
S1 = 0+2 +3+5 01 1 5 x 9
+6+7+8+9
11 3 7 x x
10 2 6 x x S2 = 0+1+2+3
B3 B2 S1 +4+7+8+9
B1 B0 00 01 11 10
00 1 0 x 1 B3 B2 S2
B1 B0 00 01 11 10
01 0 1 x 1
00 1 1 x 1
11 1 1 x x
1 1 x x
01 1 0 x 1
10
11 1 1 x x
10 1 0 x x
S1 = B3 + B2B0 + B1

S2 = B3 + B2 + B1B0 + B1B0
+ B2B1 + B2B0

© Emil M. Petriu
BCD-to-7 segment
B3 B2

B1 B0 00 01 11 10
00 0 4 x 8
01 1 5 x 9
11 3 7 x x
S3 = 0+1+3+4+5+6+7+8+9 S4 = 0+2+3+5+6+8+9
10 2 6 x x
B3 B2 S3 B3 B2 S4
B1 B0 00 01 11 10 B1 B0 00 01 11 10
00 1 1 x 1 00 1 0 x 1
01 1 1 x 1 01 0 1 x 1
11 1 1 x x
11 1 0 x x
10 0 1 x x
10 1 1 x x

S3 = B3 + B1B0 + B1 + B2 S4 = B3 + B2B0 + B2B1 + B2B1B0 + B1B0

© Emil M. Petriu
B3 B2
BCD-to-7 segment
B1 B0 00 01 11 10
00 0 4 x 8 S7 = 2+3+4+5+6+8+9
01 1 5 x 9
B3 B2 S7
11 3 7 x x
B1 B0 00 01 11 10
10 2 6 x x
00 0 1 x 1
01 0 1 x 1
S5 = 0+2+6+8 S6 = 0+4+5+6+8+9
11 1 0 x x
B3 B2 S5 B3 B2 S6 10 1 1 x x

B1 B0 00 01 11 10 B1 B0 00 01 11 10
00 1 0 x 1 00 1 1 x 1 S7 = B3 + B2B1
01 0 0 x 0 01 0 1 x 1
+ B1B2 + B1B0
11 0 0 x x 11 0 0 x x
10 1 1 x x 10 0 1 x x

S5 = B2B0 + B1B0 S6 = B3 + B1B0 + B1B2 + B2B0


© Emil M. Petriu
I1 I2 F
MEMORY ELEMENTS: I1 F 0 0 1
LATCHES AND FLIP-FLOPS I2 0 1 1
1 0 1
1 1 0
R-S Latch S =0
(Reset-Set) Q =1
S =0 Q =1
S
Q

R= 0 Q =1
Q R= 1 Q =0
R
S =1 Q =0
S R Q Q S =1 Q =1

0 0 1 1 Weird state
0 1 1 0 Set state
1 0 0 1 Reset state
1 1 Q Q Hold state Q =1
R= 0 Q =0
R= 1
© Emil M. Petriu
D (Transparent) Latch

S
D
Q
Enable D Q Q
0 x Q Q
Q 1 0 0 1
R 1 1 1 0
Enable

Enable D S R Q Q S R Q Q When the Enable input


is =1 (i.e. TRUE or HIGH)
0 0 1 1 Q Q
0 0 1 1 the information present at
0 1 1 1 Q Q 0 1 1 0 the D input is stored in the
1 0 0 1 latch and will “appear as it is”
1 0 1 0 0 1 at the Q output ( => it is like
1 1 Q Q
1 1 0 1 1 0 that there is a “transparent”
path from the D input to the
Q output)

© Emil M. Petriu
D Latch
S
D Enable D S R Q Q
Q
0 0 1 1 Q Q
0 1 1 1 Q Q
Q 1 0 1 0 0 1
R 1 1 0 1 1 0
Enable

1
Enable
0
1
D 0
1
S 0
1
R 0
Hold 1
Q 0

“Hold”state “Transparent” state “Hold”state

© Emil M. Petriu
Latch 1 Latch 2
Synchronous D Flip-Flop
D1
D D Q D Q Q
Positive-Edge
D Q
-Triggered
Enab. Q Enab. Q Q D Flip-Flop
CLK
Q
CLK
EN1 EN2
1
D Din* Input data D may change
0
1
CLK 0
1
EN1 Latch 1 is Latch 1 is Holding Latch 1 is Transparent
Transparent 0
1
D1 D1 = Din* Changed input data D enter Latch 1
0
1
EN2 Latch 2 is Holding Latch 2 is Transparent Latch 2 is Holding
0
1
Q Q = D1 = Din* 0
The state of the flip-flop’s output Q copies input Positive-Edge-Triggered
D when the positive edge of the clock CLK occurs D Flip-Flop
© Emil M. Petriu
Synchronous D Flip-Flop

Vcc CLR2 D2 CLK2 PR2 Q2 Q2


14 13 12 11 10 9 8

Connection diagram
of the 7474 Dual
Positive-Edge-Triggered
D Flip-Flops with Preset
and Clear.
1 2 3 4 5 6 7

CLR1 D1 CLK1 PR1 Q1 Q1 GND


COUNTERS
4-Bit Synchronous Counter using D Flip-Flops

Q3 Q2 Q1 Q0
0 1 2 3 4 5

CL
4-Bit BINARY COUNTER 15 6

14 7
CK CL

3 13 12 11 10 9 8
Q = Σ Qi 2i .
i=0

1
CK
0
1
CL 0

Q 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6

© Emil M. Petriu
Synchronous 4-bit Counter
DECIMAL BINARY STATE OF FLIP FLOP INPUTS
STATE THE COUNTER (for the next state)

Q Q3 Q2 Q1 Q0 D3 D2 D1 D0 Using D flip-flops has the distinct advantage


of a straightforward definition of the flip-flop
0 0 0 0 0 0 0 0 1
inputs: the current state of these inputs is
1 0 0 0 1 0 0 1 0
2 0 0 1 0 0 0 1 1 the next state of the counter. The logic
3 0 0 1 1 0 1 0 0 equations for all four flip-flop inputs D3, D2,
4 0 1 0 0 0 1 0 1 D1, and D0 are
5 0 1 0 1 0 1 1 0 derived from this
6 0 1 1 0 0 1 1 1 truth table as
7 0 1 1 1 1 0 0 0 Q3 Q2
functions of the
8 1 0 0 0 1 0 0 1 Q1 Q0 00 01 11 10
9 1 0 0 1 1 0 1 0 current states of the
10 1 0 1 0 1 0 1 1 00 0 4 12 8 counter’s flip-flops:
11 1 0 1 1 1 1 0 0 Q3, Q2, Q1, and Q0.
01 1 5 13 9
12 1 1 0 0 1 1 0 1 Karnaugh maps can
13 1 1 0 1 1 1 1 0 11 3 7 15 11 be used to simplify
14 1 1 1 0 1 1 1 1
10 2 6 14 10 these equations.
15 1 1 1 1 0 0 0 0
0 0 0 0 0

Q3 Q2 D3 Q3 Q2 D2 Q3 Q2 D1 Q3 Q2 D0
Q1 Q0 00 01 11 10 Q1 Q0 00 01 11 10 Q1 Q0 00 01 11 10 Q1 Q0 00 01 11 10

00 0 0 1 1 00 0 1 1 0 00 0 0 0 0 00 1 1 1 1

01 0 0 1 1 01 0 1 1 0 01 1 1 1 1 01 0 0 0 0
11 0 1 0 1 11 1 0 0 1 11 0 0 0 0 11 0 0 0 0
10 0 0 1 1 10 0 1 1 0 10 1 1 1 1 10 1 1 1 1

© Emil M. Petriu
Synchronous 4-bit Counter

Q3 Q2 D3 Q3 Q2 D2
Q1 Q0 00 01 11 10 Q1 Q0 00 01 11 10

00 0 0 1 1 00 0 1 1 0
01 0 0 1 1 01 0 1 1 0
11 0 1 0 1 11 1 0 0 1
10 0 0 1 1 10 0 1 1 0

D3 = Q3. Q2 + Q3. Q1 + Q3.Q0 + Q3.Q2.Q1.Q0 D2 = Q2. Q0 + Q2. Q1 + Q2. Q1. Q0

Q3 Q2 D1
Q3 Q2 D0
Q1 Q0 00 01 11 10
Q1 Q0 00 01 11 10
00 0 0 0 0 D1 = Q1. Q0 + Q1. Q0 D0 = Q0
00 1 1 1 1
01 1 1 1 1
01 0 0 0 0
11 0 0 0 0 11 0 0 0 0
10 1 1 1 1
10 1 1 1 1

© Emil M. Petriu
Synchronous 4-bit Counter CL CK
Q0
D Q

CLK Q0
Q
R

D0 = Q0
Q1
D Q
D1 = Q1. Q0 + Q1. Q0
CLK Q1
D2 = Q2. Q0 + Q2. Q1 + Q2. Q1. Q0 Q
R

D3 = Q3. Q2 + Q3. Q1 + Q3.Q0


Q2
+ Q3.Q2.Q1.Q0 D Q

CLK Q2
Q
R

Q3
D Q

CLK Q3
Q
R

© Emil M. Petriu

You might also like