aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-07-13 14:56:27 +0100
committergatecat <gatecat@ds0.me>2021-07-20 10:42:04 +0100
commitffd97945ba905d6ca7b2c4b90cb13e7a2596967e (patch)
tree230c134ddef7f1185f11d4c44c92a93f067bde4a /fpga_interchange
parent084e15f9cf421786c3b0db8ea929211323bc4307 (diff)
downloadnextpnr-ffd97945ba905d6ca7b2c4b90cb13e7a2596967e.tar.gz
nextpnr-ffd97945ba905d6ca7b2c4b90cb13e7a2596967e.tar.bz2
nextpnr-ffd97945ba905d6ca7b2c4b90cb13e7a2596967e.zip
interchange: Fix preferred constant handling when canInvert
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'fpga_interchange')
-rw-r--r--fpga_interchange/site_router.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/fpga_interchange/site_router.cc b/fpga_interchange/site_router.cc
index 92176d86..f209bd8c 100644
--- a/fpga_interchange/site_router.cc
+++ b/fpga_interchange/site_router.cc
@@ -862,6 +862,8 @@ static void apply_constant_routing(Context *ctx, const SiteArch &site_arch, NetI
SiteWire wire = user;
PipId inverting_pip;
+ PhysicalNetlist::PhysNetlist::NetType pref_const = PhysicalNetlist::PhysNetlist::NetType::SIGNAL;
+
while (wire != site_net->driver) {
SitePip pip = site_net->wires.at(wire).pip;
NPNR_ASSERT(site_arch.getPipDstWire(pip) == wire);
@@ -884,9 +886,16 @@ static void apply_constant_routing(Context *ctx, const SiteArch &site_arch, NetI
}
wire = site_arch.getPipSrcWire(pip);
+ pref_const = site_arch.prefered_constant_net_type(pip);
}
- if (!is_path_inverting && !path_can_invert) {
+ bool is_pref_const = true;
+ if (pref_const == PhysicalNetlist::PhysNetlist::NetType::VCC && net == gnd_net)
+ is_pref_const = false;
+ else if (pref_const == PhysicalNetlist::PhysNetlist::NetType::GND && net == vcc_net)
+ is_pref_const = false;
+
+ if (!is_path_inverting && (!path_can_invert || is_pref_const)) {
// This routing is boring, use base logic.
apply_simple_routing(ctx, site_arch, net, site_net, user);
continue;