logic synthesis: past and future alan mishchenko uc berkeley

32
Logic Synthesis: Past Logic Synthesis: Past and Future and Future Alan Mishchenko Alan Mishchenko UC Berkeley UC Berkeley

Upload: dylan-newton

Post on 13-Dec-2015

245 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

Logic Synthesis: Past and FutureLogic Synthesis: Past and Future

Alan MishchenkoAlan Mishchenko

UC BerkeleyUC Berkeley

Page 2: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

22

OverviewOverview

(1) (1) ProblemProblemss inin logic synthesis logic synthesisRepresentations and computationsRepresentations and computations

(2) And-Inverter Graphs (AIGs)(2) And-Inverter Graphs (AIGs)The foundation of innovative synthesisThe foundation of innovative synthesis

(3) (3) AIG-basedAIG-based solutions in ABC solutions in ABCSynthesis, mapping, verificationSynthesis, mapping, verification

Page 3: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

33

(1) (1) ProblemProblemss InIn SSynthesisynthesis

What are the objects to be “synthesized”?What are the objects to be “synthesized”? Logic structuresLogic structures Boolean functions (with or without don’t-cares)Boolean functions (with or without don’t-cares) State machines, relations, sets, etcState machines, relations, sets, etc

How to represent them efficiently?How to represent them efficiently? Depends on the task to be solvedDepends on the task to be solved Depends on the size of an objectDepends on the size of an object

How to create, transform, minimize the representations?How to create, transform, minimize the representations? Multi-level logic synthesis Multi-level logic synthesis Technology mappingTechnology mapping

How to verify the correctness of the design?How to verify the correctness of the design? Gate-level equivalence checkingGate-level equivalence checking Property checking Property checking etcetc

Page 4: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

44

TerminologyTerminology

Logic function Logic function (e.g. (e.g. F = ab+cdF = ab+cd)) Variables (e.g. Variables (e.g. bb)) Minterms (e.g. Minterms (e.g. abcdabcd)) Cube (e.g. Cube (e.g. abab))

Logic networkLogic network Primary inputs/outputsPrimary inputs/outputs Logic nodesLogic nodes Fanins/fanoutsFanins/fanouts Transitive fanin/fanout coneTransitive fanin/fanout cone Cut and window (defined later)Cut and window (defined later) Primary inputsPrimary inputs

Primary outputsPrimary outputs

FaninsFanins

FanoutsFanoutsTFOTFO

TFITFI

Page 5: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

55

Logic (Boolean) FunctionLogic (Boolean) Function

Completely specified Completely specified logic functionlogic function

Incompletely specified Incompletely specified logic functionlogic function

0000 0101 1111 1010

0000 00 00 11 00

0101 00 00 11 00

1111 11 11 11 11

1010 00 00 11 00

0000 0101 1111 1010

0000 00 00 11 00

0101 00

1111 11 11 11

1010 00 00 11 00

0000 0101 1111 1010

0000 00 00 11 00

0101 00 00 00 00

1111 11 11 11 00

1010 00 00 11 00

0000 0101 1111 1010

0000 11 11 00 11

0101 11 00 00 00

1111 00 00 00 00

1010 11 11 00 11

0000 0101 1111 1010

0000 00 00 00 00

0101 00 11 11 11

1111 00 00 00 11

1010 00 00 00 00

On-set Off-set DC-set

abab

cdcd

cdcd

abab

Page 6: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

66

RelationsRelations

Relation (a1,a2) Relation (a1,a2) (b1,b2) (b1,b2) (0,0) (0,0) (0,0) (0,0) (0,1) (0,1) (1,0)(0,1) (1,0)(0,1) (1,0) (1,0) (1,1) (1,1) (1,1) (1,1) (1,0) (1,0)

FSMFSM

0000 0101 1111 1010

0000 11 00 00 00

0101 00 11 00 00

1111 00 00 00 11

1010 00 11 11 00

0000 0101 1111 1010

0000 11 11 00

0101 11 11 11

1111

1010 11 00 00

a1 a2a1 a2

b1 b2b1 b2

01010000

1010

Current Current statestate

Next Next statestate

Characteristic function

Page 7: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

77

Representation of Boolean Representation of Boolean FunctionsFunctions

Find each of these representations?Find each of these representations? Truth table (TT)Truth table (TT) Sum-of-products (SOP)Sum-of-products (SOP) Product-of-sums (POS)Product-of-sums (POS) Binary decision diagram (BDD)Binary decision diagram (BDD) And-inverter graph (AIG)And-inverter graph (AIG) Logic network (LN)Logic network (LN)

abcdabcd FF

00000000 00

00010001 00

00100010 00

00110011 11

01000100 00

01010101 00

01100110 00

01110111 11

10001000 00

10011001 00

10101010 00

10111011 11

11001100 11

11011101 11

11101110 11

11111111 11

F = ab+cdF = ab+cd

F = (a+c)(a+d)(b+c)(b+d)F = (a+c)(a+d)(b+c)(b+d)

1100

aa

bb

cc

dd

FFaa bb cc dd

FF

aa bb cc dd

FF

abab

x+cdx+cd

Page 8: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

88

Representation OverviewRepresentation Overview TT are the natural representation of logic functionsTT are the natural representation of logic functions

Not practical for large functionsNot practical for large functions Still good for functions up to 16 variablesStill good for functions up to 16 variables

SOP is widely used in synthesis tools since 1980’sSOP is widely used in synthesis tools since 1980’s More compact than TT, but not canonicalMore compact than TT, but not canonical Can be efficiently minimized (SOP minimization by Espresso, ISOP Can be efficiently minimized (SOP minimization by Espresso, ISOP

computation) and translated into multi-level forms (algebraic factoring)computation) and translated into multi-level forms (algebraic factoring) BDD is a useful representation discovered around 1986BDD is a useful representation discovered around 1986

Canonical (for a given function, there is only one BDD)Canonical (for a given function, there is only one BDD) Very good, but only if (a) it can be constructed, (b) it is not too largeVery good, but only if (a) it can be constructed, (b) it is not too large Unreliable (non-robust) for many industrial circuitsUnreliable (non-robust) for many industrial circuits

AIG is an up-and-coming representation!AIG is an up-and-coming representation! Compact, easy to construct, can be made “canonical” using a SAT solverCompact, easy to construct, can be made “canonical” using a SAT solver Unifies the synthesis/mapping/verification flowUnifies the synthesis/mapping/verification flow The main reason to give this talk The main reason to give this talk

Page 9: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

99

Problem Size

Time1950-1970 1980 1990 2000

CNFTT

SOP BDD

Historical PerspectiveHistorical Perspective

AIG16

50

100

100000

Espresso, MIS, SIS

SIS, VIS, MVSIS

ABC

Page 10: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1010

What Representation to Use?What Representation to Use? For small functions (up to 16 inputs)For small functions (up to 16 inputs)

TT works the best (local transforms, decomposition, factoring, etc)TT works the best (local transforms, decomposition, factoring, etc) For medium-sized functions (16-100 inputs)For medium-sized functions (16-100 inputs)

In some cases, BDDs are still used (reachability analysis)In some cases, BDDs are still used (reachability analysis) Typically, it is better to represent as AIGsTypically, it is better to represent as AIGs

Translate AIG into CNF and use SAT solver for logic manipulationTranslate AIG into CNF and use SAT solver for logic manipulation Interpolate or enumerate SAT assignmentsInterpolate or enumerate SAT assignments

For large industrial circuits (>100 inputs, >10,000 gates)For large industrial circuits (>100 inputs, >10,000 gates) Traditional LN representation is not efficientTraditional LN representation is not efficient AIGs work remarkably wellAIGs work remarkably well

Lead to efficient synthesis Lead to efficient synthesis Are a natural representation for technology mappingAre a natural representation for technology mapping Easy to translate into CNF for SAT solvingEasy to translate into CNF for SAT solving etcetc

Page 11: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1111

What are Typical Transformations?What are Typical Transformations?

Typical transformations of representationsTypical transformations of representations For SOP, minimize cubes/literalsFor SOP, minimize cubes/literals For BDD, minimize nodes/widthFor BDD, minimize nodes/width For AIG, restructure, minimize nodes/levelsFor AIG, restructure, minimize nodes/levels For LN, restructure, minimize area/delayFor LN, restructure, minimize area/delay

Page 12: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1212

Algorithmic ParadigmsAlgorithmic Paradigms

Divide-and-conquerDivide-and-conquer Traversal, windowing, cut computationTraversal, windowing, cut computation

GGuess-and-check uess-and-check BBit-wise simulationit-wise simulation

RReason-and-proveeason-and-prove Boolean satisfiabilityBoolean satisfiability

Page 13: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1313

TraversalTraversal TraversalTraversal is visiting nodes in is visiting nodes in

the network in some orderthe network in some order

Topological orderTopological order visits visits nodes from PIs to POsnodes from PIs to POs Each node is visited after its Each node is visited after its

fanins are visitedfanins are visited

Reverse topological orderReverse topological order visits visits nodes from POs to PIsnodes from POs to PIs Each node is visited after its Each node is visited after its

fanouts are visitedfanouts are visited Primary inputsPrimary inputs

Primary outputsPrimary outputs

Traversal in a topological orderTraversal in a topological order

44

11

33

88

77

55

6622

Page 14: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1414

WindowingWindowing

DefinitionDefinition A A windowwindow for a node is the for a node is the

node’s context, in which an node’s context, in which an operation is performedoperation is performed

A window includes A window includes k k levels of the TFI levels of the TFI mm levels of the TFOlevels of the TFO all re-convergent paths all re-convergent paths

between window PIs and between window PIs and window POswindow POs

Window POs

Window PIs

k = 3

m = 3

Pivot node

Page 15: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1515

Structural Cuts in AIGStructural Cuts in AIG

A cut of a node n is a set of nodes in transitive fan-in

such thatevery path from the node to PIs is blocked by nodes in the cut.

A k-feasible cut means the size of the cut must be k or less.

a b c

p q

n

The set {p, b, c} is a 3-feasible cut of node n. (It is also a 4-feasible cut.)

k-feasible cuts are important in FPGA mapping because the logic between root n and the cut nodes {p, b, c} can be replaced by a k-LUT

Page 16: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1616

Cut ComputationCut Computation

a b c

p q

{ {p}, {a, b} } { {q}, {b, c} }

{ {a} } { {b} } { {c} }

n

{ {n}, {p, q}, {p, b, c}, {a, b, q}, {a, b, c} }

The set of cuts of a node is a ‘cross product’ of the sets of cuts of its children.

Any cut that is of size greater than k is discarded.

Computation is done bottom-up

(P. Pan et al, FPGA ’98; J. Cong et al, FPGA ’99)

kk Cuts per Cuts per nodenode

44 66

55 2020

66 8080

77 150150

Page 17: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1717

Bitwise SimulationBitwise Simulation Assign particular (or random) Assign particular (or random)

values at the primary inputsvalues at the primary inputs Multiple simulation patterns are Multiple simulation patterns are

packed into 32- or 64-bit stringspacked into 32- or 64-bit strings Perform bitwise simulation at Perform bitwise simulation at

each node each node Nodes are ordered in a Nodes are ordered in a

topological ordertopological order

Works well for AIG due to Works well for AIG due to The uniformity of AND-nodesThe uniformity of AND-nodes Speed of bitwise simulationSpeed of bitwise simulation Topological ordering of memory Topological ordering of memory

used for simulation informationused for simulation information

aa bb cc dd

FF

00

11

11

11

11

00

00

11

00

00

11

00

11

00

11

11

00

00

11

00

00

00

00

11

00

00

11

11

11

22

33

44

11

22

33

44

11

22

33

44

11

22

33

44

Page 18: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1818

Boolean SatisfiabilityBoolean Satisfiability

Given a CNF formula Given a CNF formula (x)(x), , satisfiability problemsatisfiability problem is is to prove that to prove that (x) (x) 0 0, or to find a counter-, or to find a counter-example example x’x’ such that such that (x’) (x’) 1 1

Why this problem arises?Why this problem arises? If CNF were a canonical representation (like BDD), it would be If CNF were a canonical representation (like BDD), it would be

trivial to answer this question.trivial to answer this question. But CNF is not canonical. Moreover, CNF can be very But CNF is not canonical. Moreover, CNF can be very

redundant, so that a large formula is, in fact, equivalent to 0.redundant, so that a large formula is, in fact, equivalent to 0. Looking for a satisfying assignment can be similar to searching Looking for a satisfying assignment can be similar to searching

for a needle in the hay-stack.for a needle in the hay-stack. The problem may be even harder, if there is no needle there!The problem may be even harder, if there is no needle there!

Page 19: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

1919

Example (Deriving CNF)Example (Deriving CNF)

(a + b + c)

(a + b + c’)

(a’ + b + c’)

(a + c + d)

(a’ + c + d)

(a’ + c + d’)

(b’ + c’ + d’)

(b’ + c’ + d)

0000 0101 1111 1010

0000 00 00 00 000101 00 11 00 001111 00 00 00 001010 00 00 00 00

ab

cd

Cube: bcd’

Clause: b’ + c’ + d

CNF

Page 20: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2020

SAT SolverSAT Solver

The best SAT solver is MiniSAT The best SAT solver is MiniSAT (http://minisat.se/) (http://minisat.se/) Efficient (won many competitions)Efficient (won many competitions) Simple (600 lines of code)Simple (600 lines of code) Easy to modify and extendEasy to modify and extend Integrated into ABCIntegrated into ABC

SAT solver typesSAT solver types CNF-based, circuit-basedCNF-based, circuit-based Complete, incompleteComplete, incomplete DPLL, saturation, etc.DPLL, saturation, etc.

A lot of magic is used to build an A lot of magic is used to build an efficient SAT solverefficient SAT solver Two literal clause watchingTwo literal clause watching Conflict analysis with clause Conflict analysis with clause

recording recording Non-chronological backtrackingNon-chronological backtracking Variable ordering heuristics Variable ordering heuristics Random restarts, etcRandom restarts, etc

Applications in EDAApplications in EDA VerificationVerification

Equivalence checkingEquivalence checking Model checkingModel checking

SynthesisSynthesis Circuit restructuringCircuit restructuring DecompositionDecomposition False path analysisFalse path analysis

RoutingRouting

Page 21: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2121

(2) And-Inverter Graphs (AIG)(2) And-Inverter Graphs (AIG)

DDefinition and examplesefinition and examples Several simple tricks that make AIGs workSeveral simple tricks that make AIGs work SSequential AIGsequential AIGs Unifying representationUnifying representation A typical synthesis application: AIG rewritingA typical synthesis application: AIG rewriting

Page 22: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2222

AIG DAIG Definition and efinition and EExamplesxamples

cdcdabab 0000 0101 1111 1010

0000 00 00 11 00

0101 00 00 11 11

1111 00 11 11 00

1010 00 00 11 00

F(a,b,c,d) = ab + d(ac’+bc)

F(a,b,c,d) = ac’(b’d’)’ + c(a’d’)’ = ac’(b+d) + bc(a+d)

cdcdabab 0000 0101 1111 1010

0000 00 00 11 00

0101 00 00 11 11

1111 00 11 11 00

1010 00 00 11 00

6 nodes

4 levels

7 nodes

3 levels

b ca c

a b d

a c b d b c a d

AIG is a Boolean network composed of two-input ANDs and inverters.AIG is a Boolean network composed of two-input ANDs and inverters.

Page 23: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2323

Three Simple TricksThree Simple Tricks Structural hashingStructural hashing

Makes sure AIG is stored in a compact formMakes sure AIG is stored in a compact form Is applied during AIG constructionIs applied during AIG construction

Propagates constantsPropagates constants Makes each node structurally uniqueMakes each node structurally unique

Complemented edgesComplemented edges Represents inverters as attributes on the edgesRepresents inverters as attributes on the edges

Leads to fast, uniform manipulationLeads to fast, uniform manipulation Does not use memory for invertersDoes not use memory for inverters Increases logic sharing using DeMorgan’s rule Increases logic sharing using DeMorgan’s rule

Memory allocationMemory allocation Uses fixed amount of memory for each nodeUses fixed amount of memory for each node

Can be done by a simple custom memory managerCan be done by a simple custom memory manager Even dynamic fanout manipulation is supported!Even dynamic fanout manipulation is supported!

Allocates memory for nodes in a topological orderAllocates memory for nodes in a topological order Optimized for traversal in the same topological orderOptimized for traversal in the same topological order Small static memory footprint for many applicationsSmall static memory footprint for many applications

Computes fanout information on demandComputes fanout information on demand

a b

c d

a b

c d

Without hashingWithout hashing

With hashingWith hashing

Page 24: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2424

AIG: A Unifying RepresentationAIG: A Unifying Representation

An underlying data structure for various computationsAn underlying data structure for various computations Rewriting, resubstitution, simulation, SAT sweeping, Rewriting, resubstitution, simulation, SAT sweeping,

induction, etc are based on the same AIG managerinduction, etc are based on the same AIG manager

A unifying representation for the whole flowA unifying representation for the whole flow Synthesis, mapping, verification use the same data-structureSynthesis, mapping, verification use the same data-structure Allows multiple structures to be stored and used for mappingAllows multiple structures to be stored and used for mapping

The main functional representation in ABCThe main functional representation in ABC A foundation of new logic synthesis A foundation of new logic synthesis

Page 25: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2525

(3) (3) AIG-AIG-BBased ased Solutions in ABCSolutions in ABC

SynthesisSynthesisMappingMappingVerificationVerification

Page 26: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2626

Place of ABC in Design FlowPlace of ABC in Design Flow

System Specification

RTLRTL

Logic synthesisLogic synthesis

Technology mappingTechnology mapping

Physical synthesisPhysical synthesis

Manufacturing

ABC Verification

Verification

Page 27: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2727

ABC vs. Other ToolsABC vs. Other Tools

Industrial Industrial + well documented, fewer bugs+ well documented, fewer bugs- black-box, push-button, no source code, often expensive- black-box, push-button, no source code, often expensive

SIS SIS + traditionally very popular+ traditionally very popular- data structures / algorithms outdated, weak sequential synthesis- data structures / algorithms outdated, weak sequential synthesis

VIS VIS + very good implementation of BDD-based verification algorithms+ very good implementation of BDD-based verification algorithms- not meant for logic synthesis, does not feature the latest SAT-based - not meant for logic synthesis, does not feature the latest SAT-based

implementationsimplementations MVSIS MVSIS

+ allows for multi-valued and finite-automata manipulation+ allows for multi-valued and finite-automata manipulation- not meant for binary synthesis, lacking recent implementations- not meant for binary synthesis, lacking recent implementations

Page 28: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2828

AIG-Based Solutions (Synthesis)AIG-Based Solutions (Synthesis) Restructures AIG or logic network by the following transformsRestructures AIG or logic network by the following transforms

Algebraic balancingAlgebraic balancing Rewriting/refactoring/redecompositionRewriting/refactoring/redecomposition ResubstitutionResubstitution Minimization with don't-cares, etcMinimization with don't-cares, etc

SynthesisSynthesis

D2D2D1D1

Synthesis with choicesSynthesis with choices

D3D3HAIGHAIG

D2D2D1D1 D3D3 D4D4

D4D4

Page 29: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

2929

AIG-Based Solutions (Mapping)AIG-Based Solutions (Mapping)Input: A Boolean network (And-Inverter Graph)

Output: A netlist of K-LUTs implementing AIG and optimizing some cost function

The subject graph The mapped netlist

TechnologyMapping

a b c d

f

e a b c d e

f

Page 30: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

3030

Formal VerificationFormal Verification Equivalence checkingEquivalence checking

Takes two designs and Takes two designs and makes a miter (AIG)makes a miter (AIG)

Model checkingModel checking Takes design and Takes design and

property and makes a property and makes a miter (AIG)miter (AIG)

The goals are the same: The goals are the same: to transform AIG until to transform AIG until the output is proved the output is proved constant 0constant 0

D2D2D1D1

Equivalence checkingEquivalence checking

0

D1D1

Property checkingProperty checking

0

pp

Page 31: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

3131

SummarySummary

Introduced pIntroduced problemroblemss inin logic synthesis logic synthesisRepresentations and computationsRepresentations and computations

Described And-Inverter Graphs (AIGs)Described And-Inverter Graphs (AIGs)The foundation of modern synthesis/verificationThe foundation of modern synthesis/verification

Overviewed Overviewed AIG-basedAIG-based solutions in ABC solutions in ABCSynthesis, mapping, equivalence checkingSynthesis, mapping, equivalence checking

Page 32: Logic Synthesis: Past and Future Alan Mishchenko UC Berkeley

3232

ABC Resources ABC Resources

TutorialTutorial R. Brayton and A. Mishchenko, "ABC: An academic R. Brayton and A. Mishchenko, "ABC: An academic

industrial-strength verification tool", Proc. CAV'10, industrial-strength verification tool", Proc. CAV'10, Springer, LNCS 6174, pp. 24-40.Springer, LNCS 6174, pp. 24-40.

http://www.eecs.berkeley.edu/~alanmi/http://www.eecs.berkeley.edu/~alanmi/publications/2010/cav10_abc.pdfpublications/2010/cav10_abc.pdf

Windows binaryWindows binary http://www.eecs.berkeley.edu/~alanmi/abc/abc.exehttp://www.eecs.berkeley.edu/~alanmi/abc/abc.exe http://www.eecs.berkeley.edu/~alanmi/abc/abc.rchttp://www.eecs.berkeley.edu/~alanmi/abc/abc.rc

Complete source code Complete source code https://bitbucket.org/alanmi/abc/downloadshttps://bitbucket.org/alanmi/abc/downloads