diff options
Diffstat (limited to 'icefuzz/make_fflogic.py')
-rw-r--r-- | icefuzz/make_fflogic.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/icefuzz/make_fflogic.py b/icefuzz/make_fflogic.py index 91a5d05..e107ec7 100644 --- a/icefuzz/make_fflogic.py +++ b/icefuzz/make_fflogic.py @@ -7,6 +7,8 @@ import os os.system("rm -rf work_fflogic") os.mkdir("work_fflogic") +w = (len(pins) - 4) // 5 + def random_op(): return np.random.choice(["+", "-", "*", "^", "&", "|"]) @@ -37,12 +39,8 @@ def print_seq_op(dst, src1, src2, op, f): 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) + 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) @@ -54,4 +52,3 @@ with open("work_fflogic/Makefile", "w") as 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) - |