diff options
author | gatecat <gatecat@ds0.me> | 2021-07-01 15:28:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-01 15:28:24 +0100 |
commit | 55c663f7ac63253124cffd1efec8b9b400658a3d (patch) | |
tree | 76732c6868fd2f3e8bbca28e4afb1eeab67127f5 | |
parent | 344cfe6216f0f0cf02dd9d130af51f93b3d4e6df (diff) | |
parent | 74ffe2c54320bbc5dc4619be0c9a34cc91cfb389 (diff) | |
download | nextpnr-55c663f7ac63253124cffd1efec8b9b400658a3d.tar.gz nextpnr-55c663f7ac63253124cffd1efec8b9b400658a3d.tar.bz2 nextpnr-55c663f7ac63253124cffd1efec8b9b400658a3d.zip |
Merge pull request #746 from YosysHQ/gatecat/ic-can-invert-const
interchange: Handle canInvert PIPs when processing preferred constants
-rw-r--r-- | fpga_interchange/site_router.cc | 14 |
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; |