mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-13 04:28:18 +00:00
Const-fold parameter defs on-demand in AstNode::detectSignWidthWorker()
This commit is contained in:
parent
5d4f513c3b
commit
422794c584
|
@ -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) {
|
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;
|
this_width = id_ast->children[1]->range_left - id_ast->children[1]->range_right + 1;
|
||||||
} else
|
} 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();
|
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);
|
log_error("Failed to detect width for parameter %s at %s:%d!\n", str.c_str(), filename.c_str(), linenum);
|
||||||
if (children.size() != 0)
|
if (children.size() != 0)
|
||||||
range = children[0];
|
range = children[0];
|
||||||
|
|
Loading…
Reference in a new issue