place: Fix placer validity checks
Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
parent
6d68af1e62
commit
e497575c8e
@ -177,13 +177,16 @@ static bool try_swap_position(Design *design, CellInfo *cell, BelId newBel,
|
|||||||
}
|
}
|
||||||
|
|
||||||
chip.bindBel(newBel, cell->name);
|
chip.bindBel(newBel, cell->name);
|
||||||
|
|
||||||
if (other != IdString()) {
|
if (other != IdString()) {
|
||||||
if (!isValidBelForCell(design, other_cell, oldBel)) {
|
chip.bindBel(oldBel, other_cell->name);
|
||||||
chip.unbindBel(newBel);
|
}
|
||||||
goto swap_fail;
|
|
||||||
} else {
|
if (!isBelLocationValid(design, newBel) || ((other != IdString() && !isBelLocationValid(design, oldBel)))) {
|
||||||
chip.bindBel(oldBel, other_cell->name);
|
chip.unbindBel(newBel);
|
||||||
}
|
if (other != IdString())
|
||||||
|
chip.unbindBel(oldBel);
|
||||||
|
goto swap_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
cell->bel = newBel;
|
cell->bel = newBel;
|
||||||
|
@ -79,6 +79,27 @@ static bool logicCellsCompatible(const std::vector<const CellInfo *> &cells)
|
|||||||
return locals.size() <= 32;
|
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)
|
bool isValidBelForCell(Design *design, CellInfo *cell, BelId bel)
|
||||||
{
|
{
|
||||||
const Chip &chip = design->chip;
|
const Chip &chip = design->chip;
|
||||||
|
@ -30,6 +30,9 @@ NEXTPNR_NAMESPACE_BEGIN
|
|||||||
// such as conflicting set/reset signals, etc
|
// such as conflicting set/reset signals, etc
|
||||||
bool isValidBelForCell(Design *design, CellInfo *cell, BelId bel);
|
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
|
NEXTPNR_NAMESPACE_END
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user