summaryrefslogtreecommitdiff
path: root/frontends/ast/genrtlil.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-11-04 06:04:42 +0100
committerClifford Wolf <clifford@clifford.at>2013-11-04 06:04:42 +0100
commit472117d532c50f8973ad5c02463dcd36e4649f67 (patch)
treec5096d68035d3dfef0474a43bfa220a9f5f2551f /frontends/ast/genrtlil.cc
parentcd0fe7d7860f490b43cacb37752fe9bf983e2279 (diff)
further improved early width and sign detection in ast simplifier
Diffstat (limited to 'frontends/ast/genrtlil.cc')
-rw-r--r--frontends/ast/genrtlil.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index ab22b865..b8bd2bff 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -665,9 +665,12 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint)
break;
case AST_MEMRD:
- if (!is_signed)
+ if (!id2ast->is_signed)
sign_hint = false;
- width_hint = std::max(width_hint, current_module->memories.at(str)->width);
+ if (!id2ast->children[0]->range_valid)
+ log_error("Failed to detect with of memory access `%s' at %s:%d!\n", str.c_str(), filename.c_str(), linenum);
+ this_width = id2ast->children[0]->range_left - id2ast->children[0]->range_right + 1;
+ width_hint = std::max(width_hint, this_width);
break;
// everything should have been handled above -> print error if not.