diff options
author | David Shah <davey1576@gmail.com> | 2018-06-16 18:45:32 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-06-16 18:45:48 +0200 |
commit | e497575c8eb2eeef520e1e3b8b90f5d5ce811dd8 (patch) | |
tree | e14de7ac975961de62464fd1f8eb2f2d547edd4b /ice40 | |
parent | 6d68af1e622fb960c64b0bf899d1397c2ba69995 (diff) | |
download | nextpnr-e497575c8eb2eeef520e1e3b8b90f5d5ce811dd8.tar.gz nextpnr-e497575c8eb2eeef520e1e3b8b90f5d5ce811dd8.tar.bz2 nextpnr-e497575c8eb2eeef520e1e3b8b90f5d5ce811dd8.zip |
place: Fix placer validity checks
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ice40')
-rw-r--r-- | ice40/arch_place.cc | 21 | ||||
-rw-r--r-- | ice40/arch_place.h | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/ice40/arch_place.cc b/ice40/arch_place.cc index c991af13..93b7beb4 100644 --- a/ice40/arch_place.cc +++ b/ice40/arch_place.cc @@ -79,6 +79,27 @@ static bool logicCellsCompatible(const std::vector<const CellInfo *> &cells) return locals.size() <= 32; } +bool isBelLocationValid(Design *design, BelId bel) { + const Chip &chip = design->chip; + if (chip.getBelType(bel) == TYPE_ICESTORM_LC) { + std::vector<const CellInfo *> cells; + for (auto bel_other : chip.getBelsAtSameTile(bel)) { + IdString cell_other = chip.getBelCell(bel_other, false); + if (cell_other != IdString()) { + const CellInfo *ci_other = design->cells[cell_other]; + cells.push_back(ci_other); + } + } + return logicCellsCompatible(cells); + } else { + IdString cellId = chip.getBelCell(bel, false); + if (cellId == IdString()) + return true; + else + return isValidBelForCell(design, design->cells.at(cellId), bel); + } +} + bool isValidBelForCell(Design *design, CellInfo *cell, BelId bel) { const Chip &chip = design->chip; diff --git a/ice40/arch_place.h b/ice40/arch_place.h index a505f4db..1db29a54 100644 --- a/ice40/arch_place.h +++ b/ice40/arch_place.h @@ -30,6 +30,9 @@ NEXTPNR_NAMESPACE_BEGIN // such as conflicting set/reset signals, etc bool isValidBelForCell(Design *design, CellInfo *cell, BelId bel); +// Return true whether all Bels at a given location are valid +bool isBelLocationValid(Design *design, BelId bel); + NEXTPNR_NAMESPACE_END #endif |