aboutsummaryrefslogtreecommitdiffstats
path: root/fpga_interchange/site_router.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-07-01 13:47:02 +0100
committergatecat <gatecat@ds0.me>2021-07-01 13:47:02 +0100
commit74ffe2c54320bbc5dc4619be0c9a34cc91cfb389 (patch)
treebcee18d9a6964584f8a49e3553eff9661cadd275 /fpga_interchange/site_router.cc
parent86bc708299be1bdaf964c42ebb28dc51d91b75c5 (diff)
downloadnextpnr-74ffe2c54320bbc5dc4619be0c9a34cc91cfb389.tar.gz
nextpnr-74ffe2c54320bbc5dc4619be0c9a34cc91cfb389.tar.bz2
nextpnr-74ffe2c54320bbc5dc4619be0c9a34cc91cfb389.zip
interchange: Handle canInvert PIPs when processing preferred constants
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'fpga_interchange/site_router.cc')
-rw-r--r--fpga_interchange/site_router.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/fpga_interchange/site_router.cc b/fpga_interchange/site_router.cc
index 94d7ee17..92176d86 100644
--- a/fpga_interchange/site_router.cc
+++ b/fpga_interchange/site_router.cc
@@ -858,9 +858,7 @@ static void apply_constant_routing(Context *ctx, const SiteArch &site_arch, NetI
NPNR_ASSERT(net == vcc_net || net == gnd_net);
for (auto &user : site_net->users) {
- // FIXME: Handle case where pip is "can_invert", and that
- // inversion helps with accomidating "best constant".
- bool is_path_inverting = false;
+ bool is_path_inverting = false, path_can_invert = false;
SiteWire wire = user;
PipId inverting_pip;
@@ -879,10 +877,16 @@ static void apply_constant_routing(Context *ctx, const SiteArch &site_arch, NetI
inverting_pip = pip.pip;
}
+ if (site_arch.canInvert(pip)) {
+ path_can_invert = true;
+ NPNR_ASSERT(pip.type == SitePip::SITE_PIP);
+ inverting_pip = pip.pip;
+ }
+
wire = site_arch.getPipSrcWire(pip);
}
- if (!is_path_inverting) {
+ if (!is_path_inverting && !path_can_invert) {
// This routing is boring, use base logic.
apply_simple_routing(ctx, site_arch, net, site_net, user);
continue;
@@ -956,7 +960,7 @@ static void apply_constant_routing(Context *ctx, const SiteArch &site_arch, NetI
SitePip site_pip = site_net->wires.at(wire).pip;
NPNR_ASSERT(site_arch.getPipDstWire(site_pip) == wire);
- if (site_arch.isInverting(site_pip)) {
+ if (site_arch.isInverting(site_pip) || site_arch.canInvert(site_pip)) {
NPNR_ASSERT(after_inverter);
after_inverter = false;