Skip to content

Commit

Permalink
Fix setting up scope for parameter simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
Szelwiga committed Nov 22, 2024
1 parent f50c2de commit 2d497e2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/frontends/systemverilog/uhdm_ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2379,6 +2379,19 @@ void UhdmAst::simplify_parameter(AST::AstNode *parameter, const std::vector<::Yo
}
});
}
auto ancestor_node = this;
while (ancestor_node) {
if (ancestor_node->current_node) {
visitEachDescendant(ancestor_node->current_node, [&](AST::AstNode *current_scope_node) {
if (current_scope_node->type == AST::AST_TYPEDEF || current_scope_node->type == AST::AST_PARAMETER ||
current_scope_node->type == AST::AST_LOCALPARAM || current_scope_node->type == AST::AST_FUNCTION) {
AST_INTERNAL::current_scope[current_scope_node->str] = current_scope_node;
}
});
}
ancestor_node = ancestor_node->parent;
}

// first apply custom simplification step if needed
simplify_sv(parameter, nullptr);
// workaround for yosys sometimes not simplifying parameters children
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ lowrisc:ip:rom_ctrl:0.1
lowrisc:ip:rom_ctrl_pkg:0.1
lowrisc:ip:rstmgr_cnsty_chk:0
lowrisc:ip:rstmgr_reg:0.1
lowrisc:ip:rv_core_ibex:0.1
lowrisc:ip:rv_core_ibex_pkg:0.1
lowrisc:ip:rv_dm:0.1
lowrisc:ip:rv_plic_component:0.1
Expand Down

0 comments on commit 2d497e2

Please sign in to comment.