3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-07-29 07:27:58 +00:00

Added constant size expression support of sized constants

This commit is contained in:
Clifford Wolf 2014-02-01 13:50:23 +01:00
parent 1e2440e7ed
commit d06258f74f
6 changed files with 48 additions and 0 deletions

View file

@ -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;