From 39f020b0338578e56d28ae2b016f441a645e02ea Mon Sep 17 00:00:00 2001 From: YRabbit Date: Mon, 30 Jun 2025 18:14:21 +1000 Subject: [PATCH] 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 --- himbaechel/uarch/gowin/globals.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/himbaechel/uarch/gowin/globals.cc b/himbaechel/uarch/gowin/globals.cc index ca2669bd..ad42ecb9 100644 --- a/himbaechel/uarch/gowin/globals.cc +++ b/himbaechel/uarch/gowin/globals.cc @@ -782,13 +782,19 @@ struct GowinGlobalRouter SegmentRouteResult route_segmented_step2(NetInfo *ni, WireId segment_wire, WireId gate_wire, std::vector &bound_pips) { - IdStringList pip_name = IdStringList::concat(ctx->getWireName(segment_wire), ctx->getWireName(gate_wire)[1]); - PipId pip = ctx->getPipByName(pip_name); - if (ctx->debug) { - log_info(" step 2: %s\n", ctx->nameOfPip(pip)); + PipId pip; + for (PipId down_pip : ctx->getPipsDownhill(gate_wire)) { + WireId dst = ctx->getPipDstWire(down_pip); + if (dst == segment_wire) { + pip = down_pip; + break; + } } NPNR_ASSERT(pip != PipId()); + if (ctx->debug) { + log_info(" step 2: %s\n", ctx->nameOfPip(pip)); + } NetInfo *pip_net = ctx->getBoundPipNet(pip); if (pip_net == nullptr) { ctx->bindPip(pip, ni, STRENGTH_LOCKED); @@ -822,7 +828,8 @@ struct GowinGlobalRouter } routed = backwards_bfs_route( 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) { // bind src if (ctx->checkWireAvail(src_wire)) {