diff options
author | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-06-22 17:38:38 -0700 |
---|---|---|
committer | Scott Shawcroft <scott.shawcroft@gmail.com> | 2017-06-22 17:38:38 -0700 |
commit | 58a6110be198089d784b5ad3e2ecb611182bd5ea (patch) | |
tree | 3f15bebbc4b95584c93ad0f3412b53b7f55c8d5e /icefuzz/make_gbio.py | |
parent | ed8c4e8c034ffca4424f92fa683ff631c4205b50 (diff) | |
download | icestorm-58a6110be198089d784b5ad3e2ecb611182bd5ea.tar.gz icestorm-58a6110be198089d784b5ad3e2ecb611182bd5ea.tar.bz2 icestorm-58a6110be198089d784b5ad3e2ecb611182bd5ea.zip |
Add icefuzz support for the UP5K and rework underlying device specification for more flexibility.
Diffstat (limited to 'icefuzz/make_gbio.py')
-rw-r--r-- | icefuzz/make_gbio.py | 24 |
1 files changed, 16 insertions, 8 deletions
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) - |