aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Sakamoto <sakamoto@splhack.org>2020-06-19 19:09:43 -0700
committerKazuki Sakamoto <sakamoto@splhack.org>2020-06-19 19:09:43 -0700
commit429d37ff41b5a058fdd0b70f23a55170a973c369 (patch)
tree3919c85abfd44d6b0c2b6638dd73fc84945c1e08
parent6bf75be73bc0767b5df9e3fa33a58cfe6aae9f89 (diff)
downloadyosys-429d37ff41b5a058fdd0b70f23a55170a973c369.tar.gz
yosys-429d37ff41b5a058fdd0b70f23a55170a973c369.tar.bz2
yosys-429d37ff41b5a058fdd0b70f23a55170a973c369.zip
static cast: simplify
-rw-r--r--frontends/ast/simplify.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index 1d5dd91a7..e2da17c09 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -3484,6 +3484,13 @@ replace_fcall_later:;
}
}
break;
+ case AST_CAST_SIZE:
+ if (children.at(0)->type == AST_CONSTANT && children.at(1)->type == AST_CONSTANT) {
+ int width = children[0]->bitsAsConst().as_int();
+ RTLIL::Const val = children[1]->bitsAsConst(width);
+ newNode = mkconst_bits(val.bits, children[1]->is_signed);
+ }
+ break;
case AST_CONCAT:
string_op = !children.empty();
for (auto it = children.begin(); it != children.end(); it++) {