aboutsummaryrefslogtreecommitdiffstats
path: root/icebox/icebox_vlog.py
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2018-06-13 13:36:55 +0200
committerGitHub <noreply@github.com>2018-06-13 13:36:55 +0200
commitdd77a918da9b945721e92a2deac32f283caf9721 (patch)
tree877945326d3c79908e3bb09d9c43d7f294086db3 /icebox/icebox_vlog.py
parent92751d505af0e2843694a1b59c89bb8896546aba (diff)
parentf9c1f2e5b2721e4abf2f13f52bbc1395b6e7b1f7 (diff)
downloadicestorm-dd77a918da9b945721e92a2deac32f283caf9721.tar.gz
icestorm-dd77a918da9b945721e92a2deac32f283caf9721.tar.bz2
icestorm-dd77a918da9b945721e92a2deac32f283caf9721.zip
Merge pull request #152 from mithro/vlog-fix
icebox: Fix LUT output code.
Diffstat (limited to 'icebox/icebox_vlog.py')
-rwxr-xr-xicebox/icebox_vlog.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/icebox/icebox_vlog.py b/icebox/icebox_vlog.py
index 5736011..59f1b6c 100755
--- a/icebox/icebox_vlog.py
+++ b/icebox/icebox_vlog.py
@@ -851,11 +851,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))