From 759852914df00609f8797315c6cec76f1c8a3981 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 12 Aug 2013 14:47:50 +0200 Subject: Added support for "2**n" shifter encoding --- frontends/ast/genrtlil.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'frontends/ast') 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); } -- cgit v1.2.3