summaryrefslogtreecommitdiff
path: root/frontends/ast
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-08-12 14:47:50 +0200
committerClifford Wolf <clifford@clifford.at>2013-08-12 14:47:50 +0200
commit759852914df00609f8797315c6cec76f1c8a3981 (patch)
treebac67cdfc87d57a7f3e12e41aad71424d0d29ea9 /frontends/ast
parentccf36cb7d81a9513db15b8a36c240d2c7ec9f5b5 (diff)
Added support for "2**n" shifter encoding
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/genrtlil.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index 9c027878..50e95975 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -974,8 +974,12 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
width = width_hint;
if (type == AST_MUL)
width = std::min(left.width + right.width, width_hint);
+ if (type == AST_POW)
+ width = width_hint;
}
is_signed = children[0]->is_signed && children[1]->is_signed;
+ if (!flag_noopt && type == AST_POW && left.is_fully_const() && left.as_int() == 2)
+ return binop2rtlil(this, "$shl", width, RTLIL::SigSpec(1, left.width), right);
return binop2rtlil(this, type_name, width, left, right);
}