From 58a6110be198089d784b5ad3e2ecb611182bd5ea Mon Sep 17 00:00:00 2001 From: Scott Shawcroft Date: Thu, 22 Jun 2017 17:38:38 -0700 Subject: Add icefuzz support for the UP5K and rework underlying device specification for more flexibility. --- icefuzz/make_gbio.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'icefuzz/make_gbio.py') diff --git a/icefuzz/make_gbio.py b/icefuzz/make_gbio.py index 555d37d..bbc4ae9 100644 --- a/icefuzz/make_gbio.py +++ b/icefuzz/make_gbio.py @@ -7,14 +7,26 @@ import os os.system("rm -rf work_gbio") os.mkdir("work_gbio") -w = 4 if os.getenv('ICE384PINS') else 8 +device_class = os.getenv("ICEDEVICE") for p in gpins: if p in pins: pins.remove(p) +# We can either tickle every global buffer or we don't have enough pins to do +# the full logic for each one. +w = min(min((len(pins) - 8) // 4, len(gpins)), 8) + for idx in range(num): with open("work_gbio/gbio_%02d.v" % idx, "w") as f: glbs = np.random.permutation(list(range(8))) + + if w <= 4: + din_0 = (w - 2, w) + else: + din_0 = (4, "%d:4" % (w - 1,)) + din_0 = np.random.choice(["din_0", "{din_0[%d:0], din_0[%s]}" % din_0]) + din_1 = np.random.choice(["din_1", "{din_1[1:0], din_1[%d:2]}" % (w - 1,)]) + globals_0 = np.random.choice(["globals", "{globals[0], globals[%d:1]}" % (w - 1, )]) print(""" module top ( inout [%s:0] pin, @@ -64,12 +76,9 @@ for idx in range(num): np.random.choice(["oen", "globals", "din_0+din_1", "din_0^din_1"]), np.random.choice(["dout_1", "globals", "globals^dout_0", "din_0+din_1", "~din_0"]), np.random.choice(["dout_0", "globals", "globals^dout_1", "din_0+din_1", "~din_1"]), - np.random.choice(["din_0", "{din_0[2:0], din_0[3]}"]) if os.getenv('ICE384PINS') - else np.random.choice(["din_0", "{din_0[3:0], din_0[7:4]}"]) , - np.random.choice(["din_1", "{din_1[1:0], din_1[3:2]}"]) if os.getenv('ICE384PINS') - else np.random.choice(["din_1", "{din_1[1:0], din_1[7:2]}"]), - np.random.choice(["globals", "{globals[0], globals[3:1]}"]) if os.getenv('ICE384PINS') - else np.random.choice(["globals", "{globals[0], globals[7:1]}"]), + din_0, + din_1, + globals_0, glbs[0], glbs[1], glbs[1], glbs[2], glbs[3] ), file=f) with open("work_gbio/gbio_%02d.pcf" % idx, "w") as f: @@ -89,4 +98,3 @@ with open("work_gbio/Makefile", "w") as f: for i in range(num): print("gbio_%02d.bin:" % i, file=f) print("\t-bash ../icecube.sh gbio_%02d > gbio_%02d.log 2>&1 && rm -rf gbio_%02d.tmp || tail gbio_%02d.log" % (i, i, i, i), file=f) - -- cgit v1.2.3