Gowin. Unbreak the segment routing. (#1508)

Use loop enumeration of PIPs instead of direct name construction for the
upper and lower ends of the segment wire.

Also do not allow clock wires for segments.

Signed-off-by: YRabbit <rabbit@yrabbit.cyou>
This commit is contained in:
YRabbit 2025-06-30 18:14:21 +10:00 committed by GitHub
parent e642e21f9b
commit 39f020b033
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 5 deletions

View File

@ -782,13 +782,19 @@ struct GowinGlobalRouter
SegmentRouteResult route_segmented_step2(NetInfo *ni, WireId segment_wire, WireId gate_wire, SegmentRouteResult route_segmented_step2(NetInfo *ni, WireId segment_wire, WireId gate_wire,
std::vector<PipId> &bound_pips) std::vector<PipId> &bound_pips)
{ {
IdStringList pip_name = IdStringList::concat(ctx->getWireName(segment_wire), ctx->getWireName(gate_wire)[1]); PipId pip;
PipId pip = ctx->getPipByName(pip_name); for (PipId down_pip : ctx->getPipsDownhill(gate_wire)) {
if (ctx->debug) { WireId dst = ctx->getPipDstWire(down_pip);
log_info(" step 2: %s\n", ctx->nameOfPip(pip)); if (dst == segment_wire) {
pip = down_pip;
break;
}
} }
NPNR_ASSERT(pip != PipId()); NPNR_ASSERT(pip != PipId());
if (ctx->debug) {
log_info(" step 2: %s\n", ctx->nameOfPip(pip));
}
NetInfo *pip_net = ctx->getBoundPipNet(pip); NetInfo *pip_net = ctx->getBoundPipNet(pip);
if (pip_net == nullptr) { if (pip_net == nullptr) {
ctx->bindPip(pip, ni, STRENGTH_LOCKED); ctx->bindPip(pip, ni, STRENGTH_LOCKED);
@ -822,7 +828,8 @@ struct GowinGlobalRouter
} }
routed = backwards_bfs_route( routed = backwards_bfs_route(
gate_ni, src_wire, gatewire, 1000000, false, gate_ni, src_wire, gatewire, 1000000, false,
[&](PipId pip, WireId src) { return dcs_input_filter(pip); }, &gate_bound_pips); [&](PipId pip, WireId src) { return dcs_input_filter(pip) && !gwu.is_global_pip(pip); },
&gate_bound_pips);
if (routed) { if (routed) {
// bind src // bind src
if (ctx->checkWireAvail(src_wire)) { if (ctx->checkWireAvail(src_wire)) {