From 7fbfd98b8a1cd36d80fa9b7aa3e529c5a510f7e1 Mon Sep 17 00:00:00 2001 From: gatecat Date: Sat, 15 May 2021 12:14:00 +0100 Subject: mistral: Speed up bel binding and checking Signed-off-by: gatecat --- mistral/arch.h | 22 ++++++++++++++++++---- 1 file 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 pins; // Info for different kinds of bels @@ -334,14 +337,25 @@ struct Arch : BaseArch 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; -- cgit v1.2.3