diff options
Diffstat (limited to 'icefuzz/make_prim.py')
-rw-r--r-- | icefuzz/make_prim.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/icefuzz/make_prim.py b/icefuzz/make_prim.py index 8ced57e..b96a100 100644 --- a/icefuzz/make_prim.py +++ b/icefuzz/make_prim.py @@ -4,13 +4,17 @@ from fuzzconfig import * import numpy as np import os -os.system("rm -rf work_prim") -os.mkdir("work_prim") +device_class = os.getenv("ICEDEVICE") -w = 10 if os.getenv('ICE384PINS') else 24 +working_dir = "work_%s_prim" % (device_class, ) + +os.system("rm -rf " + working_dir) +os.mkdir(working_dir) + +w = len(pins) // 4 for idx in range(num): - with open("work_prim/prim_%02d.v" % idx, "w") as f: + with open(working_dir + "/prim_%02d.v" % idx, "w") as f: clkedge = np.random.choice(["pos", "neg"]) print("module top(input clk, input [%s:0] a, b, output reg x, output reg [%s:0] y);""" % ( w-1, w-1 ), file=f) print(" reg [%s:0] aa, bb;""" % ( w-1 ), file=f) @@ -25,7 +29,7 @@ for idx in range(num): else: print(" always @(%sedge clk) y <= %s%s;" % (clkedge, np.random.choice(["~", "-", ""]), np.random.choice(["a", "b"])), file=f) print("endmodule", file=f) - with open("work_prim/prim_%02d.pcf" % idx, "w") as f: + with open(working_dir + "/prim_%02d.pcf" % idx, "w") as f: p = np.random.permutation(pins) if np.random.choice([True, False]): for i in range(w): @@ -43,9 +47,5 @@ for idx in range(num): if np.random.choice([True, False]): print("set_io clk %s" % p[3*w+2], file=f) -with open("work_prim/Makefile", "w") as f: - print("all: %s" % " ".join(["prim_%02d.bin" % i for i in range(num)]), file=f) - for i in range(num): - print("prim_%02d.bin:" % i, file=f) - print("\t-bash ../icecube.sh prim_%02d > prim_%02d.log 2>&1 && rm -rf prim_%02d.tmp || tail prim_%02d.log" % (i, i, i, i), file=f) +output_makefile(working_dir, "prim") |