diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-03-01 11:20:22 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-03-01 11:20:22 +0100 |
commit | 422794c5840784cab11930cfa305ed9351bb1a98 (patch) | |
tree | d18c7e514a1c472451412e7ea85d1bd8a3b6bea7 /frontends/ast | |
parent | 5d4f513c3bfa3848765daeb3e1cd9c937650231e (diff) | |
download | yosys-422794c5840784cab11930cfa305ed9351bb1a98.tar.gz yosys-422794c5840784cab11930cfa305ed9351bb1a98.tar.bz2 yosys-422794c5840784cab11930cfa305ed9351bb1a98.zip |
Const-fold parameter defs on-demand in AstNode::detectSignWidthWorker()
Diffstat (limited to 'frontends/ast')
-rw-r--r-- | frontends/ast/genrtlil.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc index c421364a3..8ed8c673a 100644 --- a/frontends/ast/genrtlil.cc +++ b/frontends/ast/genrtlil.cc @@ -567,9 +567,11 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun if (id_ast->children.size() > 1 && id_ast->children[1]->range_valid) { this_width = id_ast->children[1]->range_left - id_ast->children[1]->range_right + 1; } else - if (id_ast->children[0]->type == AST_CONSTANT) { + if (id_ast->children[0]->type != AST_CONSTANT) + while (id_ast->simplify(true, false, false, 1, -1, false, true)) { } + if (id_ast->children[0]->type == AST_CONSTANT) this_width = id_ast->children[0]->bits.size(); - } else + else log_error("Failed to detect width for parameter %s at %s:%d!\n", str.c_str(), filename.c_str(), linenum); if (children.size() != 0) range = children[0]; |