aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast/genrtlil.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-02-01 13:50:23 +0100
committerClifford Wolf <clifford@clifford.at>2014-02-01 13:50:23 +0100
commitd06258f74f724ea3ed26ec9341dd64a51e320ccf (patch)
treecb0a5af86db1dff05686490bdb1ed5908471d2e2 /frontends/ast/genrtlil.cc
parent1e2440e7ed6979bdee2f80116d6c3a429b604e25 (diff)
downloadyosys-d06258f74f724ea3ed26ec9341dd64a51e320ccf.tar.gz
yosys-d06258f74f724ea3ed26ec9341dd64a51e320ccf.tar.bz2
yosys-d06258f74f724ea3ed26ec9341dd64a51e320ccf.zip
Added constant size expression support of sized constants
Diffstat (limited to 'frontends/ast/genrtlil.cc')
-rw-r--r--frontends/ast/genrtlil.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index 6001e278a..99d8566dc 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -664,6 +664,14 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint)
sign_hint = false;
break;
+ case AST_TO_BITS:
+ while (children[0]->simplify(true, false, false, 1, -1, false) == true) { }
+ if (children[0]->type != AST_CONSTANT)
+ log_error("Left operand of tobits expression is not constant at %s:%d!\n", filename.c_str(), linenum);
+ children[1]->detectSignWidthWorker(sub_width_hint, sign_hint);
+ width_hint = std::max(width_hint, children[0]->bitsAsConst().as_int());
+ break;
+
case AST_TO_SIGNED:
children.at(0)->detectSignWidthWorker(width_hint, sub_sign_hint);
break;