diff options
author | gatecat <gatecat@ds0.me> | 2021-05-15 12:14:00 +0100 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-05-15 14:54:33 +0100 |
commit | 7fbfd98b8a1cd36d80fa9b7aa3e529c5a510f7e1 (patch) | |
tree | 289640468d906f9f6d02d419d44a7919eb92dd18 /mistral | |
parent | 34677d38837af88729a217fea7617c892dfb5a95 (diff) | |
download | nextpnr-7fbfd98b8a1cd36d80fa9b7aa3e529c5a510f7e1.tar.gz nextpnr-7fbfd98b8a1cd36d80fa9b7aa3e529c5a510f7e1.tar.bz2 nextpnr-7fbfd98b8a1cd36d80fa9b7aa3e529c5a510f7e1.zip |
mistral: Speed up bel binding and checking
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'mistral')
-rw-r--r-- | mistral/arch.h | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/mistral/arch.h b/mistral/arch.h index 2360fb20..1bb2395c 100644 --- a/mistral/arch.h +++ b/mistral/arch.h @@ -79,8 +79,11 @@ struct BelInfo IdString name; IdString type; IdString bucket; - // For cases where we need to determine an original block index, due to multiple bels at the same tile this might - // not be the same as the nextpnr z-coordinate + + CellInfo *bound = nullptr; + + // For cases where we need to determine an original block index, due to multiple bels at the same tile this + // might not be the same as the nextpnr z-coordinate int block_index; std::unordered_map<IdString, PinInfo> pins; // Info for different kinds of bels @@ -334,14 +337,25 @@ struct Arch : BaseArch<ArchRanges> void bindBel(BelId bel, CellInfo *cell, PlaceStrength strength) override { - BaseArch::bindBel(bel, cell, strength); + auto &data = bel_data(bel); + NPNR_ASSERT(data.bound == nullptr); + data.bound = cell; + cell->bel = bel; + cell->belStrength = strength; update_bel(bel); } void unbindBel(BelId bel) override { - BaseArch::unbindBel(bel); + auto &data = bel_data(bel); + NPNR_ASSERT(data.bound != nullptr); + data.bound->bel = BelId(); + data.bound->belStrength = STRENGTH_NONE; + data.bound = nullptr; update_bel(bel); } + bool checkBelAvail(BelId bel) const override { return bel_data(bel).bound == nullptr; } + CellInfo *getBoundBelCell(BelId bel) const override { return bel_data(bel).bound; } + CellInfo *getConflictingBelCell(BelId bel) const override { return bel_data(bel).bound; } void update_bel(BelId bel); BelId bel_by_block_idx(int x, int y, IdString type, int block_index) const; |