mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-06 14:13:23 +00:00
Added support for SystemVerilog packages with localparam definitions
This commit is contained in:
parent
3380281e15
commit
178ff3e7f6
7 changed files with 53 additions and 1 deletions
|
@ -151,6 +151,7 @@ std::string AST::type2str(AstNodeType type)
|
|||
X(AST_POSEDGE)
|
||||
X(AST_NEGEDGE)
|
||||
X(AST_EDGE)
|
||||
X(AST_PACKAGE)
|
||||
#undef X
|
||||
default:
|
||||
log_abort();
|
||||
|
@ -996,6 +997,14 @@ void AST::process(RTLIL::Design *design, AstNode *ast, bool dump_ast1, bool dump
|
|||
for (auto n : global_decls)
|
||||
(*it)->children.push_back(n->clone());
|
||||
|
||||
for (auto n : design->packages){
|
||||
for (auto o : n->children) {
|
||||
AstNode *cloned_node = o->clone();
|
||||
cloned_node->str = n->str + std::string("::") + cloned_node->str.substr(1);
|
||||
(*it)->children.push_back(cloned_node);
|
||||
}
|
||||
}
|
||||
|
||||
if (flag_icells && (*it)->str.substr(0, 2) == "\\$")
|
||||
(*it)->str = (*it)->str.substr(1);
|
||||
|
||||
|
@ -1013,6 +1022,9 @@ 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){
|
||||
design->packages.push_back((*it)->clone());
|
||||
}
|
||||
else
|
||||
global_decls.push_back(*it);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue