interchange: Search backwards for IO macro placements, too

Signed-off-by: gatecat <gatecat@ds0.me>
This commit is contained in:
gatecat 2021-07-26 16:01:21 +01:00
parent 6be26fbde7
commit b4602ae5bf

View File

@ -101,9 +101,10 @@ void Arch::place_iobufs(WireId pad_wire, NetInfo *net,
continue;
for (auto &port : cursor->ports) {
// Only consider routing downstream from outputs for now
if (port.second.type != PORT_OUT || port.second.net == nullptr)
if (port.second.net == nullptr)
continue;
NetInfo *ni = port.second.net;
if (port.second.type == PORT_OUT) {
WireId src_wire = ctx->getNetinfoSourceWire(ni);
for (auto &usr : ni->users) {
// Look for unplaced users in the same macro
@ -119,6 +120,24 @@ void Arch::place_iobufs(WireId pad_wire, NetInfo *net,
ctx->nameOfBel(usr.cell->bel));
}
}
} else {
auto &drv = ni->driver;
// Look for unplaced driver in the same macro
if (drv.cell->bel != BelId() || drv.cell->macro_parent != cursor->macro_parent)
continue;
for (auto bel_pin : ctx->getBelPinsForCellPin(cursor, port.first)) {
// Try and place using dedicated routing
WireId dst_wire = ctx->getBelPinWire(cursor->bel, bel_pin);
if (search_routing_for_placement(this, dst_wire, drv.cell, drv.port, false)) {
// Successful
placed_cells->insert(drv.cell);
place_queue.push(drv.cell);
if (ctx->verbose)
log_info("Placed %s at %s based on dedicated IO macro routing.\n", ctx->nameOf(drv.cell),
ctx->nameOfBel(drv.cell->bel));
}
}
}
}
}
// TODO: for even more complex cases, if any future devices hit them, we probably should do a full validity check of