From 09d4821fe00949962b9c1022e5792ec5839416b4 Mon Sep 17 00:00:00 2001 From: Dag Lem Date: Fri, 11 Aug 2023 23:23:57 +0200 Subject: [PATCH] Uncloak array expressions generated by read_verilog -dump_vlog2 Explicit conversion of AST_TO_SIGNED, AST_TO_UNSIGNED, and AST_CAST_SIZE makes it possible to reason about simplified array expressions. --- frontends/ast/ast.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index 5335a3992d6..34e6249939e 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -658,11 +658,20 @@ void AstNode::dumpVlog(FILE *f, std::string indent) const if (0) { case AST_NEG: txt = "-"; } if (0) { case AST_LOGIC_NOT: txt = "!"; } if (0) { case AST_SELFSZ: txt = "@selfsz@"; } + if (0) { case AST_TO_SIGNED: txt = "signed'"; } + if (0) { case AST_TO_UNSIGNED: txt = "unsigned'"; } fprintf(f, "%s(", txt.c_str()); children[0]->dumpVlog(f, ""); fprintf(f, ")"); break; + case AST_CAST_SIZE: + children[0]->dumpVlog(f, ""); + fprintf(f, "'("); + children[1]->dumpVlog(f, ""); + fprintf(f, ")"); + break; + if (0) { case AST_BIT_AND: txt = "&"; } if (0) { case AST_BIT_OR: txt = "|"; } if (0) { case AST_BIT_XOR: txt = "^"; }