SYNTHESIS - gatech.edu

67

Transcript of SYNTHESIS - gatech.edu

Page 1: SYNTHESIS - gatech.edu

LOGIC SYNTHESIS AND

TWO-LEVEL LOGIC

OPTIMIZATION

c Giovanni De Micheli

Stanford University

Page 2: SYNTHESIS - gatech.edu

Outline

c GDM

� Overview of logic synthesis.

� Combinational-logic design:

{ Background.

{ Two-level forms.

� Exact minimization.

� Covering algorithms.

� Boolean relations.

Page 3: SYNTHESIS - gatech.edu

Logic synthesis and optimization

c GDM

� Determine microscopic structure of the circuit.

� Explore (area-delay)trade-o�:

{ Combinational circuits:

� I/O delay.

{ Sequential circuits:

� cycle-time.

� Explore (power-delay)trade-o�:

� Enhance circuit testability.

Page 4: SYNTHESIS - gatech.edu

Circuit implementation issues

c GDM

� Implementation styles:

{ Two-level (e.g. PLA macro cells).

{ Multi-level (e.g. cell-based, array-based).

� Operation:

{ Combinational.

{ Sequential:

� Synchronous

� Asynchronous.

Page 5: SYNTHESIS - gatech.edu

Design ow in logic synthesis

c GDM

� Circuit capture:

{ Tabular speci�cations of functions or

�nite-state machines (FSMs).

{ Schematic capture.

{ Hardware Description Languages (HDLs).

� Synthesis and optimization:

{ Map circuit representation to abstract

model.

{ Transformations on abstract model.

{ Library binding.

Page 6: SYNTHESIS - gatech.edu

Abstract models

c GDM

� Models based on graphs.

� Useful for:

{ Machine-level processing.

{ Reasoning about properties.

� Derived from language models by

compilation.

Page 7: SYNTHESIS - gatech.edu

Structural views

c GDM

� Netlists:

{ Modules, nets, incidence.

{ Ports.

{ Hierarchy.

� Incidence (sparse) matrix of a graph.

Page 8: SYNTHESIS - gatech.edu

Example

c GDM

m1

m2

m3

n1

n2

n3

p1

p2

p3

p5

p7p6

p4

m2

m1

m3

m1

m2

m3

n1

n2

n3

(a) (b) (c)

Page 9: SYNTHESIS - gatech.edu

Logic funcions

c GDM

� Black-box model of a combinational module.

� De�ned on Boolean Algebra.

� Support variables correspond to module

inputs.

� Logic functions may have multiple outputs

and be incompletely speci�ed.

Page 10: SYNTHESIS - gatech.edu

Logic networks

c GDM

� Mixed structural/behavioral views.

� Useful for multiple-level logic

(combinational and sequential).

� Interconnection of modules:

{ Logic gates.

{ Logic functions.

Page 11: SYNTHESIS - gatech.edu

Example

c GDM

a

b

c

x

y

p = a b

q = p + c

a

b

c

x

y

p

q

v

v

v v

vv

v

Page 12: SYNTHESIS - gatech.edu

State diagrams

c GDM

s

s s

s

0

1 2

3

r/0

a’b’+r/0

r/0r/0

ab’r’/0

a’r’/0b’r’/0

ar’/1br’/1

abr’/1

a’br’/0

r’/1

� Model behavior of sequential circuits.

� Graph:

{ Vertices = states.

{ Edges = transitions.

Page 13: SYNTHESIS - gatech.edu

Major logic synthesis problems

c GDM

� Optimization of logic function representation.

{ Minimization of two-level forms.

{ Optimization of Binary Decision Diagrams (BDDs).

� Synthesis of combinational multiple-levellogic networks.

{ Optimization or area, delay, power, testability.

� Optmization of FSM models.

{ State minimization, encoding.

� Synthesis of sequential multiple-level logicnetworks.

{ Optimization or area, delay, power, testability.

� Library binding.

{ Optimal selection of library cells.

Page 14: SYNTHESIS - gatech.edu

Combinational logic design

background

c GDM

� Boolean algebra:

{ Quintuple (B;+; �;0;1)

{ Binary Boolean algebra B = f0;1g

� Boolean function:

{ Single output: f : Bn ! B.

{ Multiple output: f : Bn ! Bm.

{ Incompletely speci�ed:

� don't care symbol *.

� f : Bn ! f0;1; �gm.

Page 15: SYNTHESIS - gatech.edu

The don't care conditions

c GDM

� We don't care about the value of the function.

� Related to the environment:

{ Input patterns that never occur.

{ Input patterns such that some output

is never observed.

� Very important for synthesis and optimization.

Page 16: SYNTHESIS - gatech.edu

De�nitions

c GDM

� Scalar function:

{ ON � set: subset of the domain

such that f is true.

{ OFF � set: subset of the domain

such that f is false.

{ DC � set: subset of the domain

such that f is a don't care .

� Multiple-output function:

{ De�ned for each component.

Page 17: SYNTHESIS - gatech.edu

Cubical representation

c GDM

000

001

010

011

100

101

110

111 abc

a’b’c’

a’b’c

ab’c’

a’bc’ abc’

a’bc

a

bc

ab’c

Page 18: SYNTHESIS - gatech.edu

De�nitions

c GDM

� Boolean variables.

� Boolean literal: variable and complement.

� Product or cube: product of literals.

� Implicant: product implying a value of a

function (usually TRUE).

{ Hypercube in the Boolean space.

� Minterm: product of all input variables

implying a value of a function (usually TRUE).

{ Vertex in the Boolean space.

Page 19: SYNTHESIS - gatech.edu

Tabular representations

c GDM

� Truth table:

{ List of all minterms of a function.

� Implicant table or cover:

{ List of implicants of a function

suÆcient to de�ne function.

� Remark:

{ Implicant tables are smaller in size.

Page 20: SYNTHESIS - gatech.edu

Example of truth table

x = ab+ a0c; y = ab+ bc+ ac

c GDM

abc xy

000 00

001 10

010 00

011 11

100 00

101 01

110 11

111 11

Page 21: SYNTHESIS - gatech.edu

Example of implicant table

x = ab+ a0c; y = ab+ bc+ ac

c GDM

abc xy

001 10

*11 11

101 01

11* 11

Page 22: SYNTHESIS - gatech.edu

Cubical representation of minterms and

implicants

c GDM

a

bc

f f1 2

α

βγ

δβ

000

001

101

111

110

101

001

� f1 = a0b0c0+ a0b0c+ ab0c+ abc+ abc0

� f2 = a0b0c+ ab0c

Page 23: SYNTHESIS - gatech.edu

Two-level logic optimization

motivation

c GDM

� Reduce size of the representation.

� Direct implementation:

{ PLAs { reduce size and delay.

� Other implementation styles

(e.g. multi-level):

{ Reduce amount of information.

{ Simplify local functions and connections.

Page 24: SYNTHESIS - gatech.edu

Programmable logic arrays

c GDM

� Macro-cells with rectangular structure.

� Implement any multi-output function.

� Layout easily generated by module generators.

� Fairly popular in the seventies/eighties (NMOS).

� Still used for control-unit implementation.

Page 25: SYNTHESIS - gatech.edu

Programmable logic array

c GDM

00X 10

X01 11

11X 10

a b c f f1 2

a a’ b b’ c c’1 2

f f

(a)

(b)

(c)

� f1 = a0b0+ b0c+ ab f2 = b0c

Page 26: SYNTHESIS - gatech.edu

Two-level optimization

c GDM

� Assumptions:

{ Primary goal is to reduce the number

of implicants.

{ All implicants have the same cost.

{ Secondary goal is to reduce the number

of literals.

� Rationale:

{ Implicants correspond to PLA rows.

{ Literals correspond to transistors.

Page 27: SYNTHESIS - gatech.edu

De�nitions

c GDM

� Minimum cover:

{ Cover of the function with minimum

number of implicants.

{ Global optimum.

� Minimal cover or irredundant cover:

{ Cover of the function that is not a proper

superset of another cover.

{ No implicant can be dropped.

{ Local optimum.

� Minimal cover w.r.t. 1-implicant containment.

{ No implicant is contained by another one.

{ Weak local optimum.

Page 28: SYNTHESIS - gatech.edu

Example

c GDM

a

bc

f f1 2

f f1 2

f f1 2

(a)

(b)

(c)

α

β

γ

δ

α

β

δ

α

βγ

δ

β

β

a

bc

a

bc

� f1 = a0b0c0+ a0b0c+ ab0c+ abc+ abc0

� f2 = a0b0c+ ab0c

Page 29: SYNTHESIS - gatech.edu

De�nitions

c GDM

� Prime implicant:

{ Implicant not contained by any other

implicant.

� Prime cover:

{ Cover of prime implicants.

� Essential prime implicant:

{ There exist some minterm covered only

by that prime implicant.

Page 30: SYNTHESIS - gatech.edu

Logic minimization

c GDM

� Exact methods:

{ Compute minimum cover.

{ Often impossible for large functions.

{ Based on Quine McCluskey method.

� Heuristic methods:

{ Compute minimal covers

(possibly minimum).

{ Large variety of methods and programs:

� MINI, PRESTO, ESPRESSO.

Page 31: SYNTHESIS - gatech.edu

Exact logic minimization

c GDM

� Quine's theorem:

{ There is a minimum cover that is prime.

� Consequence:

{ Search for minimum cover can be

restricted to prime implicants.

� Quine McCluskey method:

{ Compute prime implicants.

{ Determine minimum cover.

Page 32: SYNTHESIS - gatech.edu

Prime implicant table

c GDM

� Rows: minterms.

� Columns: prime implicants.

� Exponential size:

{ 2n minterms.

{ Up to 3n=n prime implicants.

� Remark:

{ Some functions have much fewer primes.

{ Minterms can be grouped together.

Page 33: SYNTHESIS - gatech.edu

Example

c GDM

� Function: f = a0b0c0+a0b0c+ab0c+abc+abc0

� Primes:

� 00* 1� *01 1 1*1 1Æ 11* 1

� Implicant table:

� � Æ000 1 0 0 0001 1 1 0 0101 0 1 1 0111 0 0 1 1110 0 0 0 1

Page 34: SYNTHESIS - gatech.edu

Example

c GDM

a

bc

(b)

α

β

δ

111

110

000

001101

(a)

α

βγ

δ

000

001

101

111

110 α

βγ

δ

000

001

101

111

110

(c)

Page 35: SYNTHESIS - gatech.edu

Minimum cover

early methods

c GDM

� Reduce table:

{ Iteratively identify essentials,

save them in the cover,

remove covered minterms.

� Petrick's method.

{ Write covering clauses in pos form.

{ Multiply out pos form into sop form.

{ Select cube of minimum size.

{ Remark:

� Multiplying out clauses is exponential.

Page 36: SYNTHESIS - gatech.edu

Example

Petrick's method

c GDM

� pos clauses:

{ (�)(�+ �)(�+ )( + Æ)(Æ) = 1

� sop form:

{ ��Æ+ � Æ = 1

� Solutions:

{ f�; �; Æg

{ f�; ; Æg

Page 37: SYNTHESIS - gatech.edu

Matrix representation

c GDM

� View table as Boolean matrix: A.

� Selection Boolean vector for primes: x.

� Determine x such that:

{ A x � 1.

{ Select enough columns to cover all rows.

� Minimize cardinality of x:

{ Example: x= [1101]T

Page 38: SYNTHESIS - gatech.edu

Example

c GDM

26666664

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

37777775

26664

1101

37775 =

26666664

12111

37777775

Page 39: SYNTHESIS - gatech.edu

Covering problem

c GDM

� Set covering problem:

{ A set S. (Minterm set).

{ A collection C of subsets. (Implicant set).

{ Select fewest elements of C to cover S.

� Intractable.

� Exact method:

{ Branch and bound algorithm.

� Heuristic methods.

Page 40: SYNTHESIS - gatech.edu

Example

edge-cover of a hypergraph

c GDM

2

d

4

6

1

1 2

5 3

a

b

c

e

d

4

6

1

1 2

5 3

a

b

(a) (b)

Page 41: SYNTHESIS - gatech.edu

Branch and bound algorithm

c GDM

� Tree search of the solution space:

{ Potentially exponential search.

� Use bounding function:

{ If the lower bound on the solution cost

that can be derived from a set of future

choices exceeds the cost of the best

solution seen so far:

{ Kill the search.

� Good pruning may reduce run-time.

Page 42: SYNTHESIS - gatech.edu

Branch and bound algorithm

c GDM

BRANCH AND BOUND fCurrent best = anything;Current cost=1;S = s0;while (S 6= ;) do f

Select an element in s 2 S;Remove s from S ;Make a branching decision based on s

yielding sequences fsi; i = 1;2; : : : ;mg;for ( i= 1 to m) f

Compute the lower bound bi of si;if (bi � Current cost)

Kill si;else f

if (si is a complete solution ) fCurrent best= si;Current cost= cost of si ;

gelse

Add si to set S;g

gg

g

Page 43: SYNTHESIS - gatech.edu

Example

c GDM

45 9 8

Bound = 6

r r

a ab b

(a) (b)

Killed subtree

x y w z zx y w

Page 44: SYNTHESIS - gatech.edu

Branch and bound algorithm for covering

Reduction strategies

c GDM

� Partitioning:

{ If A is block diagonal:

� Solve covering problem for corresponding

blocks.

� Essentials (EPI):

{ Column incident to

one (or more) row with single 1:

� Select column.

� Remove covered row(s) from table.

Page 45: SYNTHESIS - gatech.edu

Branch and bound algorithm for covering

Reduction strategies

c GDM

� Column (implicant) dominance:

{ If aki � akj 8k:

� remove column j.

� Row (minterm) dominance:

{ If aik � ajk 8k :

� Remove row i.

Page 46: SYNTHESIS - gatech.edu

Example

c GDM

2

d

4

6

1

1 2

5 3

a

b

c

e

d

4

6

1

1 2

5 3

a

b

(a) (b)

A =

26666664

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

37777775

Page 47: SYNTHESIS - gatech.edu

Example

reduction

c GDM

� Fourth column is essential.

� Fifth column is dominated.

� Fifth row is dominant.

� A =

264

1 0 11 1 0

0 1 1

375

Page 48: SYNTHESIS - gatech.edu

Branch and bound covering algorithm

c GDM

EXACT COV ER(A;x;b) f

Reduce matrix A and update corresponding x;

if (Current estimate � jbj) return(b);

if ( A has no rows ) return (x);

Select a branching column c;

xc = 1 ;fA = A after deleting c and rows incident to it;

ex= EXACT COV ER(fA;x;b);if ( jexj < jbj)

b = ex ;

xc = 0 ;fA = A after deleting c ;ex= EXACT COV ER(fA;x;b);if ( jexj < jbj)

b = ex ;

return (b);

g

Page 49: SYNTHESIS - gatech.edu

Bounding function

c GDM

� Estimate lower bound on the covers

derived from the current x.

� The sum of the ones in x, plus

bound on cover for local A:

{ Independent set of rows:

� No 1 in same column.

{ Build graph denoting pairwise independence.

{ Find clique number.

{ Approximation (lower) is acceptable.

Page 50: SYNTHESIS - gatech.edu

Example

c GDM

A =

26666664

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

37777775

� Row 4 independent from 1,2,3.

� Clique number is 2.

� Bound is 2.

1 2

3

4

5

Page 51: SYNTHESIS - gatech.edu

Example

c GDM

� A =

264

1 0 11 1 00 1 1

375

� There are no independent rows.

� Clique number is 1 (one vertex).

� Bound is 1 + 1 (already selected essential).

Page 52: SYNTHESIS - gatech.edu

Example

c GDM

� A =

264

1 0 11 1 00 1 1

375

� Choose �rst column:

{ Recur with fA= [11].

� Delete one dominated column.

� Take other column (essential).

{ New cost is 3.

� Exclude �rst column:

{ Find another solution with cost 3

(discarded).

Page 53: SYNTHESIS - gatech.edu

ESPRESSO-EXACT

c GDM

� Exact minimizer [Rudell].

� Exact branch and bound covering.

� Compact implicant table:

{ Group together minterms

covered by the same implicants.

� Very eÆcient. Solves most problems.

Page 54: SYNTHESIS - gatech.edu

Example

c GDM

a

bc

d

(a)

(b)

α

β

γ

δ

ε

ζ

0000

0010

0111

1101

1001

0110

1010

1011

0100

1000

0101

0000

0101

1001

1101

1000

10100010

0110

1011

0111

0100

0000

0101

1001

1101

1000

10100010

0110

1011

0111

0100

(c)

� 0**0 1� *0*0 1 01** 1Æ 10** 1� 1*01 1� *101 1

Page 55: SYNTHESIS - gatech.edu

Example

Prime implicant table

(after removing essentials)

c GDM

� � � �0000,0010 1 1 0 01101 0 0 1 1

Page 56: SYNTHESIS - gatech.edu

Recent developments

c GDM

� Many minimization problems can be solved

exactly today.

� Usually bottleneck is table size.

� Implicit representation of prime implicants:

{ Methods based on BDDs [COUDERT]:

� To represent sets.

� To do dominance simpli�cation.

{ Methods based on signature cubes [MCGEER]

� Represent set of primes.

Page 57: SYNTHESIS - gatech.edu

Summary

Exact two-level minimization of logic

functions

c GDM

� Based on derivatives of Quine-McCluskey

method.

� Many minimization problems can be now

solved exactly.

� Usual problems are memory size and time.

Page 58: SYNTHESIS - gatech.edu

Boolean relations

c GDM

� Generalization of Boolean functions.

� More than one output pattern may

correspond to an input pattern.

� Some degrees of freedom in �nding an

implementation:

{ More general than don't care conditions.

� Problem:

{ Given a Boolean relation,

�nd minimum cover of a compatible

function.

Page 59: SYNTHESIS - gatech.edu

Example

c GDM

ADDER

COMPARATOR

a a b b0 01 1

z z

x x x0

0

1

1

2

N

N1

2

� Compare:

{ a+ b > 4 ?

{ a+ b < 3 ?

Page 60: SYNTHESIS - gatech.edu

Example

c GDM

a1 a0 b1 b0 x

0 0 0 0 f 000, 001, 010 g0 0 0 1 f 000, 001, 010 g0 0 1 0 f 000, 001, 010 g0 1 0 0 f 000, 001, 010 g1 0 0 0 f 000, 001, 010 g0 1 0 1 f 000, 001, 010 g0 0 1 1 f 011, 100 g0 1 1 0 f 011, 100 g1 0 0 1 f 011, 100 g1 0 1 0 f 011, 100 g1 1 0 0 f 011, 100 g0 1 1 1 f 011, 100 g1 1 0 1 f 011, 100 g1 0 1 1 f 101, 110, 111 g1 1 1 0 f 101, 110, 111 g1 1 1 1 f 101, 110, 111 g

Page 61: SYNTHESIS - gatech.edu

Example (2)

Minimum implementation

c GDM

a1 a0 b1 b0 x

0 * 1 * 0101 * 0 * 0101 * 1 * 100� * * 1 001� 1 * * 001

� Remark:

{ Circuit is no longer an adder.

Page 62: SYNTHESIS - gatech.edu

Minimization of Boolean relations

c GDM

� Since there are many possible output values

there are many logic functions

implementing the relation.

{ Compatible functions.

� Find a function with minimum cardinality.

� Do not enumerate all possible functions:

{ May be too many.

� Represent the primes of all possible functions:

{ Compatible primes (c� primes).

Page 63: SYNTHESIS - gatech.edu

Minimization of Boolean relation

c GDM

� Exact:

{ Find a set of compatible primes.

{ Solve a binate covering problem.

� Consistency relations.

� Heuristic:

{ Iterative improvement [GYOCRO].

Page 64: SYNTHESIS - gatech.edu

Example

c GDM

� Boolean relation:

0 0 0 f 00 g0 0 1 f 00 g0 1 0 f 00 g0 1 1 f 10 g1 0 0 f 00 g1 0 1 f 01 g1 1 0 f 00,11 g1 1 1 f 00,11 g

� Compatible primes:

� 0 1 1 10� 1 0 1 01 1 1 0 11Æ 1 1 1 11� * 1 1 10� 1 * 1 01� 1 1 * 11

Page 65: SYNTHESIS - gatech.edu

Example

c GDM

� Input 011 { output 10.

{ Covering clause (�+ �).

� Input 111 { output 00 or 11.

{ No implicant { 00 { correct.

{ Either � or �[ � { output 11 { correct.

{ Only � or � is selected { output 10 or

01 { WRONG.

{ Covering clause �+ �� + �0�0 { binate.

� Overall covering clause:

(�+ �) � (�+ �) � (�+ �0+ �) � (�0+ � + �)

Page 66: SYNTHESIS - gatech.edu

Binate covering

c GDM

� Covering problem with binate clause.

� Implications:

{ The selection of a prime

may exclude other primes.

� No guarantee of �nding a feasible solution:

{ Inconsistent clauses.

� Minimum-cost satis�ability problem.

{ Much harder to solve than unate cover.

{ Branch and bound algorithm.

{ BDD-based methods.

Page 67: SYNTHESIS - gatech.edu

Summary

Boolean relations

c GDM

� Generalization of Boolean functions.

{ Many possible output patterns.

� Useful for modeling:

{ Cascaded blocks.

{ Portions of multiple-level networks.

� More degree of freedom in implementation.

� Harder problem to solve.