ABC: An Industrial-Strength Logic Synthesis and Verification Tool
ABC: An Industrial-Strength Logic Synthesis and Verification Tool
ABC: An Industrial-Strength Logic Synthesis and Verification Tool
Alan Mishchenko
2
Outline
Basic level
Boolean calculator and visualizer
Standard commands and scripts
Advanced level
Key packages and data-structures
Ways to improve runtime and memory usage
Future research directions
3
Boolean Calculator
Read/generate small functions/networks
Automatically extracted or manually specified
Compute basic functional properties
Symmetries, decomposability, unateness, etc
Transform them in various ways
Minimize SOP, reorder BDD, extract kernels, etc
Visualization
Use text output, dot / GSView, etc
4
Standard Commands/Scripts
Technology independent synthesis
Logic synthesis for PLAs
Technology mapping for standard cells
Technology mapping for LUTs
Sequential synthesis
Verification
5
Technology Independent Synthesis
AIG rewriting for area
Scripts drwsat, compress2rs
AIG rewriting for delay
Scripts dc2, resyn2
Scripts &syn2, &synch2
High-effort delay optimization
Perform SOP balancing (st; if –g –K 6)
Follow up with area-recovery (resyn2) and technology
mapping (map, amap, if)
Iterate, if needed
6
Logic Synthesis for PLAs
Enter PLA (.type fd) into ABC using read
Perform logic sharing extraction using fx
If fx is complaining that individual covers are not prime and
irredundant, try bdd; sop; fx
After fx, convert shared logic into AIG and continue AIG-
based synthesis and mapping if needed
Consider using high-effort synthesis with don’t-cares
First map into 6-LUTs (if –K 6; ps), optimize (mfs2), synthesize
with choices (st; dch) and map into 6-LUTs (if –K 6; ps)
Iterate until no improvement, then remap into target technology
9
Sequential Synthesis
Uses reachable state information to further
improve the quality of results
Reachable states are often approximated
Types of AIG-based sequential synthesis
Retiming (retime, dretime, etc)
Detecting and merging sequential equivalences
(lcorr, scorr, &scorr, etc)
Negative experiences
Sequential redundancy removal is often hard
Using sequential don’t-cares in combinational
synthesis typically gives a very small improvement
10
Verification
Combinational verification
r <file1>; cec <file2> (small/medium circuits)
&r <file1.aig>; &cec <file2.aig> (large circuits)
Sequential verification
r <file1>; dsec <file2>
Running cec or dsec any time in a synthesis flow
compares the current network against its spec
The spec is the circuit obtained from the original file
Verification and synthesis are closely related and
should be co-developed
11
Outline
Basic level
Boolean calculator and visualizer
Standard commands and scripts
Advanced level
Key packages and data-structures
Ways to improve runtime and memory usage
Future research directions
12
Key Packages
AIG package
Technology-independent synthesis
Technology mappers
SAT solver
Combinational equivalence checking
Sequential synthesis
Sequential verification engine IC3/PDR
13
Key Packages
AIG package
Technology-independent synthesis
Technology mappers
SAT solver
Combinational equivalence checking
Sequential synthesis
Sequential verification engine IC3/PDR
14
And-Inverter Graph (AIG)
AIG is a Boolean network composed of two-input ANDs and inverters
ab 00 01 11 10
cd F(a,b,c,d) = ab + d(a!c+bc)
00 0 0 1 0
6 nodes
01 0 0 1 1
a b d 4 levels
11 0 1 1 0
10 0 0 1 0
a c b c
ab 00 01 11 10
cd
F(a,b,c,d) = a!c(b+d) + bc(a+d)
00 0 0 1 0
01 0 0 1 1 7 nodes
11 0 1 1 0 3 levels
10 0 0 1 0 15
a c b d b c a d
Components of Efficient AIG Package
Structural hashing
Leads to a compact representation
Is applied during AIG construction c
Propagates constants
d
Makes each node structurally unique
Complemented edges
Represents inverters as attributes on the edges
Leads to fast, uniform manipulation a b
Does not use memory for inverters Without hashing
Increases logic sharing using DeMorgan’s rule
Memory allocation
Uses fixed amount of memory for each node
Can be done by a custom memory manager
Even dynamic fanout can be implemented this way c d
Allocates memory for nodes in a topological order
Optimized for traversal using this topological order
Small static memory footprint for many applications
Computes fanout information on demand a b
With hashing 16
“Minimalistic” AIG Package
Designed to minimize memory requirements
Baseline: 8 bytes/node for AIGs (works up to 2 billion nodes)
Structural hashing: +8 bytes/node
Logic level information: +4 bytes/node
Simulation information: +8 bytes/node for 64 patterns
18
SAT Solver
Modern SAT solvers are practical
A modern solver is a treasure-trove of tricks for
efficient implementation
To mentions just a few
Representing clauses as arrays of integers
Using signatures to check clause containment
Using two-literal watching scheme
etc
19
What is Missing in a SAT Solver?
(from the point of view of logic synthesis)
Modern SAT solvers are geared to solving hard problems from SAT
competitions or hard verification instances (1 problem ~ 15 min)
This motivates elaborate data-structures and high memory usage
64 bytes/variable; 16 bytes/clause; 4 bytes/literal
21
Why MiniSAT Is Slower?
Requires multiple intermediate steps
Window AIG CNF Solving
Instead of Window Solving
Generates counter examples in the form of
Complete assignment of primary inputs
Instead of Partial assignment of primary inputs
Uses too much memory
Solver + CNF = 140 bytes / AIG node
Instead of 8-16 bytes / AIG node
Decision heuristics
Is not aware of the circuit structure
Instead of Using circuit information
22
General Guidelines for Improving
Speed and Memory Usage
Minimize memory usage
Use integers instead of pointers
Recycle memory whenever possible
especially if memory is split into chunks of the same size
Use book-keeping to avoid useless computation
Windowing, local fanout, event-driven simulation
If application is important, design custom
specialized data-structures
Typically the overhead to covert to the custom data-
structure is negligible, compared to the runtime saved
by using it 23
Outline
Basic level
Boolean calculator and visualizer
Standard commands and scripts
Advanced level
Key packages and data-structures
Ways to improve runtime and memory usage
Future research directions
24
Research Directions
Ongoing
Deep integration of simulation and SAT
Word-level optimizations (e.g. memory abstraction)
Logic synthesis for machine learning
As opposed to machine learning for logic synthesis!
Near future
Delay-oriented word-level to AIG transformation
Fast (SAT-based) placement (and routing)
Hopefully, some day
Improved Verilog interface
25
Conclusions
If you have patience and time to figure it out,
ABC can be very useful
26
Contributors to ABC
Fabio Somenzi (U Colorado, Boulder) - BDD package CUDD
Niklas Sorensson, Niklas Een (Chalmers U, Sweden) - MiniSAT v. 1.4 (2005)
Gilles Audemard, Laurent Simon (U Artois, U Paris Sud, France) - Glucose 3.0
29