-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
32 lines (29 loc) · 846 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from synth import (
SynthesisCircuit,
AndAssociative,
XorDistributive,
run_minimization_heuristic,
priority_c,
)
import circuitgraph as cg
c = cg.from_file("router_opt.v")
print(set(c.type(c.nodes())))
sc = SynthesisCircuit(c)
print("depth_max", sc.depth_max())
print(set(sc.c.type(c.nodes())))
print("# of ANDs", sc.count_AND())
print("size of circuit", len(sc.c.nodes()))
sc.do_and_xor_transform()
print("depth_max", sc.depth_max())
print(set(sc.c.type(c.nodes())))
print("# of ANDs", sc.count_AND())
print("size of circuit", len(sc.c.nodes()))
outc = run_minimization_heuristic(
sc,
[XorDistributive, AndAssociative],
priority_c,
)
print("depth_max", outc.depth_max())
print("# of ANDs", outc.count_AND())
print("size of circuit", len(outc.c.nodes()))
cg.to_file(outc.c, "router_rewrite.v", behavioral=True)