0% found this document useful (0 votes)
57 views13 pages

AIG Simplification Techniques Overview

The document discusses techniques for simplifying And-Inverter Graphs (AIGs) using methods such as structural hashing, FRAIG, and AIG balancing. It outlines the process of merging nodes representing the same or complemented functions, and the importance of balancing AIGs to minimize delay. Additionally, it covers AIG rewriting and resubstitution to optimize the structure while preserving functionality.

Uploaded by

shwetank7744
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views13 pages

AIG Simplification Techniques Overview

The document discusses techniques for simplifying And-Inverter Graphs (AIGs) using methods such as structural hashing, FRAIG, and AIG balancing. It outlines the process of merging nodes representing the same or complemented functions, and the importance of balancing AIGs to minimize delay. Additionally, it covers AIG rewriting and resubstitution to optimize the structure while preserving functionality.

Uploaded by

shwetank7744
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

03-02-2025

AIG

And-Inverter Graph

1
03-02-2025

Simplifying AIGs: Few Rewrite Rules

Simplifying AIGs: Structural Hashing


r = p.c ; s = p.c

• Before creating a new node with inputs (i1, i2), check if


hash table has entry with key (i1, i2) or (i2, i1)
• Alternatively, impose ordering on nodes, check for (min(i1, i2),
max(i1, i2))
• If yes, use value from hash table
• Else, create new node with inputs (i1, i2) and make a new entry in
hash table

2
03-02-2025

Beyond Strash and Rewrite


Even after using strash and rewrite, AIG may contain nodes representing the same or complemented function

𝑝 =𝑎⊕𝑏

𝑞 = (𝑎 ⊕ 𝑏)′

Strash does not help here!

Solution: Check if (𝑝 ⟷ 𝑞) or (𝑝 ⟷ 𝑞′) is a tautology (SAT solving!)


If yes, merge nodes & use bubbles appropriately on outgoing edges

Simplifying AIGs: FRAIG


Functionally Reduced AIG (FRAIG)
No two nodes represent the same or complemented function (Similar to ROBDD)

FRAIG Overview
For every pair (𝑢, 𝑣) of nodes (including constant node 1) Fraiging ≠ Canonicalization
If (𝑢 ⟷ 𝑣) is a tautology, merge nodes 𝑢 and 𝑣 in AIG
If (𝑢 ⟷ 𝑣′) is a tautology, merge nodes 𝑢 and 𝑣 in AIG, and use bubbles appropriately on outgoing edges
Use simplification rules and structural hashing all throughout

3
03-02-2025

Simplifying AIGs: fraig, strash, rewrite

rewrite

strash

rewrite

FRAIG Construction

Example Circuit Sub-Graph for x

Sub-Graph for y

4
03-02-2025

FRAIG Construction: Random Simulation

C1 = {1,4,7,8}
C2 = {0,2,3,5,6}

FRAIG Construction: Random Simulation

C1 = {1,4,7,8}
C2 = {0,2,3,5,6}

C11 = {1,4}
C12 = {7,8}
C21 = {0}
C22 = {2,3,5,6}

5
03-02-2025

FRAIG Construction: Random Simulation


C1 = {1,4,7,8}
C2 = {0,2,3,5,6}

C11 = {1,4}
C12 = {7,8}
C21 = {0}
C22 = {2,3,5,6}

C11 = {1,4}
C12 = {7,8}
C21 = {0}
C221 = {3,5}
C222 = {2,6}

FRAIG Construction: Random Simulation


C1 = {1,4,7,8}
C2 = {0,2,3,5,6}

C11 = {1,4}
C12 = {7,8}
C21 = {0}
C22 = {2,3,5,6}

C11 = {1,4}
C12 = {7,8}
C21 = {0}
C221 = {3,5}
C222 = {2,6}

C111 = {1}
C112 = {4}
C12 = {7,8}
C21 = {0}
C221 = {3,5}
C222 = {2,6}

6
03-02-2025

FRAIG Construction

C12 = {7,8}
C221 = {3,5}
C222 = {2,6}

FRAIG Construction: Equivalence Checking

C12 = {7,8}
C221 = {3,5}
C222 = {2,6}

3≡5

After merging 3 and 5

7
03-02-2025

FRAIG Construction: Equivalence Checking

C12 = {7,8}
C221 = {3,5}
C222 = {2,6}

2≡6

After merging 2 and 6

Q. Is 7 ≡ 8?
A. Yes, by structural hashing

AIG Balancing
And balancing: performed in two steps – covering and tree balancing

Covering: identifies large multi-input ANDs in the AIG by grouping together two-input ANDs
• have no complemented attributes in between and no external fanout, except possibly at the
root node of each multi-input AND.

8
03-02-2025

AIG Balancing
And balancing: performed in two steps – covering and tree balancing
Tree balancing: decomposes each multi-input AND into two-input ANDs while trying to reduce the
total number of AIG levels.
• tree-balancing step is not unique and depends on the grouping of the inputs with equal delay.

Covering Tree-balancing

Delay = 4 Delay = 3

Implemented in ABC as command balance

AIG Balancing
SOP balancing of a small* AIG:
• Convert into an SOP.
• AND-balancing can be applied to each product and the sum.
• The products and the sum are treated as multi-input ANDs and decomposed to minimize the delay of the output node

Q. Can AND balancing reduce the delay


for this example?
SOP-balancing can reduce delay
when AND-balancing cannot

Q. How SOP balancing can be performed on a large AIG?

* an AIG is considered small if it depends on roughly 10 or less inputs

9
03-02-2025

Cut of an AIG Node


Definition: A cut C of node n is a set of nodes in the network (aka leaves), such that
each path from a primary input to n passes through at least one leaf.
• Node n is called root of the cut.
• The cut size is the number of its leaves. K-feasible cut has the number of leaves ≤ K
• A cut C is said to be dominated if there is another cut 𝐶′ of the same node such that 𝐶′ ⊆ 𝐶.
• Vol(C) = Total number of nodes encountered on all paths between node n and the cut leaves.

f
Q. How to find all cuts for a node?

Enumerating of all K-feasible cuts of a node


Let A and B be two sets of cuts.
𝐴 ⋈ 𝐵 = {𝑢⋃𝑣|𝑢 ∈ 𝐴, 𝑣 ∈ 𝐵, |𝑢⋃𝑣| ≤ 𝐾

Let Φ(𝑛) denote the set of 𝐾 feasible cuts of node 𝑛.


If 𝑛 is a and node with 𝑛 and 𝑛 as fanins, then,
{ 𝑛 }, 𝑛 ∈ 𝑃𝐼
Φ 𝑛 =
{ 𝑛 } ∪ Φ 𝑛 ⋈ Φ 𝑛 , 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒

a b c d e

SOP Balancing of a Large AIG


• It is impossible to apply SOP balancing to a large AIG.
• Break large AIG into parts.
• SOP-balancing for each part, and if the delay is improved, locally update the large AIG with the
structure derived by SOP-balancing.

10
03-02-2025

Classification of -input Boolean Function


NPN equivalence: Two Boolean functions, 𝐹 and 𝐺, belong to the same NPN-class (aka NPN equivalent) if
𝐹 can be derived from 𝐺 by negating (N) and permuting (P) inputs and negating (N) the output.

NPN classes of 2-inputs Boolean functions

All 2-inputs Boolean functions

AIG Rewriting
• Rewriting is a fast greedy algorithm
• Minimizing the AIG size by iteratively selecting AIG subgraphs rooted at a node and replacing them
with smaller pre-computed subgraphs
• Preserving the functionality of the root node.

w’(z+y)(x+y) w’(xz+y)

w’(z+y) (xz)’.y’
x’.y’ z’.y’
xz

y z y z

x w w x

11
03-02-2025

AIG Rewriting

Different AIG structures for function 𝐹 = 𝑎𝑏𝑐

Two cases of AIG rewriting of a node

Resubstitution
Resubstitution expresses one function in terms of other functions.
• Given 𝑓(𝑥) and 𝑔 𝑥 , 𝑔 𝑥 , … , 𝑔 𝑥 , is it possible to express 𝑓
in terms of a subset of 𝑔 ’s?
• If so, what is function 𝑓(𝑔)?

A maximum fanout free cone (MFFC) of node n is a subset of the


fanin cone, such that every path from a node in the subset to
the POs passes through n. Informally, MFFC of a node contains
all the logic used exclusively by the node.

MFFC of g
g = a.(b+c+d) f‘ = g3+g2 = a(b+c)+ad = a(b+c+d)

g2 = d.a
g3 = a.(b'.c’)’
= a.(b+c)
g1 = b'.c’

12
03-02-2025

Resubstitution in ABC
Reconvergence occurs when the paths starting at the output of a node meet again
before reaching the POs. Example: n2’s fanout meets at n8 before reaching PO.
• Reconvergence is inevitable due to logic sharing in multi-level logic networks.
• Excessive reconvergence is often redundant -- opportunities for optimization.
Cut with 12-16 leaves
are used – resub can be The subgraph structure with
performed with TT and reconvergence in the Boolean nw
exhaustive simulation
• The collected node’s level does not
exceed the level of node n
• Leaves of the cut are collected, but
nodes in the MFFC are skipped
• #collected nodes (divisors) ≤ 150

Note: The level of a node is the length of the longest path


from any PI to the node. The node itself is counted towards the
path lengths but PIs are not. Inverters are not counted in the
path length.

AIG Refactoring
• It is impossible to apply SOP balancing to a large AIG.
• Break large AIG into parts.
• SOP-balancing for each part, and if the delay is improved, locally update the large AIG with the
structure derived by SOP-balancing.

13

You might also like