aboutsummaryrefslogtreecommitdiffstats
path: root/icebox
diff options
context:
space:
mode:
Diffstat (limited to 'icebox')
-rwxr-xr-xicebox/icebox_hlc2asc.py4
-rwxr-xr-xicebox/icebox_vlog.py11
2 files changed, 9 insertions, 6 deletions
diff --git a/icebox/icebox_hlc2asc.py b/icebox/icebox_hlc2asc.py
index 00ed050..f10a0e9 100755
--- a/icebox/icebox_hlc2asc.py
+++ b/icebox/icebox_hlc2asc.py
@@ -532,7 +532,9 @@ class Main:
and len(fields[1]) >= 2 and fields[1][0] == '"' \
and fields[1][-1] == '"' \
and self.ic is None and self.device is None:
- self.device = fields[1][1:-1]
+ self.device = fields[1][1:-1].lower()
+ if self.device.startswith('lp') or self.device.startswith('hx'):
+ self.device = self.device[2:]
if self.device == '1k':
self.ic = icebox.iceconfig()
self.ic.setup_empty_1k()
diff --git a/icebox/icebox_vlog.py b/icebox/icebox_vlog.py
index 5736011..a86f11e 100755
--- a/icebox/icebox_vlog.py
+++ b/icebox/icebox_vlog.py
@@ -350,6 +350,7 @@ for segs in sorted(ic.group_segments(extra_connections=extra_connections, extra_
if re.match(r"ram/RDATA_", s[2]): count_drivers += 1
if re.match(r"io_./D_IN_", s[2]): count_drivers += 1
if re.match(r"lutff_./out", s[2]): count_drivers += 1
+ if re.match(r"lutff_./lout", s[2]): count_drivers += 1
if count_drivers != 1 and check_driver:
failed_drivers_check.append(n)
@@ -851,11 +852,11 @@ for lut in luts_queue:
l_expr = make_lut_expr(bits[0:len(bits)//2], sigs[1:])
h_expr = make_lut_expr(bits[len(bits)//2:len(bits)], sigs[1:])
if h_expr == l_expr: return h_expr
- if sigs[0] == "0": return l_expr
- if sigs[0] == "1": return h_expr
- if h_expr == "1" and l_expr == "0": return sigs[0]
- if h_expr == "0" and l_expr == "1": return "!" + sigs[0]
- return "%s ? %s : %s" % (sigs[0], h_expr, l_expr)
+ if sigs[0] == "1'b0": return l_expr
+ if sigs[0] == "1'b1": return h_expr
+ if h_expr == "1'b1" and l_expr == "1'b0": return sigs[0]
+ if h_expr == "1'b0" and l_expr == "1'b1": return "!" + sigs[0]
+ return "(%s ? %s : %s)" % (sigs[0], h_expr, l_expr)
lut_expr = make_lut_expr(lut_bits, [net_in3, net_in2, net_in1, net_in0])
lut_assigns.append([net_lout, "/* LUT %2d %2d %2d */ %s" % (lut[0], lut[1], lut[2], lut_expr)])
max_net_len = max(max_net_len, len(net_lout))