diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-12-05 13:09:41 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-12-05 13:09:41 +0100 |
commit | e935bb6edacf46e84959a2e7befa413497420a9a (patch) | |
tree | c49d0f6eb9cfe335533206a48e4cc37e97d14595 /frontends/ast | |
parent | 5c39948eadbcda58d0b880dc162572838dad01a2 (diff) | |
download | yosys-e935bb6edacf46e84959a2e7befa413497420a9a.tar.gz yosys-e935bb6edacf46e84959a2e7befa413497420a9a.tar.bz2 yosys-e935bb6edacf46e84959a2e7befa413497420a9a.zip |
Added const folding support for $signed and $unsigned
Diffstat (limited to 'frontends/ast')
-rw-r--r-- | frontends/ast/simplify.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 3d512d6f0..fe4ff3f23 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -1205,6 +1205,13 @@ skip_dynamic_range_lvalue_expansion:; newNode = mkconst_bits(y.bits, sign_hint); } break; + case AST_TO_SIGNED: + case AST_TO_UNSIGNED: + if (children[0]->type == AST_CONSTANT) { + RTLIL::Const y = children[0]->bitsAsConst(width_hint, sign_hint); + newNode = mkconst_bits(y.bits, type == AST_TO_SIGNED); + } + break; if (0) { case AST_BIT_AND: const_func = RTLIL::const_and; } if (0) { case AST_BIT_OR: const_func = RTLIL::const_or; } if (0) { case AST_BIT_XOR: const_func = RTLIL::const_xor; } |