aboutsummaryrefslogtreecommitdiffstats
path: root/icefuzz
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2017-10-20 15:18:39 +0100
committerDavid Shah <davey1576@gmail.com>2017-10-20 15:18:39 +0100
commit42047c61145b5d9e06aca30d706f132f4268dc74 (patch)
treeeaa6cc1eb26934de73467af9e1c7992c6ab422ad /icefuzz
parent4a930377f0a635bcaa28922e8fa6bd0aa8eee6d9 (diff)
downloadicestorm-42047c61145b5d9e06aca30d706f132f4268dc74.tar.gz
icestorm-42047c61145b5d9e06aca30d706f132f4268dc74.tar.bz2
icestorm-42047c61145b5d9e06aca30d706f132f4268dc74.zip
Fix case where make_prim allocates all global buffer pins
This is a low probability bug more likely to show up in low pin count devices with few GBINs. In rare cases make_prim would constrain all of the global buffer capable pins but not the clock input. icecube would then fail to place the clock input. This is fixed by always constraining the clock if all GBIN pins are used.
Diffstat (limited to 'icefuzz')
-rw-r--r--icefuzz/make_prim.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/icefuzz/make_prim.py b/icefuzz/make_prim.py
index b96a100..90186da 100644
--- a/icefuzz/make_prim.py
+++ b/icefuzz/make_prim.py
@@ -31,20 +31,40 @@ for idx in range(num):
print("endmodule", file=f)
with open(working_dir + "/prim_%02d.pcf" % idx, "w") as f:
p = np.random.permutation(pins)
+ used_pins = []
if np.random.choice([True, False]):
for i in range(w):
print("set_io a[%d] %s" % (i, p[i]), file=f)
+ used_pins.append(p[i])
if np.random.choice([True, False]):
for i in range(w):
print("set_io b[%d] %s" % (i, p[w+i]), file=f)
+ used_pins.append(p[w+i])
if np.random.choice([True, False]):
for i in range(w):
print("set_io y[%d] %s" % (i, p[2*w+i]), file=f)
+ used_pins.append(p[2*w+i])
if np.random.choice([True, False]):
print("set_io x %s" % p[3*w], file=f)
+ used_pins.append(p[3*w])
+
if np.random.choice([True, False]):
print("set_io y %s" % p[3*w+1], file=f)
- if np.random.choice([True, False]):
+ used_pins.append(p[3*w+1])
+
+ # There is a low but non-zero probability, particularly on devices with
+ # fewer pins and GBINs such as the UltraPlus, that a permutation will be
+ # picked where all of the GBINs are already constrained at this point,
+ # hence icecube fails to assign clk successfully. This is fixed by
+ # forcing clock assignment if no GBINs are free.
+
+ global_free = False
+ for glbi in gpins:
+ if not glbi in used_pins:
+ global_free = True
+ break
+
+ if np.random.choice([True, False]) or not global_free:
print("set_io clk %s" % p[3*w+2], file=f)