mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-20 04:43:40 +00:00
ast: Fix handling of identifiers in the global scope
Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
parent
3c4758c60e
commit
4d02505820
3 changed files with 25 additions and 2 deletions
|
@ -1169,7 +1169,8 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
|
|||
// annotate identifiers using scope resolution and create auto-wires as needed
|
||||
if (type == AST_IDENTIFIER) {
|
||||
if (current_scope.count(str) == 0) {
|
||||
for (auto node : current_ast_mod->children) {
|
||||
AstNode *current_scope_ast = (current_ast_mod == nullptr) ? current_ast : current_ast_mod;
|
||||
for (auto node : current_scope_ast->children) {
|
||||
//log("looking at mod scope child %s\n", type2str(node->type).c_str());
|
||||
switch (node->type) {
|
||||
case AST_PARAMETER:
|
||||
|
@ -1203,7 +1204,9 @@ bool AstNode::simplify(bool const_fold, bool at_zero, bool in_lvalue, int stage,
|
|||
}
|
||||
}
|
||||
if (current_scope.count(str) == 0) {
|
||||
if (flag_autowire || str == "\\$global_clock") {
|
||||
if (current_ast_mod == nullptr) {
|
||||
log_file_error(filename, location.first_line, "Identifier `%s' is implicitly declared outside of a module.\n", str.c_str());
|
||||
} else if (flag_autowire || str == "\\$global_clock") {
|
||||
AstNode *auto_wire = new AstNode(AST_AUTOWIRE);
|
||||
auto_wire->str = str;
|
||||
current_ast_mod->children.push_back(auto_wire);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue