summaryrefslogtreecommitdiff
path: root/frontends/ast
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-06-21 21:41:13 +0200
committerClifford Wolf <clifford@clifford.at>2014-06-21 21:41:13 +0200
commit65b2e9c0645c30d84a9d9be148430fd76d3e5f05 (patch)
treefc1ead69727d02aa6f400f89e3c052c23605909f /frontends/ast
parent072604f30f58ab535bfd8d004163607900adf86e (diff)
fixed signdness detection for expressions with reals
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/genrtlil.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/frontends/ast/genrtlil.cc b/frontends/ast/genrtlil.cc
index 1f0ef445..9f18efce 100644
--- a/frontends/ast/genrtlil.cc
+++ b/frontends/ast/genrtlil.cc
@@ -594,6 +594,10 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
AstNode *range = NULL;
AstNode *id_ast = NULL;
+ bool local_found_real = false;
+ if (found_real == NULL)
+ found_real = &local_found_real;
+
switch (type)
{
case AST_CONSTANT:
@@ -603,8 +607,7 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
break;
case AST_REALVALUE:
- if (found_real)
- *found_real = true;
+ *found_real = true;
width_hint = std::max(width_hint, 32);
break;
@@ -787,6 +790,9 @@ void AstNode::detectSignWidthWorker(int &width_hint, bool &sign_hint, bool *foun
log_error("Don't know how to detect sign and width for %s node at %s:%d!\n",
type2str(type).c_str(), filename.c_str(), linenum);
}
+
+ if (*found_real)
+ sign_hint = true;
}
// detect sign and width of an expression