diff --git a/passes/hierarchy/hierarchy.cc b/passes/hierarchy/hierarchy.cc index 6fcda5d7644..3ef04616fcb 100644 --- a/passes/hierarchy/hierarchy.cc +++ b/passes/hierarchy/hierarchy.cc @@ -47,7 +47,7 @@ void generate(RTLIL::Design *design, const std::vector &celltypes, { if (design->module(cell->type) != nullptr) continue; - if (cell->type.begins_with("$__")) + if (cell->type.begins_with("$") && !cell->type.begins_with("$__")) continue; for (auto &pattern : celltypes) if (patmatch(pattern.c_str(), RTLIL::unescape_id(cell->type).c_str())) diff --git a/tests/various/hierarchy_generate.ys b/tests/various/hierarchy_generate.ys new file mode 100644 index 00000000000..a4dc87a865f --- /dev/null +++ b/tests/various/hierarchy_generate.ys @@ -0,0 +1,19 @@ +read_verilog -icells <