aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/ast
diff options
context:
space:
mode:
authorZachary Snow <zach@zachjs.com>2021-03-11 13:05:04 -0500
committerZachary Snow <zach@zachjs.com>2021-03-12 11:22:41 -0500
commit640b9927fae23d3127cc9ecb56ccbc8a2c66afbe (patch)
tree8f5b6ccaba28f979992946f0efda2ffdd49d74f0 /frontends/ast
parent396ad17e06a7b5fa912180540206a6560b54101f (diff)
downloadyosys-640b9927fae23d3127cc9ecb56ccbc8a2c66afbe.tar.gz
yosys-640b9927fae23d3127cc9ecb56ccbc8a2c66afbe.tar.bz2
yosys-640b9927fae23d3127cc9ecb56ccbc8a2c66afbe.zip
sv: allow globals in one file to depend on globals in another
This defers the simplification of globals so that globals in one file may depend on globals in other files. Adds a simplify() call downstream because globals are appended at the end.
Diffstat (limited to 'frontends/ast')
-rw-r--r--frontends/ast/ast.cc1
-rw-r--r--frontends/ast/simplify.cc1
2 files changed, 1 insertions, 1 deletions
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc
index 06e2e23a8..7aa391c93 100644
--- a/frontends/ast/ast.cc
+++ b/frontends/ast/ast.cc
@@ -1288,7 +1288,6 @@ void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump
// must be global definition
if ((*it)->type == AST_PARAMETER)
(*it)->type = AST_LOCALPARAM; // cannot be overridden
- (*it)->simplify(false, false, false, 1, -1, false, false); //process enum/other declarations
design->verilog_globals.push_back((*it)->clone());
current_scope.clear();
}
diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc
index e0ac58f20..d68b13b2a 100644
--- a/frontends/ast/simplify.cc
+++ b/frontends/ast/simplify.cc
@@ -192,6 +192,7 @@ void AstNode::annotateTypedEnums(AstNode *template_node)
log_assert(current_scope.count(enum_type) == 1);
AstNode *enum_node = current_scope.at(enum_type);
log_assert(enum_node->type == AST_ENUM);
+ while (enum_node->simplify(true, false, false, 1, -1, false, true)) { }
//get width from 1st enum item:
log_assert(enum_node->children.size() >= 1);
AstNode *enum_item0 = enum_node->children[0];