aboutsummaryrefslogtreecommitdiffstats
path: root/icefuzz/make_aig.py
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2017-07-31 15:59:14 +0200
committerClifford Wolf <clifford@clifford.at>2017-07-31 15:59:14 +0200
commit6948c4370dc3f10d05eedfc4408ecb0cbd5f373c (patch)
treec9431ec1cb435318f0b3ded7d28ee8b18bd5e768 /icefuzz/make_aig.py
parent81e943e050dad652da795d21375bb700064116f4 (diff)
parent1f9d00bb9cb2eeea0261d00324ff44e9b3f02136 (diff)
downloadicestorm-6948c4370dc3f10d05eedfc4408ecb0cbd5f373c.tar.gz
icestorm-6948c4370dc3f10d05eedfc4408ecb0cbd5f373c.tar.bz2
icestorm-6948c4370dc3f10d05eedfc4408ecb0cbd5f373c.zip
Merge branch 'ice5k'
Diffstat (limited to 'icefuzz/make_aig.py')
-rw-r--r--icefuzz/make_aig.py32
1 files changed, 17 insertions, 15 deletions
diff --git a/icefuzz/make_aig.py b/icefuzz/make_aig.py
index 8dd5ef0..6880f21 100644
--- a/icefuzz/make_aig.py
+++ b/icefuzz/make_aig.py
@@ -4,14 +4,20 @@ from fuzzconfig import *
import numpy as np
import os
-os.system("rm -rf work_aig")
-os.mkdir("work_aig")
+device_class = os.getenv("ICEDEVICE")
+
+working_dir = "work_%s_aig" % (device_class, )
+
+os.system("rm -rf " + working_dir)
+os.mkdir(working_dir)
+
+w = len(pins) // 2
for idx in range(num):
- with open("work_aig/aig_%02d.v" % idx, "w") as f:
- print("module top(input [31:0] a, output [31:0] y);", file=f)
+ with open(working_dir + "/aig_%02d.v" % idx, "w") as f:
+ print("module top(input [%d:0] a, output [%d:0] y);" % (w-1, w-1), file=f)
- sigs = ["a[%d]" % i for i in range(32)]
+ sigs = ["a[%d]" % i for i in range(w)]
netidx = 0
for i in range(100 if num_ramb40 < 20 else 1000):
@@ -24,7 +30,7 @@ for idx in range(num):
sigs.append(newnet)
- while len(sigs) > 32:
+ while len(sigs) > w:
netidx += 1
newnet = "n_%d" % netidx
@@ -40,20 +46,16 @@ for idx in range(num):
sigs.append(newnet)
- for i in range(32):
+ for i in range(w):
print(" assign y[%d] = %s;" % (i, sigs[i]), file=f)
print("endmodule", file=f)
- with open("work_aig/aig_%02d.pcf" % idx, "w") as f:
+ with open(working_dir + "/aig_%02d.pcf" % idx, "w") as f:
p = np.random.permutation(pins)
- for i in range(32):
+ for i in range(w):
print("set_io a[%d] %s" % (i, p[i]), file=f)
- print("set_io y[%d] %s" % (i, p[i+32]), file=f)
+ print("set_io y[%d] %s" % (i, p[i+w]), file=f)
-with open("work_aig/Makefile", "w") as f:
- print("all: %s" % " ".join(["aig_%02d.bin" % i for i in range(num)]), file=f)
- for i in range(num):
- print("aig_%02d.bin:" % i, file=f)
- print("\t-bash ../icecube.sh aig_%02d > aig_%02d.log 2>&1 && rm -rf aig_%02d.tmp || tail aig_%02d.log" % (i, i, i, i), file=f)
+output_makefile(working_dir, "aig")