projects
/
yosys.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8d226da
)
Fixed const folding of ternary operator
author
Clifford Wolf
<clifford@clifford.at>
Mon, 4 Nov 2013 15:46:14 +0000
(16:46 +0100)
committer
Clifford Wolf
<clifford@clifford.at>
Mon, 4 Nov 2013 15:46:14 +0000
(16:46 +0100)
frontends/ast/simplify.cc
patch
|
blob
|
history
diff --git
a/frontends/ast/simplify.cc
b/frontends/ast/simplify.cc
index cc65658c809df858b5d9fc3ab60756697edc2fc1..643855d081594c22825a5040c60ec1b959cba86e 100644
(file)
--- a/
frontends/ast/simplify.cc
+++ b/
frontends/ast/simplify.cc
@@
-1033,10
+1033,11
@@
skip_dynamic_range_lvalue_expansion:;
break;
case AST_TERNARY:
if (children[0]->type == AST_CONSTANT) {
- if (children[0]->integer)
- newNode = children[1]->clone();
- else
- newNode = children[2]->clone();
+ AstNode *choice = children[children[0]->integer ? 1 : 2];
+ if (choice->type == AST_CONSTANT) {
+ RTLIL::Const y = choice->bitsAsConst(width_hint, sign_hint);
+ newNode = mkconst_bits(y.bits, sign_hint);
+ }
}
break;
case AST_CONCAT: