This change in refactoring commit e38f40af5b7 (passes/hierarchy/hierarchy.cc:51) actually changed the behavior:
- if (cell->type.substr(0, 1) == "$" && cell->type.substr(0, 3) != "$__")
+ if (cell->type.begins_with("$__"))
As far as I can tell, the intended behavior for hierarchy -generate is to only create the requested module if:
the module is instantiated in the design
the module is not defined in the design
the module name is not an internal cell type (heuristically)?
The heuristic in the last point being, if the cell name starts with $ it's ignored, unless it starts with $__ (which is the recommended prefix for intermediate cell types in techmap rules, for which it might be desirable to generate a blackbox definition, e.g. to be able to correctly show or export the intermediate state for debugging purposes)
The testcase checks this behavior, but should the check perhaps be changed to use yosys_celltypes.cell_known() instead?
This change in refactoring commit e38f40af5b7 (passes/hierarchy/hierarchy.cc:51) actually changed the behavior:
As far as I can tell, the intended behavior for
hierarchy -generate
is to only create the requested module if:$
it's ignored, unless it starts with$__
(which is the recommended prefix for intermediate cell types in techmap rules, for which it might be desirable to generate a blackbox definition, e.g. to be able to correctlyshow
or export the intermediate state for debugging purposes)The testcase checks this behavior, but should the check perhaps be changed to use
yosys_celltypes.cell_known()
instead?