diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-11-01 14:46:36 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-11-01 14:46:36 +0100 |
commit | 406c2ad88f46bc5774fad55e90b45bbb02eed187 (patch) | |
tree | e3ab45032590902e009ae4c1cf905641ac0e32cd | |
parent | dc3698753afd9c7b40a86cc86a3abb7ae00704cb (diff) | |
download | icestorm-406c2ad88f46bc5774fad55e90b45bbb02eed187.tar.gz icestorm-406c2ad88f46bc5774fad55e90b45bbb02eed187.tar.bz2 icestorm-406c2ad88f46bc5774fad55e90b45bbb02eed187.zip |
Revert "Added heuristics to further reduce LUT equations."
This reverts commit 8447080d628d11a5571e715bfc5a6f5ba3d46e25.
-rwxr-xr-x | icebox/icebox_vlog.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/icebox/icebox_vlog.py b/icebox/icebox_vlog.py index 4d1a772..4a79cd4 100755 --- a/icebox/icebox_vlog.py +++ b/icebox/icebox_vlog.py @@ -810,24 +810,17 @@ for lut in luts_queue: elif not "0" in lut_bits: const_assigns.append([net_out, "1'b1"]) else: - def equals_1(expr): - return (expr == "1") or (expr == "1'b1") - def equals_0(expr): - return (expr == "0") or (expr == "1'b0") def make_lut_expr(bits, sigs): if not sigs: return "1'b%s" % bits[0] 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 equals_0(sigs[0]): return l_expr - if equals_1(sigs[0]): return h_expr - if equals_1(h_expr) and equals_0(l_expr): return sigs[0] - if equals_0(h_expr) and equals_1(l_expr): return "!" + sigs[0] - if h_expr == "!" + l_expr: return "(%s ^ %s)" % (sigs[0], l_expr) - if equals_0(h_expr): return "(%s & !%s)" % (sigs[0], l_expr) - if equals_0(l_expr): return "(%s & %s)" % (sigs[0], h_expr) - return "(%s ? %s : %s)" % (sigs[0], h_expr, l_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) lut_expr = make_lut_expr(lut_bits, [net_in3, net_in2, net_in1, net_in0]) lut_assigns.append([net_out, "/* LUT %2d %2d %2d */ %s" % (lut[0], lut[1], lut[2], lut_expr)]) max_net_len = max(max_net_len, len(net_out)) |