From: Jeff Wang Date: Thu, 16 Jan 2020 20:23:03 +0000 (-0500) Subject: allow enums to be declared at toplevel scope X-Git-Tag: working-ls180~791^2~7 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=41a0a93dcc489fbba2624006ef52a3d0f565ee25;p=yosys.git allow enums to be declared at toplevel scope --- diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index 9013ebe66..2e1b1e404 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -428,6 +428,13 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage, if (node->type == AST_PARAMETER || node->type == AST_LOCALPARAM || node->type == AST_WIRE || node->type == AST_AUTOWIRE || node->type == AST_MEMORY || node->type == AST_TYPEDEF) while (node->simplify(true, false, false, 1, -1, false, node->type == AST_PARAMETER || node->type == AST_LOCALPARAM)) did_something = true; + if (node->type == AST_ENUM) { + for (auto enode : node->children){ + log_assert(enode->type==AST_ENUM_ITEM); + while (node->simplify(true, false, false, 1, -1, false, node->type == AST_ENUM_ITEM)) + did_something = true; + } + } } }