diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-07-31 15:59:14 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-07-31 15:59:14 +0200 |
commit | 6948c4370dc3f10d05eedfc4408ecb0cbd5f373c (patch) | |
tree | c9431ec1cb435318f0b3ded7d28ee8b18bd5e768 /icefuzz/make_fflogic.py | |
parent | 81e943e050dad652da795d21375bb700064116f4 (diff) | |
parent | 1f9d00bb9cb2eeea0261d00324ff44e9b3f02136 (diff) | |
download | icestorm-6948c4370dc3f10d05eedfc4408ecb0cbd5f373c.tar.gz icestorm-6948c4370dc3f10d05eedfc4408ecb0cbd5f373c.tar.bz2 icestorm-6948c4370dc3f10d05eedfc4408ecb0cbd5f373c.zip |
Merge branch 'ice5k'
Diffstat (limited to 'icefuzz/make_fflogic.py')
-rw-r--r-- | icefuzz/make_fflogic.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/icefuzz/make_fflogic.py b/icefuzz/make_fflogic.py index 91a5d05..bac0569 100644 --- a/icefuzz/make_fflogic.py +++ b/icefuzz/make_fflogic.py @@ -4,8 +4,14 @@ from fuzzconfig import * import numpy as np import os -os.system("rm -rf work_fflogic") -os.mkdir("work_fflogic") +device_class = os.getenv("ICEDEVICE") + +working_dir = "work_%s_fflogic" % (device_class, ) + +os.system("rm -rf " + working_dir) +os.mkdir(working_dir) + +w = (len(pins) - 4) // 5 def random_op(): return np.random.choice(["+", "-", "*", "^", "&", "|"]) @@ -36,22 +42,14 @@ def print_seq_op(dst, src1, src2, op, f): assert False for idx in range(num): - with open("work_fflogic/fflogic_%02d.v" % idx, "w") as f: - if os.getenv('ICE384PINS'): - print("module top(input clk, rst, en, input [4:0] a, b, c, d, output [4:0] y, output z);", file=f) - print(" reg [4:0] p, q;", file=f) - else: - print("module top(input clk, rst, en, input [15:0] a, b, c, d, output [15:0] y, output z);", file=f) - print(" reg [15:0] p, q;", file=f) + with open(working_dir + "/fflogic_%02d.v" % idx, "w") as f: + print("module top(input clk, rst, en, input [%d:0] a, b, c, d, output [%d:0] y, output z);" % (w-1, w-1), file=f) + print(" reg [%d:0] p, q;" % (w-1,), file=f) print_seq_op("p", "a", "b", random_op(), f) print_seq_op("q", "c", "d", random_op(), f) print(" assign y = p %s q, z = clk ^ rst ^ en;" % random_op(), file=f) print("endmodule", file=f) -with open("work_fflogic/Makefile", "w") as f: - print("all: %s" % " ".join(["fflogic_%02d.bin" % i for i in range(num)]), file=f) - for i in range(num): - print("fflogic_%02d.bin:" % i, file=f) - print("\t-bash ../icecube.sh fflogic_%02d > fflogic_%02d.log 2>&1 && rm -rf fflogic_%02d.tmp || tail fflogic_%02d.log" % (i, i, i, i), file=f) +output_makefile(working_dir, "fflogic") |