From e7d81913a48bffd970f7a92acc44eb36d9f996f7 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 18 Mar 2021 16:31:40 -0700 Subject: Add "checkPipAvailForNet" to Arch API. This is important for distiguishing valid pseudo pips in the FPGA interchange arch. This also avoids a double or triple lookup of pip->net map. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- common/arch_api.h | 1 + common/base_arch.h | 5 +++++ common/router2.cc | 20 +++++++------------- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'common') diff --git a/common/arch_api.h b/common/arch_api.h index 83872b7d..7ed81434 100644 --- a/common/arch_api.h +++ b/common/arch_api.h @@ -93,6 +93,7 @@ template struct ArchAPI : BaseCtx virtual void bindPip(PipId pip, NetInfo *net, PlaceStrength strength) = 0; virtual void unbindPip(PipId pip) = 0; virtual bool checkPipAvail(PipId pip) const = 0; + virtual bool checkPipAvailForNet(PipId pip, NetInfo *net) const = 0; virtual NetInfo *getBoundPipNet(PipId pip) const = 0; virtual WireId getConflictingPipWire(PipId pip) const = 0; virtual NetInfo *getConflictingPipNet(PipId pip) const = 0; diff --git a/common/base_arch.h b/common/base_arch.h index 84629977..d4efe9ce 100644 --- a/common/base_arch.h +++ b/common/base_arch.h @@ -243,6 +243,11 @@ template struct BaseArch : ArchAPI p2n_entry = nullptr; } virtual bool checkPipAvail(PipId pip) const override { return getBoundPipNet(pip) == nullptr; } + virtual bool checkPipAvailForNet(PipId pip, NetInfo *net) const override + { + NetInfo *bound_net = getBoundPipNet(pip); + return bound_net == nullptr || bound_net == net; + } virtual NetInfo *getBoundPipNet(PipId pip) const override { auto fnd = base_pip2net.find(pip); diff --git a/common/router2.cc b/common/router2.cc index 002a05a3..a233cdc5 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -588,7 +588,7 @@ struct Router2 bool did_something = false; for (auto uh : ctx->getPipsUphill(flat_wires[cursor].w)) { did_something = true; - if (!ctx->checkPipAvail(uh) && ctx->getBoundPipNet(uh) != net) + if (!ctx->checkPipAvailForNet(uh, net)) continue; if (cpip != PipId() && cpip != uh) continue; // don't allow multiple pips driving a wire with a net @@ -675,18 +675,12 @@ struct Router2 #else if (is_bb && !hit_test_pip(ad.bb, ctx->getPipLocation(dh))) continue; - if (!ctx->checkPipAvail(dh)) { - NetInfo *bound_net = ctx->getBoundPipNet(dh); - if (bound_net != net) { - if (bound_net != nullptr) { - ROUTE_LOG_DBG("Skipping pip %s because it is bound to net '%s' not net '%s'\n", - ctx->nameOfPip(dh), bound_net->name.c_str(ctx), net->name.c_str(ctx)); - } else { - ROUTE_LOG_DBG("Skipping pip %s because it is reported not available\n", ctx->nameOfPip(dh)); - } - - continue; - } + if (!ctx->checkPipAvailForNet(dh, net)) { + ROUTE_LOG_DBG("Skipping pip %s because it is bound to net '%s' not net '%s'\n", ctx->nameOfPip(dh), + ctx->getBoundPipNet(dh) != nullptr ? ctx->getBoundPipNet(dh)->name.c_str(ctx) + : "", + net->name.c_str(ctx)); + continue; } #endif // Evaluate score of next wire -- cgit v1.2.3