Download helpful slideshow

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Transcript
Logic Synthesis:
From Specs to Circuits
• Implementation Styles
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
– Random
– Regular
• Optimization Criteria
–
–
–
–
Area (roughly number of transistors)
Delay (roughly number of gates on longest circuit path)
Testability
Power consumption
• 2-Level Synthesis
– Classical (Exact)
– Heuristic (Non-Exact)
• Multilevel Synthesis
Logic Expressions  Circuits
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
f  stv  stwx  styz  uv  uwx  uyz
f   st  u wx  yz  v 
2-Level Circuits
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
• Assumptions:
– Inputs are available in both true and complemented forms
(reasonable assumption: FF outputs are available in both phases)
– Gates have no fan-in or fan-out restrictions
(unreasonable assumption: typically FI < 4, FO < 6)
• Correspond to SOP or POS forms of a switching function:
– SOP  AND/OR (NAND/NAND)
– POS  OR/AND (NOR/NOR)
• # of 1st level AND (OR) gates = # of nontrivial product (sum) terms
• Fan-in of 2nd level OR (AND) gate = total # of product (sum) terms
• Usually implemented using regular structures:
– Read-Only Memories (ROMs)
– Programmable Logic Arrays (PLAs)
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
AND/OR  NAND/NAND
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
Terminology Review
• Literal: A variable or its complement
– Ex: X , Y , B
• Product Term: A single literal or a product of two or
more literals
– Ex: XY , ABC , W X Y Z
• Sum of Products: A sum of product terms
• Minterm: A product term where every variable of the
function appears once as a literal (i.e., in complemented
or uncomplemented form)
• Canonical Sum: A sum of minterms. Every function
has a unique canonical sum
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
Canonical Sum Representations
• Canonical sum uniquely defines a
function, but can be long. A
minterm list is a list of the row
numbers of minterms included in
the canonical sum.
– Also known as the on-set
• Three canonical ways of
representing functions
– truth table
– canonical sum
– minterm list
Row #
0
1
2
3
4
5
6
7
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
F
0
0
1
0
0
0
1
1
F   A, B ,C (2,6,7)
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
Canonical Product Representation
• Sum Term: A single literal or
a sum of two or more literals
• Product of Sums: A product
of sum terms
• Maxterm: A sum term where
every variable in the function
appears once as a literal
• Canonical Product: A product
of maxterms
• Maxterm List: A list of the
truth table row numbers of the
maxterms of a function
– Also known as the off-set
Row #
0
1
2
3
4
5
6
7
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
F
0
1
1
1
1
0
1
0
Maxterms
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
A+B+C
F  ( A  B  C )( A  B  C )( A  B  C )
F   A, B ,C (0,5,7)
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
F
0
0
1
0
0
0
1
1
Minterms
Circuit:
ABC
ABC
ABC
ABC
A
B
C
ABC
ABC
ABC
ABC
A
B
C
A
B
C
Canonical Sum:
F  ABC  ABC  ABC
Cost of implementation: 3 3-input ANDs (9 literals) + 1 3-input OR
F
• Canonical sum is not (in general) the least-cost way to
implement a function
• How to get smaller circuits?
– One way: Switching algebra theorems!
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F  ABC  ABC  ABC
 ( ABC  ABC )  ( ABC  ABC )
Idempotency
B
C
F
 BC  AB
Combining
A
B
Cost: 2 2-input ANDs (4 literals) + 1 2-input OR!
Applying theorems directly becomes more difficult as canonical sums get
bigger…
ABC D  ABCD  ABC D  ABC D  ABCD  ABCD  ABCD  ABC D  ABC D  AB
– Another (perhaps easier) way: Karnaugh maps
Karnaugh Maps
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
• Karnaugh map (K-map) is a 2D representation of truth table that
present a graphical way to find the minimal SOP (or POS) of a
function
– Each cell represents a minterm
– Cells with a common edge are logically adjacent (i.e., they will combine)
– K-map is actually a doughnut: outside edges connect
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
F
00
m
11
m
12
m
13
m
04
m
05
m
06
m
17
m
11 and 10 are swapped!
F
AB
00
C
01
11
10
0 m
00 m
12 m
06 m
04
1 m
11 m
13 m
17 m
05
We’ll omit 0s for clarity
• Key K-map property: adjacent cells represent
minterms that will combine!
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F   X ,Y , Z (1,2,4,5)
XYZ
XY
00
Z
01
10
1
0
0
1
11
1
YZ
2
6
1
Minterm XYZ
4
1
1
3
7
5
Combining:
XYZ + XYZ = XY
Minterm XYZ
Reading product term:
X is 1 in both minterms: X
Y is 0 in both minterms: Y
Z is 1 in one minterm and 0 in the other: Z
does not appear in product term
Product term: XY
Minimal SOP:
F  X Y  Y Z  XY Z
Four Variable K-map
F  W , X ,Y , Z (0,1,2,3,4,5,7,14,15)
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F
WX
00
YZ
01
11
10
00 m10 m14 m12 m8
0
4
12
8
01 m11 m15 m13 m9
1
5
13
9
11 m13 m17 m
115 m11
3
7
15
11
10 m12 m6 m
114 m10
2
6
14
10
How do we find the product terms to include in the minimal SOP?
• K-map “rules”
– Only circle adjacent cells (remember edges are adjacent!)
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
AB
00
C
01
11
10
AB
00
C
0
1
0
1
1
1
01
11
10
1
1
– Only circle groups that are powers of 2 (1, 2, 4, 8, …)
AB
00
C
01
0
1
1
1
1
1
11
10
AB
00
C
01
0
1
1
1
1
11
10
11
10
– Only circle 1-cells
AB
00
C
01
11
10
AB
00
C
01
1
1
0
1
1
0
1
1
1
1
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
Covering
= input combinations
for which g outputs 1
= input combinations
for which f outputs 1
f covers g
if f=1 whenever g=1
f≥g
Space of all 2n input
combinations (minterms)
g
f
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
Implicants
= input combinations
for which g outputs 1
= input combinations
for which f outputs 1
= input combinations
for which h outputs 1
If g is a product term & g≤f,
Then g is an implicant of f.
Space of all 2n input
combinations (minterms)
g
h
f
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
Prime Implicants
• Removing a literal from any product term (any implicant)
makes it cover twice as many minterms.
– Removing a literal “grows” the term
– ex. 3 variables:
ab’c covers 1 minterm
ab’
ac
each cover 2 minterms
b’c
ab’
f ab’c b’c
ac
ab’c is an implicant of f.
Any way of removing a literal
makes ab’c no longer imply f.
So ab’c is a prime implicant of f.
WX
Implicant: Any product term that
implies a function F (i.e., if, for
some input combination,
product term P = 1, then F = 1
for the same input
combination)
00
01
01 1
1
11 1
1
YZ
11
10
00
10
1
1
1
11
10
These are only
a few of the
implicants of
this function…
WX
00
01
01 1
1
11 1
1
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
YZ
00
Prime Implicant: An implicant
such that if one literal is
removed, the resulting product
term no longer implies F
Essential Prime Implicant: A
prime implicant that covers a
minterm that is not covered by
any other prime implicants
10
1
1
1
11
10
WX
00
01
01 1
1
11 1
1
YZ
00
10
1
1
1
Theorem: The minimal SOP of a function is a sum of prime implicants
F
K-map minimization procedure:
1)
2)
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
3)
Find all prime implicants (PIs)
Determine which PIs are essential
prime implicants (EPIs) and include
those in the minimal SOP. Remove
all EPIs and the 1-cells they cover
Remove all PIs that are eclipsed
(dominated)
–
4)
Prime implicant X eclipses prime
implicant Y if X covers at least all of
the 1-cells that Y covers
Find secondary EPIs, include
secondary-EPIs in minimal SOP,
and remove 1-cells they cover. If
there are any 1-cells remaining, goto
step 3
WX
00
01
00 1
1
01 1
1
11
1
10
1
YZ
Note: If, at any stage, there are no remaining
EPIs, all remaining combinations of PIs must
be considered for the minimal SOP
10
1
1
1
F  WY W X
F
WX
00
YZ
01
11
10
00
1
01
11
1
1
11
10
10
F
WX
00
YZ
•
11
01
00
1
01
11
1
1
10
F  W Y  W X  WYZ  W X Z
In Class Exercise
Find the minimal SOP for the following function:
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F  (W , X ,Y , Z ) (1,4,5,7,12,14,15)
WX
00
01
11
00
1
1
01 1
1
11
1
YZ
10
1
1
10
In Class Exercise
Find the minimal SOP for the following function:
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F  (W , X ,Y , Z ) (1,4,5,7,12,14,15)
WX
WX
00
01
11
00
1
1
01 1
1
11
1
YZ
10
10
00
YZ
00
01
11
1
1
01
1
11
1
10
10
WX
WX
00
YZ
00
01
11
1
1
10
1
11
1
10
01
11
00
01
01
1
00
YZ
1
1
11
1
10
1
F  W Y Z  X Y Z  XYZ
F  WYZ
F  W Y Z  X Y Z  XYZ  WXY
or
F  W Y Z  X Y Z  XYZ  WX Z
The minimal SOP may
not always be unique!
10
Using K-maps to find minimal POS
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
1)
2)
Find minimal SOP for F
Use DeMorgan’s to get minimal POS for F
F  W , X ,Y , Z (1,3,4,6,9,11,12)
F
F
WX
00
YZ
00
01
11
1
1
10
WX
00
YZ
01
11
00 1
1
01 1
1
01
1
1
11 1
1
11
1
1
10
1
10 1
F  X Z  XZ  WY Z
F  ( X  Z )( X  Z )(W  Y  Z )
10
1
1
Don’t Care Outputs
•
•
Sometimes when designing a function, some input combinations may never
occur
Design Example - Encoder: Converts 3-bit one-hot code to equivalent
binary code
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
o1
i2
0
0
0
1
i1
0
0
1
0
i0
0
1
0
0
others
o1
0
0
1
1
d
0
o0
0
1
0
1
d
0
How to assign unused
input combinations?
o0
i2i 1
00
i0
01
11
1
0
10
i2i1
00
i0
1
1
1
6 literals
o0
00
i2i1
01
11
10
0
1
d
1
0
1
d
d
d
1
i0
4 literals
10
1
6 literals
i2i 1
11
0
1
o1
01
i0
00
1
01
d
11
10
d
1
d
d
4 literals
Don’t cares allow us to easily assign 1 or 0 to unused input
combinations in order to minimize implementation cost!
• When finding minimal SOP with don’t cares:
– Use d cells to make PIs as large as possible
– No prime implicant should include only d’s
– Only 1-cells should be considered when finding minimal covering
set of PIs
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F  W , X ,Y , Z (1,5,7,11,15)  d (8,12,13,14)
F
WX
00
YZ
01
00
11
10
d
d
01 1
1
d
11
1
1
10
1
d
F  XZ  W Y Z  WYZ  WX
Minimal SOP vs. Minimal POS w/ Don’t Cares
F
F
WX
00
YZ
01
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
00 d
11
00
01
1
00 d
1
01
01 1
1
1
11 d
d
1
10
10
YZ
1
d
FSOP  WX  YZ  W Z
FPOS
•
•
•
WX
11
10
1
1
11 d
d
10 1
1
d
1
F  W Z  Y Z W XY
 (W  Z )(Y  Z )(W  X  Y )
FSOP has a smaller literal cost than FPOS
WXYZ = 1110: FSOP(1,1,1,0) = 1, FPOS(1,1,1,0) = 0 → FSOP ≠ FPOS!!!
When don’t cares are involved, in general the minimal SOP for a function
is not equal to the minimal POS for the function
– But that’s ok! We don’t care about the input combinations where they differ…
5 Variable K-Maps
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
• Every cell is adjacent to 5 other cells
F
DE
F
BC
00
01
11
10
DE
BC
00
01
11
10
00 m0 m4 m12 m8
00 m16 m20 m28 m24
01 m1 m5 m13 m9
01 m17 m21 m29 m25
=0 m m
11 m3 Am
7
15
11
11 m19 m23 m31 m27
=1
10 m2 Am
6 m14 m10
10 m18 m22 m30 m26
A=0
A=1
Keep life simple by splitting on the MSB!
F   A, B ,C , D , E (1,3,15,17,19,29,31)
F
BC
00
DE
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
BC
01
11
10
00
DE
00
01
11
10
00
0
4
12
8
1
5
13
9
3
7
15
11
2
6
14
10
01 1
16
20
28
24
17
21
29
25
19
23
31
27
18
22
30
26
01 1
11 1
1
1
11 1
10
1
10
A=0
A=1
F  BCE  BCDE  ABCE
Tabular Generation of Prime Implicants
(Quine-McCluskey Procedure)
• Main Theorems:
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
– Adjacency: x’ p + x p = p (create “larger” implicants)
– Absorption: p + x p = p (delete subsumed implicants)
• Procedure:
– Arrange product terms in groups such that all terms in one group
have the same number of 1s in their binary representation, their
Group Index
– Starting from minterms, arrange groups in ascending-index order
– Apply adjacency theorem to product terms from adjacent groups
only
– Remove subsumed product terms using absorption theorem
• Product term representation: p = pnpn-1 … p2p1
where
0 if ith variable appears complemented

pi  1 if ith variable appears uncomplemented
  if ith variable does not appear

QM Example
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F   A, B ,C , D , E (1,3,15,17,19,29,31)
index minterm A B
1
1
0 0
2
3
0 0
17
1 0
3
19
1 0
4
15
0 1
29
1 1
5
31
1 1
C
0
0
0
0
1
1
1
D
0
1
0
1
1
0
1
E
1
1
1
1
1
1
1
pterm
A B CD E
QM Example
UM EECS 270 Spring 2011 – Taken from Dr.Karem Sakallah
F   A, B ,C , D , E (1,3,15,17,19,29,31)
index minterm A B
1
1
0 0
2
3
0 0
17
1 0
3
19
1 0
4
15
0 1
29
1 1
5
31
1 1
C
0
0
0
0
1
1
1
D
0
1
0
1
1
0
1
E
1
1
1
1
1
1
1
pterm
A B CD E
1,3
1,17
3,19
17,19
15,31
29,31
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
0
1
1
-
1
1
1
1
1
1
Similar