mirror of https://github.com/YosysHQ/yosys.git
Fixed const folding of ternary operator
This commit is contained in:
parent
8d226da694
commit
d38c67f53d
|
@ -1033,10 +1033,11 @@ skip_dynamic_range_lvalue_expansion:;
|
||||||
break;
|
break;
|
||||||
case AST_TERNARY:
|
case AST_TERNARY:
|
||||||
if (children[0]->type == AST_CONSTANT) {
|
if (children[0]->type == AST_CONSTANT) {
|
||||||
if (children[0]->integer)
|
AstNode *choice = children[children[0]->integer ? 1 : 2];
|
||||||
newNode = children[1]->clone();
|
if (choice->type == AST_CONSTANT) {
|
||||||
else
|
RTLIL::Const y = choice->bitsAsConst(width_hint, sign_hint);
|
||||||
newNode = children[2]->clone();
|
newNode = mkconst_bits(y.bits, sign_hint);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AST_CONCAT:
|
case AST_CONCAT:
|
||||||
|
|
Loading…
Reference in New Issue