diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2018-11-26 11:03:26 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2018-11-26 12:51:14 +0100 |
commit | a79f0db7491b4d8b794c9fcc59647ce9d4e877ec (patch) | |
tree | 1ae785dcd8b500c8790ae98d77d27ff5d226c18c | |
parent | 822b525035d7a088f68684d9cf1b6c6bb15006fe (diff) | |
download | nextpnr-a79f0db7491b4d8b794c9fcc59647ce9d4e877ec.tar.gz nextpnr-a79f0db7491b4d8b794c9fcc59647ce9d4e877ec.tar.bz2 nextpnr-a79f0db7491b4d8b794c9fcc59647ce9d4e877ec.zip |
ice40: Add helper to know which global network is driven by a SB_GB Bel
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rw-r--r-- | ice40/arch.h | 7 | ||||
-rw-r--r-- | ice40/arch_place.cc | 3 |
2 files changed, 8 insertions, 2 deletions
diff --git a/ice40/arch.h b/ice40/arch.h index e8c597c9..10255dbe 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -884,6 +884,13 @@ struct Arch : BaseCtx } NPNR_ASSERT_FALSE("Expected PLL pin to share an output with an SB_IO D_IN_{0,1}"); } + + int getDrivenGlobalNetwork(BelId bel) const + { + NPNR_ASSERT(getBelType(bel) == id_SB_GB); + IdString glb_net = getWireName(getBelPinWire(bel, id_GLOBAL_BUFFER_OUTPUT)); + return std::stoi(std::string("") + glb_net.str(this).back()); + } }; void ice40DelayFuzzerMain(Context *ctx); diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc index 41f9b640..90bb62b9 100644 --- a/ice40/arch_place.cc +++ b/ice40/arch_place.cc @@ -165,8 +165,7 @@ bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const return true; NPNR_ASSERT(cell->ports.at(id_GLOBAL_BUFFER_OUTPUT).net != nullptr); const NetInfo *net = cell->ports.at(id_GLOBAL_BUFFER_OUTPUT).net; - IdString glb_net = getWireName(getBelPinWire(bel, id_GLOBAL_BUFFER_OUTPUT)); - int glb_id = std::stoi(std::string("") + glb_net.str(this).back()); + int glb_id = getDrivenGlobalNetwork(bel); if (net->is_reset && net->is_enable) return false; else if (net->is_reset) |