aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-07-20 12:04:12 +0100
committerGitHub <noreply@github.com>2021-07-20 12:04:12 +0100
commitf3be638ea9536511d329d3e1ad726e847916f122 (patch)
tree8a255ac5061cb7ec06dfe4684e85d716c478c37d /fpga_interchange
parentc6aa51a2de671772917e880e262d3dd0860ac5ea (diff)
parentffd97945ba905d6ca7b2c4b90cb13e7a2596967e (diff)
downloadnextpnr-f3be638ea9536511d329d3e1ad726e847916f122.tar.gz
nextpnr-f3be638ea9536511d329d3e1ad726e847916f122.tar.bz2
nextpnr-f3be638ea9536511d329d3e1ad726e847916f122.zip
Merge pull request #767 from YosysHQ/gatecat/ic-pref-const
interchange: Fix preferred constant handling when canInvert
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;