Skip to content

Commit

Permalink
abc9_ops -prep_hier to unmap entire module
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiehung authored and Ravenslofty committed May 25, 2023
1 parent 862631d commit ec8d7b1
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions passes/techmap/abc9_ops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,22 +233,23 @@ void prep_hier(RTLIL::Design *design, bool dff_mode)

if (derived_type != cell->type) {
auto unmap_module = unmap_design->addModule(derived_type);
auto replace_cell = unmap_module->addCell(ID::_TECHMAP_REPLACE_, cell->type);
for (auto port : derived_module->ports) {
auto w = unmap_module->addWire(port, derived_module->wire(port));
// Do not propagate (* init *) values into the box,
// in fact, remove it from outside too
if (w->port_output)
w->attributes.erase(ID::init);
// Attach (* techmap_autopurge *) to all ports to ensure that
// undriven inputs/unused outputs are propagated through to
// the techmapped cell
w->attributes[ID::techmap_autopurge] = 1;

replace_cell->setPort(port, w);
}
unmap_module->ports = derived_module->ports;
unmap_module->check();

auto replace_cell = unmap_module->addCell(ID::_TECHMAP_REPLACE_, cell->type);
for (const auto &conn : cell->connections()) {
auto w = unmap_module->wire(conn.first);
log_assert(w);
replace_cell->setPort(conn.first, w);
}
replace_cell->parameters = cell->parameters;
}
}
Expand Down

0 comments on commit ec8d7b1

Please sign in to comment.