diff options
author | Peter Crozier <peter@crozier.com> | 2020-03-15 19:02:47 +0000 |
---|---|---|
committer | Grazfather <grazfather@gmail.com> | 2020-03-22 18:20:46 -0700 |
commit | 6cad865d1258cc4b9a2fc84219823004f59d5b3c (patch) | |
tree | ee8b88f42e2dbd0b915283bf8d0ca7da0b6570f9 | |
parent | c06eda25041cd567ac53da52d486dfd0daa8eaff (diff) | |
download | yosys-6cad865d1258cc4b9a2fc84219823004f59d5b3c.tar.gz yosys-6cad865d1258cc4b9a2fc84219823004f59d5b3c.tar.bz2 yosys-6cad865d1258cc4b9a2fc84219823004f59d5b3c.zip |
Simplify was not being called for packages. Broke typedef enums.
-rw-r--r-- | frontends/ast/ast.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc index 650c7a937..632a4d4f9 100644 --- a/frontends/ast/ast.cc +++ b/frontends/ast/ast.cc @@ -1179,12 +1179,13 @@ void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump for (auto n : design->verilog_globals) (*it)->children.push_back(n->clone()); - for (auto n : design->verilog_packages){ - for (auto o : n->children) { + // append nodes from previous packages using package-qualified names + for (auto &n : design->verilog_packages) { + for (auto &o : n->children) { AstNode *cloned_node = o->clone(); - log("cloned node %s\n", type2str(cloned_node->type).c_str()); - if (cloned_node->type == AST_ENUM){ - for (auto e : cloned_node->children){ + // log("cloned node %s\n", type2str(cloned_node->type).c_str()); + if (cloned_node->type == AST_ENUM) { + for (auto &e : cloned_node->children) { log_assert(e->type == AST_ENUM_ITEM); e->str = n->str + std::string("::") + e->str.substr(1); } @@ -1220,6 +1221,8 @@ void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump design->add(process_module(*it, defer)); } else if ((*it)->type == AST_PACKAGE) { + // process enum/other declarations + (*it)->simplify(true, false, false, 1, -1, false, false); design->verilog_packages.push_back((*it)->clone()); } else { |