3 Combinational Logic II Afterlecture
3 Combinational Logic II Afterlecture
ETH Zürich
Spring 2023
2 March 2023
Extra Credit Assignment: Talk Analysis
n Intelligent Architectures for Intelligent Machines
n Watch and analyze this short lecture (33 minutes)
q https://www.youtube.com/watch?v=WxHribseelw (Oct 2022)
n Next week
q Hardware Description Languages and Verilog
n H&H Chapter 4 until 4.3 and 4.5
3
What Will We Learn Today?
n Basic building blocks of modern computers
q Transistors
q Logic gates
n Boolean algebra
5
General Purpose vs. Special Purpose Systems
General Purpose Special Purpose
CPUs GPUs FPGAs ASICs
7
Transistors
8
Recall: Two Types of MOS Transistors
n There are two types of MOS transistors: n-type and p-type
n-type p-type
3
0 Volt
Gate
Power Supply
Shorthand notation
11
NOT
Recall: CMOS NOT, NAND, AND Gates
A Y
A A
A Y Y Y
Y=A B B
A Y A B Y A B Y
0 1 0 0 1 0 0 0
1 0 0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 1
3V
3V 3V 3V
P1 P2 P1 P2 P3
P Out (Y)
Out (Y)
In (A) Out (Y) In (A) N1 In (A) N1 N3
N
In (B) N2 In (B) N2
0V
0V 0V 0V
12
General CMOS Gate Structure
n The general form used to construct any inverting logic gate,
such as: NOT, NAND, or NOR
q The networks may consist of
transistors in series or in pMOS
parallel pull-up
network
q When transistors are in
parallel, the network is ON if inputs
one of the transistors is ON output
q When transistors are in series,
the network is ON only if all nMOS
pull-down
transistors are ON network
13
General CMOS Gate Structure (II)
n Exactly one network should be ON, and the other network
should be OFF at any given time
14
Digging Deeper: Why This Structure?
n MOS transistors are imperfect switches
n pMOS transistors pass 1’s well but 0’s poorly (holes carry
charge)
n nMOS transistors pass 0’s well but 1’s poorly (electrons carry
charge)
16
Digging Deeper: Power Consumption
n Dynamic Power Consumption
q Power used to charge capacitance as signals change (0 ßà 1)
q C * V2 * f
n C = capacitance of the circuit (wires and gates)
n V = supply voltage
n f = charging frequency of the capacitor
n Energy Consumption
q Power * Time
See more in H&H Chapter 1.8 17
Common Logic Gates
18
Larger Gates
n We can extend the gates to more than 2 inputs
19
Aside: Moore’s Law:
Enabler of Many Gates on a Chip
20
An Enabler: Moore’s Law
n Only 3 pages
n A quote:
“With unit cost falling as the number of components per
circuit rises, by 1975 economics may dictate squeezing as
many as 65 000 components on a single silicon chip.”
n Another quote:
“Will it be possible to remove the heat generated by tens of
thousands of components in a single silicon chip?”
25
How Do We Keep Moore’s Law: Innovation
n Manufacturing smaller transistors/structures
q Some structures are already a few atoms in size
https://www.youtube.com/watch?v=Z7M8etXUEUU 27
A 5-Minute Video on Transistor Innovation
https://www.youtube.com/watch?v=Z7M8etXUEUU 28
Enabling Manufacturing Tech: EUV
https://www.youtube.com/watch?v=Jv40Viz-KTc 29
Enabling Manufacturing Tech: EUV
https://en.wikipedia.org/wiki/Extreme_ultraviolet_lithography
30
Innovation At the Bottom Enables Computing
Problem
Algorithm
Program/Language
Runtime System
(VM, OS, MM)
ISA (Architecture)
Microarchitecture
Logic
Devices
Electrons
31
Historical: Opportunities at the Bottom
https://en.wikipedia.org/wiki/There%27s_Plenty_of_Room_at_the_Bottom 32
Historical: Opportunities at the Bottom (II)
https://en.wikipedia.org/wiki/There%27s_Plenty_of_Room_at_the_Bottom 33
Extra Assignment: Moore’s Law (I)
n Paper review
n G.E. Moore. "Cramming more components onto integrated
circuits," Electronics magazine, 1965
34
Extra Assignment 2: Moore’s Law (II)
n Guidelines on how to review papers critically
36
We Can Now Build Logic Circuits
Now, we understand the workings of the basic logic gates
n Combinational Logic
q Memoryless
q Outputs are strictly dependent on the combination of input
values that are being applied to circuit right now
q In some books called Combinatorial Logic
n Later we will learn: Sequential Logic
q Has memory
n Structure stores history à Can ”store” data values
q Outputs are determined by previous (historical) and current
values of inputs
38
Boolean Logic Equations
39
Functional Specification
n Functional specification of outputs in terms of inputs
n What do we mean by “function”?
q Unique mapping from input values to output values
q The same input values produce the same output value every
time
q No memory (output does not depend on past input values)
6. Complement:
(i) 𝐚 + 𝒂%= 1 There is a complement element;
%=0
(ii) 𝐚 • 𝒂 AND/ORing with it gives the identity elm.
43
Boolean Algebra: Duality
n Observation
q All the axioms come in “dual” form
q Anything true for an expression also true for its dual
q So any derivation you could make that is true, can be flipped into
dual form, and it stays true
n Duality — More formally
q A dual of a Boolean expression is derived by replacing
n Every AND operation with... an OR operation
n Every OR operation with... an AND
n Every constant 1 with... a constant 0
n Every constant 0 with... a constant 1
n But don’t change any of the literals or play with the complements!
Example a • (b + c) = (a • b) + (a • c)
➙ a + (b • c) = (a + b) • (a + c)
44
Boolean Algebra: Useful Laws
Dual
Operations with 0 and 1: AND, OR with identities
1. X + 0 = X 1D. X • 1 = X gives you back the original
2. X + 1 = 1 2D. X • 0 = 0 variable or the identity
Idempotent Law:
3. X + X = X 3D. X • X = X AND, OR with self = self
Involution Law:
$) = X
4. (𝑿 double complement =
no complement
Laws of Complementarity: AND, OR with complement
$= 1
5. X + 𝐗 $= 0
5D. X • 𝐗 gives you an identity
Commutative Law:
6. X + Y = Y + X 6D. X • Y = Y • X Just an axiom…
45
Useful Laws (continued)
Associative Laws:
7. (X + Y) + Z = X + (Y + Z) 7D. (X • Y) • Z = X • (Y • Z) Parenthesis order
=X+Y+Z =X•Y•Z does not matter
Distributive Laws:
8. X • (Y+ Z) = (X • Y) + (X • Z) 8D. X + (Y• Z) = (X + Y) • (X + Z) Axiom
Simplification Theorems:
%= X
9. X • Y + X • 𝒀 %) = X
9D. (X + Y) • (X + 𝒀
Useful for
10. X + X • Y = X 10D. X • (X + Y) = X simplifying
expressions
%) • Y = X • Y
11. (X + 𝒀 %) + Y = X + Y
11D. (X •𝒀
47
DeMorgan’s Law: Enabling Transformations
DeMorgan's Law:
12. (𝑿 + 𝒀 + 𝒁 + ⋯ ) = 𝑿$. 𝒀
$. 𝒁
$. …
$+𝒀
12D. (𝑿 . 𝒀. 𝒁. … ) = 𝑿 $+𝒁 $+ …
F=A+B+C
At least one of A, B, C is TRUE --> It is not the case that A, B, C are all false
48
DeMorgan’s Law (Continued)
These are conversions between different types of logic functions
They can prove useful if you do not have every type of gate…
Or, if some types of gates are more desirable to use than others…
$𝒀$ 𝑿 𝑿 𝒀 𝑿+𝒀 # 𝒀
𝑿 # #𝒀
𝑿 #
𝑨 = (𝑿 + 𝒀) = 𝑿 𝒀 𝑨
0 0 1 1 1 1
0 1 0 1 0 0
NOR is equivalent to AND 𝑿 1 0 0 0 1 0
with inputs complemented 𝑨
𝒀
1 1 0 0 0 0
$+𝒀
𝑩 = (𝑿𝒀) = 𝑿 $ 𝑿 𝑿 𝒀 𝑿𝒀 # 𝒀
𝑿 # !+𝒀
𝑿 !
𝒀 𝑩
0 0 1 1 1 1
0 1 1 1 0 1
NAND is equivalent to OR 1 0 1 0 1 1
𝑿 𝑩
with inputs complemented 𝒀 1 1 0 0 0 0
49
Using Boolean Equations
to Represent a Logic Circuit
50
Boolean Equations Enable Us To…
n Represent the function of a combinational logic block
q Functional Specification
52
Sum of Products Form: Key Idea
n Assume we have the truth table of Boolean Function F
53
Sum of Products Form: Example
Sum of Products Form (SOP)
Also known as disjunctive normal form or minterm expansion
𝐀 𝐁 𝐂 𝐅 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
0 0 0 0 $ 𝐁𝐂 + 𝐀𝑩
𝑭=𝑨 $𝑪$ + 𝐀𝑩
$ 𝐂 + 𝐀𝐁𝑪
$ + 𝐀𝐁𝐂
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
Find all the input combinations (minterms) for which the output of the function is TRUE.
Some Definitions (for a 3-Input Function)
¢ Complement: variable with a bar over it
𝑨,𝑩,𝑪
55
Two-Level Canonical (Standard) Forms
n Truth table is the unique signature of a Boolean function …
q But, it is an expensive representation
56
Two-Level Canonical Forms: SOP
Sum of Products Form (SOP)
Also known as disjunctive normal form or minterm expansion
𝐀 𝐁 𝐂 𝐅 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
0 0 0 0 $ 𝐁𝐂 + 𝐀𝑩
𝑭=𝑨 $𝑪$ + 𝐀𝑩
$ 𝐂 + 𝐀𝐁𝑪
$ + 𝐀𝐁𝐂
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
• Each row in a truth table has a minterm
• A minterm is a product (AND) of literals
• Each minterm is TRUE for that row (and only that row)
59
Canonical SOP Form
𝐀 𝐁 𝐂 minterms F in canonical form:
0 0 0 %𝑩
𝑨 %𝑪% = m0
0 0 1 %𝑩
𝑨 % 𝑪 = m1 F(A,B,C) = ∑m(3,4,5,6,7)
0 1 0 % 𝑩𝑪
𝑨 % = m2 = m3 + m4 + m5 + m6 + m7
0 1 1 % 𝑩𝑪 = m3
𝑨
1 0 0 𝑨𝑩%𝑪% = m4 𝑭=𝑨$ 𝐁𝐂 + 𝐀𝑩 $
$𝑪
1 0 1 𝑨𝑩% 𝑪 = m5 $ + 𝐀𝐁𝐂
$ 𝐂 + 𝐀𝐁𝑪
% = m6 + 𝐀𝑩
1 1 0 𝑨𝑩𝑪
1 1 1 𝑨𝑩𝑪 = m7
canonical form ≠ minimal form
Shorthand Notation for $ + 𝑨
$ 𝑪+𝑪 $
$ 𝐁𝐂 + 𝐀𝐁(𝑪 + 𝑪)
Minterms of 3 Variables 𝑭 = 𝐀𝑩
$+ 𝑨
= 𝐀𝑩 $ 𝐁𝐂 + 𝐀𝐁
$ 𝐁𝐂
$ + 𝑩) + 𝑨
= 𝐀(𝑩
$ 𝐁𝐂
=𝐀+ 𝑨
2-Level AND/OR = 𝐀 + 𝐁𝐂
Realization
60
From SOP to Gates
¢ SOP (sum-of-products) leads to two-level logic
¢ Example: 𝒀 = 𝑨 1 𝑩 1 𝑪 + 𝑨 1 𝑩 1 𝑪 + 𝑨 1 𝑩 1 𝑪
A B C
A B C
minterm: ABC
minterm: ABC
minterm: ABC
Y
SOP form does NOT directly lead to minimal logic 61
Canonical Sum of Products Form: Key Idea
n Any 1-bit function can be represented as a Sum of Products
n Logically
q The function evaluates to TRUE (i.e., output is 1) if ANY of the
Products (minterms) causes the Output to be 1
q SOP form represents the function as the SUM (OR) of all
Products (minterms) that cause the Output to be 1
62
Alternative Canonical Form: POS
%
DeMorgan of SOP of 𝑭
Find all the input combinations (maxterms) for which the output of the function is FALSE.
F = AND of all input variable combinations that result in a 0
product
Product of Sums (POS) %)(𝑨 + 𝑩
% + 𝑪)
𝑭 = (𝑨 + 𝑩 + 𝑪)(𝑨 + 𝑩 + 𝑪
Each sum term represents one of the sums
This input
“zeros” of the function
0 0 0 0 0 1 0 1 0
𝑭= 𝑨+𝑩+𝑪 𝑨+𝑩+𝑪 % (𝑨 + 𝑩
% + 𝑪)
𝐀 𝐁 𝐂 𝐅
0 0 0 0
0 0 1 0
Activates this term
0 1 0 0
0 1 1 1 For the given input, only the shaded sum term
1 0 0 1 will equal 0
1 0 1 1
𝑨+𝑩% +𝑪=𝟎+𝟏 %+𝟎
1 1 0 1
1 1 1 1 Anything ANDed with 0 is 0; Output F will be 0
The function evaluates to FALSE (i.e., output is 0)
if any of the Sums (maxterms) causes the output to be 0 63
Consider A=0, B=1, C=0
Input
𝐀 𝐁 𝐂 𝐅 0 1 0 %)(𝑨 + 𝑩
𝑭 = (𝑨 + 𝑩 + 𝑪)(𝑨 + 𝑩 + 𝑪 % + 𝑪)
0 0 0 0
0 0 1 0 𝟎 𝟏 𝟎 𝟎 𝟏 %
𝟎 𝟎 %
𝟏 𝟎
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1 1 1 0
𝑭=𝟎
%
Or just remember” POS of 𝑭 is the same as the DeMorgan of SOP of 𝑭
65
Notation for the Canonical POS Form
Product of Sums / Conjunctive Normal Form / Maxterm Expansion
%
𝐅 = (𝑨 + 𝑩 + 𝑪)(𝑨 + 𝑩 + 𝑪)(𝑨 % + 𝑪)
+𝑩
𝐀 𝐁 𝐂 5 𝑴(𝟎, 𝟏, 𝟐)
Maxterms
0 0 0 𝑨 + 𝑩 + 𝑪 = M0
0 0 1 𝑨+𝑩+𝑪 % = M1
0 1 0 𝑨+𝑩 % + 𝑪 = M2 𝐀 𝐁 𝐂 𝐅 Note that you
0 1 1 𝑨+𝑩 % +𝑪% = M3 0 0 0 0 form the
1 0 0 % + 𝑩 + 𝑪 = M4
𝑨 0 0 1 0 maxterms around
1 0 1 %+𝑩+𝑪
𝑨 % = M5 0 1 0 0 the “zeros” of the
1 1 0 %+𝑩
𝑨 % + 𝐂 = M6 0 1 1 1 function
1 1 1 %+𝑩
𝑨 % +𝑪% = M7 1 0 0 1
1 0 1 1
Maxterm shorthand notation This is not the
1 1 0 1 complement of
for a function of three variables 1 1 1 1 the function!
66
Useful Conversions
1. Minterm to Maxterm conversion:
rewrite minterm shorthand using maxterm shorthand
replace minterm indices with the indices not already used
E.g., 𝐅 𝑨, 𝑩, 𝑪 = ∑ 𝒎 𝟑, 𝟒, 𝟓, 𝟔, 𝟕 = ∏ 𝑴(𝟎, 𝟏, 𝟐)
𝐄. 𝐠. , 𝐅 𝑨, 𝑩, 𝑪 = D 𝒎 𝟑, 𝟒, 𝟓, 𝟔, 𝟕 % 𝑨, 𝑩, 𝑪 = D 𝒎(𝟎, 𝟏, 𝟐)
𝑭
= 5 𝑴(𝟎, 𝟏, 𝟐) = 5 𝑴 𝟑, 𝟒, 𝟓, 𝟔, 𝟕
4. Minterm expansion of 𝐅 to Maxterm expansion of 𝑭 %:
rewrite in Maxterm form, using the same indices as 𝐅
𝐄. 𝐠. , 𝐅 𝑨, 𝑩, 𝑪 = D 𝒎 𝟑, 𝟒, 𝟓, 𝟔, 𝟕 % 𝑨, 𝑩, 𝑪 = ∏ 𝑴 𝟑, 𝟒, 𝟓, 𝟔, 𝟕
𝑭
= 5 𝑴(𝟎, 𝟏, 𝟐) = D 𝒎(𝟎, 𝟏, 𝟐)
67
Logic Simplification (or Minimization)
n Using Boolean Algebra, we can simplify the SOP or POS
form of any function in a methodical way
¢ Example: 𝒀 = 𝑨 1 𝑩 1 𝑪 + 𝑨 1 𝑩 1 𝑪 + 𝑨 1 𝑩 1 𝑪
A B C
A B C
minterm: ABC
minterm: ABC
minterm: ABC
Y
SOP form does NOT directly lead to minimal logic 69
Logic Simplification Example: Simplified
¢ Simplified form of function Y
¢ Example: 𝒀 = 𝑩 1 𝑪 + 𝑨 1 𝑩
70
Let’s Cover Some
Basic Combinational Blocks
71
Combinational Building Blocks
used in Modern Computers
72
Recall: Common Logic Gates
73
Combinational Building Blocks
n Combinational logic is often grouped into larger building
blocks to build more complex systems
n We now examine:
q Decoder
q Multiplexer
q Full adder
q PLA (Programmable Logic Array)
Decoder
75
Decoder
n “Input pattern detector”
n n inputs and 2n outputs
n Exactly one of the outputs is 1 and all the rest are 0s
n The output that is logically 1 is the output corresponding to
the input pattern that the logic circuit is expected to detect
n Example: 2-to-4 decoder
76
Decoder (I)
n n inputs and 2n outputs
n Exactly one of the outputs is 1 and all the rest are 0s
n The output that is logically 1 is the output corresponding to
the input pattern that the logic circuit is expected to detect
A A=1
1 if A,B is 00 0
B B=0
1 if A,B is 01 0
1 if A,B is 10 1
1 if A,B is 11 0
Decoder (II)
n The decoder is useful in determining how to interpret a bit
pattern
q It could be the A=1
address of a location 0
B=0
in memory, that the
processor intends to
read from 0
q It could be an
instruction in the 1
program and the
processor needs to
decide what action to 0
take (based on
instruction opcode)
78
Multiplexer (MUX)
79
Multiplexer (MUX), or Selector
n Selects one of the N inputs to connect it to the output
q based on the value of a log2N-bit control input called select
S S=0
a b A 0
A
C C
Multiplexer (MUX), or Selector (III)
n The output C is always connected to either the input A or
the input B
q Output value depends on the value of the select line S
A B
S C S
0 A
1 B
C
n Your task: Draw the schematic for an 4-input (4:1) MUX
q Gate level: as a combination of basic AND, OR, NOT gates
q Module level: As a combination of 2-input (2:1) MUXes
82
A 4-to-1 Multiplexer
83
Aside: Logic Using Multiplexers
n Multiplexers can be used as lookup tables to perform logic
functions
85
Aside: Logic Using Multiplexers (III)
n Multiplexers can be used as lookup tables to perform logic
functions
001
010
011
output (1 bit)
100
Multiplexer (Mux):
101 Chooses one of the 8 data inputs
that corresponds to the 3-bit select
110
input
111
Select Input
3
input (3 bits)
88
Aside: Logic Using Decoders (I)
n Decoders can be combined with OR gates to build logic
functions.
90
Full Adder (I)
n Binary addition
q Similar to decimal addition 𝒂𝒏F𝟏 𝒂𝒏F𝟐 … 𝒂𝟏 𝒂𝟎
q From right to left 𝒃𝒏F𝟏 𝒃𝒏F𝟐 … 𝒃𝟏 𝒃𝟎
q One column at a time 𝑪𝒏 𝑪𝒏F𝟏 … 𝑪𝟏
q One sum and one carry bit 𝑺𝒏F𝟏 … 𝑺𝟏 𝑺𝟎
n Truth table of binary addition on one column of bits within
two n-bit operands a b carry carry S
i i i i+1 i
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
91
Full Adder (II)
n Binary addition
q N 1-bit additions 𝒂𝒏F𝟏 𝒂𝒏F𝟐 … 𝒂𝟏 𝒂𝟎
q SOP of 1-bit addition 𝒃𝒏F𝟏 𝒃𝒏F𝟐 … 𝒃𝟏 𝒃𝟎
FullFull
Adder
Adder
(1 bit) 𝑪𝒏 𝑪𝒏F𝟏 … 𝑪𝟏
ai
𝑺𝒏F𝟏 … 𝑺𝟏 𝑺𝟎
bi
ci+1 ai bi carryi carryi+1 Si
ci
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
si 0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
MAJ XOR
92
4-Bit Adder from Full Adders
n Creating a 4-bit adder out of 1-bit full adders
q To add two 4-bit binary numbers A and B
b3 a3 b2 a2 b1 a1 b0 a0
s3 s2 s1 s0
𝒂𝟑 𝒂𝟐 𝒂𝟏 𝒂𝟎 𝟏 𝟎 𝟏 𝟏
+ 𝒃𝟑 𝒃𝟐 𝒃𝟏 𝒃𝟎 + 𝟏 𝟎 𝟎 𝟏
𝒄𝟒 𝒄𝟑 𝒄𝟐 𝒄𝟏 𝟏 𝟎 𝟏 𝟏
𝒔𝟑 𝒔𝟐 𝒔𝟏 𝒔𝟎 𝟎 𝟏 𝟎 𝟎
93
Adder Design: Ripple Carry Adder
94
H&H Section 5.2.1
Adder Design: Carry Lookahead Adder
Example of
logic specialization:
Specialized logic for
fast carry generation
95
H&H Section 5.2.1
Programmable Logic Array (PLA)
96
PLA: Recall: SOP Form
¢ SOP (sum-of-products) leads to two-level logic
¢ Example: 𝒀 = 𝑨 1 𝑩 1 𝑪 + 𝑨 1 𝑩 1 𝑪 + 𝑨 1 𝑩 1 𝑪
A B C
A B C
minterm: ABC
minterm: ABC
minterm: ABC
Y
A PLA enables the two-level SOP implementation of any N-input M-output function
The Programmable Logic Array (PLA)
n The below logic structure is a very common building block
for implementing any collection of logic functions one
wishes to A
X
n An array of AND gates B
followed by an array of OR C
gates Connections
Y
n Programming a PLA: we C
Y
program the connections from Connections
AND gate outputs to OR gate
inputs to implement a desired Z
logic function
Z ai
X
bi
ci
ci+1
Truth table of a full adder
ai bi carryi carryi+1 Si
0 0 0 0 0
si
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
103
We Covered
Until This Point
in Lecture
104
Digital Design & Computer Arch.
Lecture 3: Combinational Logic II
ETH Zürich
Spring 2023
2 March 2023
Slides for Future Lectures
106
Logical Completeness
Logical (Functional) Completeness
n Any logic function we wish to implement could be
accomplished with a PLA
q PLA consists of only AND gates, OR gates, and inverters
q We just have to program connections based on SOP of the
intended logic function
108
More Combinational Blocks
109
More Combinational Building Blocks
n H&H Chapter 2 in full
q Required Reading
q E.g., see Tri-state Buffer and Z values in Section 2.6
n H&H Chapter 5
q Will be required reading soon.
110
Comparator
111
Equality Checker (Compare if Equal)
n Checks if two N-input values are exactly the same
n Example: 4-bit Comparator
ALU (Arithmetic Logic Unit)
113
ALU (Arithmetic Logic Unit)
n Combines a variety of arithmetic and logical operations into
a single unit (that performs only one function at a time)
n Usually denoted with this symbol:
Example ALU (Arithmetic Logic Unit)
115
More Combinational Building Blocks
n See H&H Chapter 5.2 for
q Subtractor (using 2’s Complement Representation)
q Shifter and Rotator
q Multiplier
q Divider
q …
116
More Combinational Building Blocks
n H&H Chapter 2 in full
q Required Reading
q E.g., see Tri-state Buffer and Z values in Section 2.6
n H&H Chapter 5
q Will be required reading soon.
117
Tri-State Buffer
118
Tri-State Buffer
n A tri-state buffer enables gating of different signals onto a
wire
A tri-state buffer
acts like a switch
119
Example: Use of Tri-State Buffers
n Imagine a wire connecting the CPU and memory
q At any time only the CPU or the memory can place a value on
the wire, both not both
q You can have two tri-state buffers: one driven by CPU, the
other memory; and ensure at most one is enabled at any time
120
Example Design with Tri-State Buffers
GateCPU
CPU
GateMem
Memory
Shared Bus
121
Another Example
122
Multiplexer Using Tri-State Buffers
123
Recall: A 4-to-1 Multiplexer
124
Digging Deeper: Tri-State Buffer in CMOS
n How do you implement Tri-State Buffers using transistors?
http://people.ee.duke.edu/~krish/teaching/Lectures/CMOScircuits_2011.pdf 125
We Covered Combinational Logic Blocks
n Basic logic gates (AND, OR, NOT, NAND, NOR, XOR)
n Decoder
n Multiplexer
n Full Adder
n Programmable Logic Array (PLA)
n Comparator
n Arithmetic Logic Unit (ALU)
n Tri-State Buffer
127
Recall: Full Adder in SOP Form Logic
Full Adder
ai
bi
ci+1 ai bi carryi carryi+1 Si
ci
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
si 0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
128
Goal: Simplified Full Adder
3-input XOR
3-input majority
129
Quick Recap on Logic Simplification
n The original Boolean expression (i.e., logic circuit) may not
be optimal
F=A+B
A basis for what the automated design tools are doing today
130
Logic Simplification
n Systematic techniques for simplifications
q amenable to automation
$ + 𝑨𝑩
Key Tool: The Uniting Theorem — 𝑭 = 𝑨𝑩
𝑭= $ + 𝑨𝑩 = 𝑨 𝑩
𝑨𝑩 $ +𝑩 =𝑨 𝟏 =𝑨
B's value changes within the rows where F==1 (“ON set”)
A's value does NOT change within the ON-set rows
If an input (B) can change without changing the output, that input
value is not needed
➙ B is eliminated, A remains
$𝑩
𝑮= 𝑨 $ + 𝑨𝑩 $+𝑨 𝑩
$= 𝑨 $=𝑩
$
𝑭= $ + 𝑨𝑩 = 𝑨 𝑩
𝑨𝑩 $ +𝑩 =𝑨 𝟏 =𝑨
B's value changes within the rows where F==1 (“ON set”)
Essence of Simplification:
Find two-elementA's value doesof
subsets NOT
thechange within
ON-set the ON-set
where onlyrows
one variable
changes its value.
If anThis
inputsingle
(B) can varying variable
change without can the
changing be output,
eliminated!
that input
value is not needed
➙ B is eliminated, A remains
$𝑩
𝑮= 𝑨 $ + 𝑨𝑩 $+𝑨 𝑩
$= 𝑨 $=𝑩
$
133
Simplified Priority Circuit
n Priority Circuit
q Inputs: “Requestors” with priority levels
q Outputs: “Grant” signal for each requestor
q Example 4-bit priority circuit
X (Don’t Care) means I don’t care what the value of this input is
134
Logic Simplification:
Karnaugh Maps (K-Maps)
135
Karnaugh Maps are Fun…
n A pictorial way of minimizing circuits by visualizing
opportunities for simplification
n They are for you to study on your own…
q Or we will cover them if time permits
136
We Are Done with Combinational Logic
n Building blocks of modern computers
q Transistors
q Logic gates
n Combinational circuits
n Boolean algebra
138
Karnaugh Maps are Fun…
n A pictorial way of minimizing circuits by visualizing
opportunities for simplification
n They are for you to study on your own…
q Or we will cover them if time permits
139
Backup Slides on
Karnaugh Maps (K-Maps)
140
Complex Cases
n One example
& 𝑩𝑪 + 𝑨𝑩
𝑪𝒐𝒖𝒕 = 𝑨 & + 𝑨𝑩𝑪
& 𝑪 + 𝑨𝑩𝑪
n Problem
q Easy to see how to apply Uniting Theorem…
q Hard to know if you applied it in all the right places…
q …especially in a function of many more variables
n Question
q Is there an easier way to find potential simplifications?
q i.e., potential applications of Uniting Theorem…?
n Answer
q Need an intrinsically geometric representation for Boolean f( )
q Something we can draw, see…
141
Karnaugh Map
n Karnaugh Map (K-map) method
q K-map is an alternative method of representing the truth table
that helps visualize adjacencies in up to 6 dimensions
q Physical adjacency ↔ Logical adjacency
1 10 11
1 100 101 111 110 01 0100 0101 0111 0110
142
Karnaugh Map Methods
Adjacent
𝑩𝑪
𝑨 00 01 11 10
000 100
010 110
001 101
0 000 001 011 010 011 111
143
K-map Cover - 4 Input Variables
144
Logic Minimization Using K-Maps
n Very simple guideline:
q Circle all the rectangular blocks of 1’s in the map, using the
fewest possible number of circles
n Each circle should be as large as possible
q Read off the implicants that were circled
n More formally:
q A Boolean equation is minimized when it is written as a sum of
the fewest number of prime implicants
q Each circle on the K-map represents an implicant
q The largest possible circles are prime implicants
146
K-map Rules
n What can be legally combined (circled) in the K-map?
q Rectangular groups of size 2k for any integer k
q Each cell has the same value (1, for now)
q All values must be adjacent
n Wrap-around edge is okay
148
K-map Example: Two-bit Comparator (2)
K-map for F1 A B C D F1 F2 F3
0 0 0 0 1 0 0
𝑪
0 0 0 1 0 1 0
𝑪𝑫 00 01 11 10 0 0 1 0 0 1 0
𝑨𝑩
00 0 0 1 1 0 1 0
1 0 1 0 0 0 0 1
01 0 1 0 1 1 0 0
1 0 1 1 0 0 1 0
11 𝑩 0 1 1 1 0 1 0
1
𝑨 1 0 0 0 0 0 1
1 0 0 1 0 0 1
10
1 1 0 1 0 1 0 0
1 0 1 1 0 1 0
1 1 0 0 0 0 1
𝑫 1 1 0 1 0 0 1
1 1 1 0 0 0 1
F1 = A'B'C'D' + A'BC'D + ABCD + AB'CD'
1 1 1 1 1 0 0
149
K-map Example: Two-bit Comparator (3)
K-map for F2 A B C D F1 F2 F3
𝑪 0 0 0 0 1 0 0
𝑪𝑫 00 01 11 10 0 0 0 1 0 1 0
𝑨𝑩 0 0 1 0 0 1 0
00
1 1 1 0 0 1 1 0 1 0
0 1 0 0 0 0 1
01
1 1 0 1 0 1 1 0 0
0 1 1 0 0 1 0
11 𝑩
0 1 1 1 0 1 0
𝑨 1 0 0 0 0 0 1
10
1 1 0 0 1 0 0 1
1 0 1 0 1 0 0
1 0 1 1 0 1 0
𝑫 1 1 0 0 0 0 1
150
K-maps with “Don’t Care”
n Don’t Care really means I don’t care what my circuit outputs if this
appears as input
q You have an engineering choice to use DON’T CARE patterns
intelligently as 1 or 0 to better simplify the circuit
A B C D F G
•••
I can pick 00, 01, 10, 11
0 1 1 0 X X independently of below
0 1 1 1
1 0 0 0 X X
1 0 0 1 I can pick 00, 01, 10, 11
independently of above
•••
151
Example: BCD Increment Function
n BCD (Binary Coded Decimal) digits
q Encode decimal digits 0 - 9 with bit patterns 00002 — 10012
q When incremented, the decimal sequence is 0, 1, …, 8, 9, 0, 1
A B C D W X Y Z
0 0 0 0 0 0 0 1
0 0 0 1 0 0 1 0
0 0 1 0 0 0 1 1
0 0 1 1 0 1 0 0
0 1 0 0 0 1 0 1
0 1 0 1 0 1 1 0
0 1 1 0 0 1 1 1
0 1 1 1 1 0 0 0
1 0 0 0 1 0 0 1
1 0 0 1 0 0 0 0
1 0 1 0 X X X X
1 0 1 1 X X X X
1 1 0 0 X X X X
These input patterns should
1 1 0 1 X X X X never be encountered in practice
1 1 1 0 X X X X (hey -- it’s a BCD number!)
1 1 1 1 X X X X So, associated output values are
“Don’t Cares”
152
K-map for BCD Increment Function
W X
𝑪𝑫 𝑪𝑫
Z
ABCD
(without
𝑨𝑩 don’t
00 01 cares)
11 10 = A'D'
𝑨𝑩 +00B'C'D’
01 11 10
00 00 1
+ 1
Z (with don’t
01 cares)1 = D' 01 1 1 1
WXYZ 11 X X X X 11 X X X X
10 1 X X 10 X X
Y 𝑪𝑫
Z 𝑪
00 01 11 10 𝑪𝑫
𝑨𝑩 𝑨𝑩 00 01 11 10
00 1 1 00 1 1
01 1 1 01 1 1
11 X X X X 11 X X X X
𝑩
𝑨
10 X X 10 1 X X
𝑫 153
K-map Summary