Lecture 5
description
Transcript of Lecture 5
![Page 1: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/1.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1
ECE2072/TRC2300 Digital Systems: Combinational logic
based on textbook
Contemporary Logic Design, 2nd Editionby R. H. Katz and G. Borriello
COMMONWEALTH OF AUSTRALIACopyright Regulations 1969
WARNING
This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act).
The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act.
Do not remove this notice.
![Page 2: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/2.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 2
Combinational logic
Basic logicBoolean algebra, proofs by re-writing, proofs by perfect inductionlogic functions, truth tables, and switchesNOT, AND, OR, NAND, NOR, XOR, . . ., minimal set
Logic realizationtwo-level logic and canonical formsincompletely specified functions
Simplificationuniting theoremgrouping of terms in Boolean functions
Alternate representations of Boolean functionscubesKarnaugh maps
![Page 3: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/3.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 3
inputs outputssystem
Combinational digital circuits (Sec 2.1 Katz 2e)
A simple model of a digital system is a unit with inputs and outputs:
Combinational means "memory-less"a digital circuit is combinational if its output valuesonly depend on its input values
![Page 4: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/4.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 4
X Y 16 possible functions (F0–F15)0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 10 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 11 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 11 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
0X and Y
X Y
X or Y
not Y not X 1
XY F
X xor Y
X nor Ynot (X or Y)
X = Y X nand Ynot (X and Y)
Possible logic functions of two variables
There are 16 possible functions of 2 input variables:in general, there are 2**(2**n) functions of n inputs
![Page 5: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/5.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 5
easy to implementwith CMOS transistors(the switches we haveavailable and use most)
Combinational logic symbols
Common combinational logic systems have standard symbols called logic gates
Buffer, NOT
AND, NAND
OR, NOR
Z
AB
Z
Z
A
AB
![Page 6: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/6.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 6
X Y X nand Y0 0 11 1 0
X Y X nor Y0 0 11 1 0
We can implement any logic function using only AND, OR and NOT operationsSimilarly, we implement all logic functions from NAND, NOR, and NOT operations
For example, implementing X and Yis the same as implementing not (X nand Y)
In fact, we can do it with only NOR or only NAND gatesNOT is just a NAND or a NOR with both inputs tied together
NAND and NOR are “dual” operationseg. X nand
Minimal set of functions
Y ≡ not ((not X) nor (not Y))
NOT, NOR, and NAND are the cheapest gates to physically implement (fewest transistors), and are therefore the functions we use the most in practice
![Page 7: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/7.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 7
Laws & Theorems of Boolean Logic (2.2 Katz 2e)Boolean algebra consists of
a set of elements: B = {0, 1}
binary operations: {+ , • }+ is logical OR ie. A OR B ≡ A+B• is logical AND ie. A AND B ≡ AB
and a unary operation { ’ }:’ is logical NOT eg. NOT A ≡ A’ ≡ A
such that the following axioms hold:
1. the set B contains at least two elements: a, b2. closure: a + b is in B a • b is in B3. commutativity: a + b = b + a a • b = b • a4. associativity: a + (b + c) = (a + b) + c a • (b • c) = (a • b) • c5. identity: a + 0 = a a • 1 = a6. distributivity: a + (b • c) = (a + b) • (a + c) a • (b + c) = (a • b) + (a • c)7. complementarity: a + a’ = 1 a • a’ = 0
![Page 8: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/8.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 8
X, Y are Boolean algebra variables
X Y X • Y0 0 00 1 01 0 01 1 1
X Y X’ Y’ X • Y X’ • Y’ ( X • Y ) + ( X’ • Y’ )0 0 1 1 0 1 10 1 1 0 0 0 01 0 0 1 0 0 01 1 0 0 1 0 1
( X • Y ) + ( X’ • Y’ ) ≡ X = Y
X Y X’ X’ • Y0 0 1 00 1 1 11 0 0 01 1 0 0
Boolean expression that is true when the variables X and Y have the same valueand false, otherwise
Logic functions and Boolean algebra
Any logic function that can be expressed as a truth table can be written as an expression in Boolean algebra using the operators: ’, +, and •
![Page 9: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/9.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 9
Axioms and theorems of Boolean algebra:Duality
A dual of a Boolean expression is derived by replacing • by +, + by •, 0 by 1, and 1 by 0, and leaving variables unchanged.Any theorem that can be proven is thus also proven for its dual (the dual theory of duality is itself)!duality:
X + Y + ... + 0 ⇔ X • Y • ... • 1generalized duality:
f (X1,X2,...,Xn,0,1,+,•) ⇔ f(X1,X2,...,Xn,1,0,•,+)
An expression and it’s dual are not equal:Duality is a statement about theorems (a meta-theorem)this is not a way to manipulate (re-write) expressions
![Page 10: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/10.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 10
Axioms and theorems of Boolean algebra
identity1. X + 0 = X 1D. X • 1 = X
null2. X + 1 = 1 2D. X • 0 = 0
idempotency:3. X + X = X 3D. X • X = X
involution:4. (X’)’ = X
complementarity:5. X + X’ = 1 5D. X • X’ = 0
commutativity:6. X + Y = Y + X 6D. X • Y = Y • X
associativity:7. (X + Y) + Z = X + (Y + Z) 7D. (X • Y) • Z = X • (Y • Z)
![Page 11: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/11.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 11
Axioms and theorems of Boolean algebra (cont’d)
distributivity:8. X • (Y + Z) = (X • Y) + (X • Z) 8D. X + (Y • Z) = (X + Y) • (X + Z)
uniting:9. X • Y + X • Y’ = X 9D. (X + Y) • (X + Y’) = X
absorption:10. X + X • Y = X 10D. X • (X + Y) = X11. (X + Y’) • Y = X • Y 11D. (X • Y’) + Y = X + Y
factoring:12. (X + Y) • (X’ + Z) = 12D. X • Y + X’ • Z =
X • Z + X’ • Y (X + Z) • (X’ + Y)consensus:
13. (X • Y) + (Y • Z) + (X’ • Z) = 13D. (X + Y) • (Y + Z) • (X’ + Z) =X • Y + X’ • Z (X + Y) • (X’ + Z)
![Page 12: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/12.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 12
Axioms and theorems of Boolean algebra:De Morgan’s Law
De Morgan’s law establishes relationship between • and +X + Y = X • Y
The above expression also has a dualX • Y = X + Y
generalized de Morgan’s:f’(X1,X2,...,Xn,0,1,+,•) = f(X1’,X2’,...,Xn’,1,0,•,+)
De Morgan’s law can be used to find the compliment of a function:
eg. find the compliment of: Z = A B + C DZ = A B + C D
= ( A B ) ( C D )= ( A + B ) ( C + D )
![Page 13: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/13.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 13
(X + Y)’ = X’ • Y’NOR is equivalent to AND
with inputs complemented (see slide 6)
(X • Y)’ = X’ + Y’NAND is equivalent to OR
with inputs complemented (see slide 6)
X Y X’ Y’ (X + Y)’ X’ • Y’0 0 1 10 1 1 01 0 0 11 1 0 0
X Y X’ Y’ (X • Y)’ X’ + Y’0 0 1 10 1 1 01 0 0 11 1 0 0
1110
1110
Proving theorems (perfect induction)
Using perfect induction (complete truth table):e.g., prove de Morgan’s law:
1000
1000
![Page 14: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/14.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 14
Proving theorems (rewriting)
Using the axioms of Boolean algebra:e.g., prove uniting: X • Y + X • Y’ = X
e.g., prove absorption: X + X • Y = X
distributivity (8) X • Y + X • Y’ = X • (Y + Y’)complementarity (5) X • (Y + Y’) = X • (1)identity (1D) X • (1) = X
identity (1D) X + X • Y = X • 1 + X • Ydistributivity (8) X • 1 + X • Y = X • (1 + Y)identity (2) X • (1 + Y) = X • (1)identity (1D) X • (1) = X
![Page 15: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/15.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 15
Activity
Prove the following using the laws of Boolean algebra:(X • Y) + (Y • Z) + (X’ • Z) = X • Y + X’ • Z
(X • Y) + (Y • Z) + (X’ • Z)
identity (X • Y) + (1) • (Y • Z) + (X’ • Z)
complementarity (X • Y) + (X’ + X) • (Y • Z) + (X’ • Z)
distributivity (X • Y) + (X’ • Y • Z) + (X • Y • Z) + (X’ • Z)
commutativity (X • Y) + (X • Y • Z) + (X’ • Y • Z) + (X’ • Z)
factoring (X • Y) • (1 + Z) + (X’ • Z) • (1 + Y)
null (X • Y) • (1) + (X’ • Z) • (1)
identity (X • Y) + (X’ • Z)
![Page 16: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/16.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 16
X Y Z0 0 00 1 01 0 01 1 1
X Y0 11 0
X Y Z0 0 00 1 11 0 11 1 1
X Y
XY
Z
XY
Z
Realising Boolean Formulas: From Boolean expressions to logic gates (Sec 2.3 Katz Ed2))
NOT X’ X ~X
AND X • Y XY X ∧ Y
OR X + Y X ∨ Y
![Page 17: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/17.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 17
XY Z
X Y Z0 0 10 1 11 0 11 1 0
X Y Z0 0 10 1 01 0 01 1 0
ZX
Y
XY
Z
X Y Z0 0 10 1 01 0 01 1 1
X Y Z0 0 00 1 11 0 11 1 0
ZXY
X xor Y = X Y’ + X’ YX or Y but not both
("inequality", "difference")
X xnor Y = X Y + X’ Y’X and Y are the same
("equality", "coincidence")
From Boolean expressions to logic gates (cont’d)
NAND
NOR
XORX ⊕ Y
XNORX = Y
![Page 18: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/18.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 18
Z = A’ • B’ • (C + D) = (A’ • (B’ • (C + D)))
Note: there is usually more than one way to map expressions to gates!
T1T2
use of 3-input gate
A
B
CD T2
T1
Z A
B
CD
Z
From Boolean expressions to logic gates (cont’d)
![Page 19: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/19.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 19
time
change in Y takes time to "propagate" through gates
Just a sideways truth tablebut note how edges don’t line up exactlyit takes time for a gate to switch its output!
Waveform view of logic functions
![Page 20: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/20.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 20
Implementing Boolean functions (Sec 2.4 Katz Ed2)
Technology independentcanonical formstwo-level formsmulti-level forms
Technology choicespackages of a few gatesregular logictwo-level programmable logicmulti-level programmable logic
![Page 21: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/21.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 21
Canonical forms
Truth table is the unique signature of a Boolean functionThe same truth table can have many gate realizationsCanonical forms
are unique for any function (deterministic)standard forms for a Boolean expression
Two canonical forms:Sum-of-ProductsProduct-of-Sums
![Page 22: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/22.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 22
A B C F F’0 0 0 0 10 0 1 1 00 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 0
F =
F’ = A’B’C’ + A’BC’ + AB’C’
F = 001 011 101 110 111
+ A’BC
Sum-of-products canonical forms
Also known as disjunctive normal formAlso known as minterm expansion
+ AB’C + ABC’ + ABCA’B’C
![Page 23: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/23.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 23
short-hand notation forminterms of 3 variables
A B C minterms0 0 0 A’B’C’ m00 0 1 A’B’C m10 1 0 A’BC’ m20 1 1 A’BC m31 0 0 AB’C’ m41 0 1 AB’C m51 1 0 ABC’ m61 1 1 ABC m7
F in canonical form:F(A, B, C) = Σm(1,3,5,6,7)
= m1 + m3 + m5 + m6 + m7= A’B’C + A’BC + AB’C + ABC’ + ABC
canonical form ≠ minimal formF(A, B, C) = A’B’C + A’BC + AB’C + ABC + ABC’
= (A’B’ + A’B + AB’ + AB)C + ABC’= ((A’ + A)(B’ + B))C + ABC’= C + ABC’= ABC’ + C= AB + C
Sum-of-products canonical form (cont’d)
Product term (or minterm)ANDed product of literals – input combination for which output is trueeach variable appears exactly once, true or inverted (but not both)
![Page 24: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/24.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 24
A B C F F’0 0 0 0 10 0 1 1 00 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 0
F = 000 010 100F = (A + B + C)
F’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)
Product-of-sums canonical form
Also known as conjunctive normal formAlso known as maxterm expansion
(A + B’ + C) (A’ + B + C)
![Page 25: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/25.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 25
A B C maxterms0 0 0 A+B+C M00 0 1 A+B+C’ M10 1 0 A+B’+C M20 1 1 A+B’+C’ M31 0 0 A’+B+C M41 0 1 A’+B+C’ M51 1 0 A’+B’+C M61 1 1 A’+B’+C’ M7
short-hand notation formaxterms of 3 variables
F in canonical form:F(A, B, C) = ΠM(0,2,4)
= M0 • M2 • M4= (A + B + C) (A + B’ + C) (A’ + B + C)
canonical form ≠ minimal formF(A, B, C) = (A + B + C) (A + B’ + C) (A’ + B + C)
= (A + B + C) (A + B’ + C)(A + B + C) (A’ + B + C)
= (A + C) (B + C)
Product-of-sums canonical form (cont’d)
Sum term (or maxterm)ORed sum of literals – input combination for which output is falseeach variable appears exactly once, true or inverted (but not both)
![Page 26: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/26.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 26
Mapping between canonical forms:S-o-P, P-o-S, and de Morgan’s theorem
Sum-of-productsF’ = A’B’C’ + A’BC’ + AB’C’
Apply de Morgan’s(F’)’ = (A’B’C’ + A’BC’ + AB’C’)’F = (A + B + C) (A + B’ + C) (A’ + B + C)
Product-of-sumsF’ = (A + B + C’) (A + B’ + C’) (A’ + B + C’) (A’ + B’ + C) (A’ + B’ + C’)
Apply de Morgan’s(F’)’ = ( (A + B + C’)(A + B’ + C’)(A’ + B + C’)(A’ + B’ + C)(A’ + B’ + C’) )’F = A’B’C + A’BC + AB’C + ABC’ + ABC
![Page 27: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/27.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 27
canonical sum-of-products
minimized sum-of-products
canonical product-of-sums
minimized product-of-sums
F1
F2
F3
B
A
C
F4
Four alternative two-level implementationsof F = AB + C
![Page 28: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/28.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 28
Waveforms for the four alternatives
Waveforms are essentially identicalexcept for timing hazards (glitches)delays almost identical (modeled as a delay per level, not type of gate or number of inputs to gate)
![Page 29: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/29.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 29
A B C D W X Y Z0 0 0 0 0 0 0 10 0 0 1 0 0 1 00 0 1 0 0 0 1 10 0 1 1 0 1 0 00 1 0 0 0 1 0 10 1 0 1 0 1 1 00 1 1 0 0 1 1 10 1 1 1 1 0 0 01 0 0 0 1 0 0 11 0 0 1 0 0 0 01 0 1 0 X X X X1 0 1 1 X X X X1 1 0 0 X X X X1 1 0 1 X X X X1 1 1 0 X X X X1 1 1 1 X X X X
off-set of W
these inputs patterns should never be encountered in practice – "don’t care" about associated output values, can be exploitedin minimization
Incompletely specified functions
Example: binary coded decimal increment by 1BCD digits encode the decimal digits 0 – 9 in the bit patterns 0000 – 1001
don’t care (DC) set of W
on-set of W
![Page 30: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/30.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 30
Notation for incompletely specified functions
Don’t cares and canonical formsso far, only represented on-setalso represent don’t-care-setneed two of the three sets (on-set, off-set, dc-set)
Canonical representations of the BCD increment by 1 function:
Z = m0 + m2 + m4 + m6 + m8 + d10 + d11 + d12 + d13 + d14 + d15Z = Σ [ m(0,2,4,6,8) + d(10,11,12,13,14,15) ]
Z = M1 • M3 • M5 • M7 • M9 • D10 • D11 • D12 • D13 • D14 • D15Z = Π [ M(1,3,5,7,9) • D(10,11,12,13,14,15) ]
![Page 31: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/31.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 31
A B F
0 0 1
0 1 0
1 0 1
1 1 0
B has the same value in both on-set rows– B remains
A has a different value in the two rows– A is eliminated
F = A’B’+AB’ = (A’+A)B’ = B’
The uniting theorem
Key tool to simplification: A B’ + A B = A (B’ + B) = A·1 = AEssence of simplification of two-level logic
find two element subsets of the ON-set where only one variable changes its value – this single varying variable can be eliminated and a single product term used to represent both elements
![Page 32: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/32.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 32
A B F
0 0 1
0 1 0
1 0 1
1 1 0
Karnaugh maps
Alternative to truth-tables to help visualize adjacenciesguide to applying the uniting theoremon-set elements with only one variable changing value are adjacent unlike the situation in a linear truth-table
0 2
1 3
0 1A
B0
1
1
0 0
1
1 1
0 0B
A
![Page 33: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/33.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 33
Karnaugh maps (cont’d)
Numbering scheme based on Gray–codee.g., 00, 01, 11, 10only a single bit changes in code for adjacent map cells
0 2
1 3
00 01AB
C0
16 4
7 5
11 10
C
B
A
0 2
1 3
6 4
7 5C
B
A
0 4
1 5
12 8
13 9 D
A
3 7
2 6
15 11
14 10C
B 13 = 1101= ABC’D
![Page 34: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/34.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 34
Adjacencies in Karnaugh maps
Wrap from first to last columnWrap top row to bottom row
000 010
001 011
110 100
111 101C
B
A
![Page 35: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/35.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 35
A simple example: 1-bit binary adder
Inputs: A, B, Carry-inOutputs: Sum, Carry-out
AB
CinCout
SA B Cin Cout S0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1
01101001
00010111
Cout = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin
S = A’ B’ Cin + A’ B Cin’ + A B’ Cin’ + A B Cin
A A A A AB B B B B
S S S S S
CinCout
![Page 36: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/36.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 36
Apply the theorems to simplify expressions
The theorems of Boolean algebra can simplify Boolean expressions
e.g., full adder’s carry-out function (same rules apply to any function)
There must be an easier way!
Cout = A’ B Cin + A B’ Cin + A B Cin’ + A B Cin= A’ B Cin + A B’ Cin + A B Cin’ + A B Cin + A B Cin= A’ B Cin + A B Cin + A B’ Cin + A B Cin’ + A B Cin= (A’ + A) B Cin + A B’ Cin + A B Cin’ + A B Cin= (1) B Cin + A B’ Cin + A B Cin’ + A B Cin= B Cin + A B’ Cin + A B Cin’ + A B Cin + A B Cin= B Cin + A B’ Cin + A B Cin + A B Cin’ + A B Cin= B Cin + A (B’ + B) Cin + A B Cin’ + A B Cin= B Cin + A (1) Cin + A B Cin’ + A B Cin= B Cin + A Cin + A B (Cin’ + Cin)= B Cin + A Cin + A B (1)= B Cin + A Cin + A B
![Page 37: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/37.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 37
obtain thecomplementof the function by covering 0swith subcubes
F =
Cout =
f(A,B,C) = Σm(0,4,5,7)
Karnaugh map examples
0 0
0 1
1 0
1 1Cin
B
A
1 1
0 0B
A
1 0
0 0
0 1
1 1C
B
A
B’
AB
AC
+ ACin + BCin
+ B’C’ + AB’
![Page 38: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/38.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 38
F(A,B,C) = Σm(0,4,5,7)
F'(A,B,C) = Σ m(1,2,3,6)F' simply replace 1's with 0's and vice versa
G(A,B,C) = 0 0
0 0
1 1
1 1
More Karnaugh map examples
C
B
A
1 0
0 0
0 1
1 1C
B
A
0 1
1 1
1 0
0 0C
B
A
A
= AC + B’C’
= BC’ + A’C
![Page 39: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/39.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 39
C + B’D’
Karnaugh map: 4-variable example
F(A,B,C,D) = Σm(0,2,3,5,6,7,8,10,11,14,15)
F =
D
A
B
1 0
0 1
0 1
0 0
1 1
1 1
1 1
1 1C
+ A’BD
![Page 40: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/40.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 40
+ B’C’D
Karnaugh maps: don’t cares
f(A,B,C,D) = Σ m(1,3,5,7,9) + d(6,12,13)without don't cares
f =
0 0
1 1
X 0
X 1D
A
1 1
0 X
0 0
0 0
B
C
A’D
![Page 41: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/41.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 41
Karnaugh maps: don’t cares (cont’d)
f(A,B,C,D) = Σ m(1,3,5,7,9) + d(6,12,13)f = A'D + B'C'D without don't caresf = with don't cares
don't cares can be treated as1s or 0s
depending on which is more advantageous
0 0
1 1
X 0
X 1D
A
1 1
0 X
0 0
0 0
B
C
A'D
by using don't care as a "1"a 2-cube can be formed rather than a 1-cube to coverthis node
+ C'D
![Page 42: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/42.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 42
Activity
Minimize the function F = Σ m(0, 2, 7, 8, 14, 15) + d(3, 6, 9, 12, 13)
1 0
0 0
X 1
X X
X 1
1 X
1 0
1 0
D
A
B
C
F = AC’ +A’C +BC +AB +A’B’D’ +B’C’D’
1 0
0 0
X 1
X X
X 1
1 X
1 0
1 0
D
A
B
C
1 0
0 0
X 1
X X
X 1
1 X
1 0
1 0
D
A
B
C
F = BC + A’B’D’ + B’C’D’
F = A’C + AB + B’C’D’
![Page 43: Lecture 5](https://reader037.fdocuments.net/reader037/viewer/2022110318/563db8bd550346aa9a967e67/html5/thumbnails/43.jpg)
II - Combinational Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 43
Combinational logic summary
Logic functions, truth tables, and switchesNOT, AND, OR, NAND, NOR, XOR, . . ., minimal set
Axioms and theorems of Boolean algebraproofs by re-writing and perfect induction
Gate logicnetworks of Boolean functions and their time behavior
Canonical formstwo-level and incompletely specified functions
Simplificationa start at understanding two-level simplification
Laterautomation of simplificationmulti-level logictime behaviorhardware description languagesdesign case studies