From 160045a058dc6f5dea278f133f227697532f8cbb Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 16 Nov 2020 13:22:52 +0000 Subject: nexus: Fix validity checking when DSPs are used Signed-off-by: David Shah --- nexus/arch.h | 11 +++++++++-- nexus/arch_place.cc | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/nexus/arch.h b/nexus/arch.h index 9b75a09e..f7299cb7 100644 --- a/nexus/arch.h +++ b/nexus/arch.h @@ -979,7 +979,7 @@ struct Arch : BaseCtx cell->belStrength = strength; refreshUiBel(bel); - if (tile_is(bel, LOC_LOGIC)) + if (bel_tile_is(bel, LOC_LOGIC)) update_logic_bel(bel, cell); } @@ -988,7 +988,7 @@ struct Arch : BaseCtx NPNR_ASSERT(bel != BelId()); NPNR_ASSERT(tileStatus[bel.tile].boundcells[bel.index] != nullptr); - if (tile_is(bel, LOC_LOGIC)) + if (bel_tile_is(bel, LOC_LOGIC)) update_logic_bel(bel, nullptr); tileStatus[bel.tile].boundcells[bel.index]->bel = BelId(); @@ -1492,6 +1492,13 @@ struct Arch : BaseCtx template bool tile_is(TId id, LocFlags lf) const { return tile_loc_flags(id) & lf; } + bool bel_tile_is(BelId bel, LocFlags lf) const + { + int32_t tile; + NPNR_ASSERT(rel_tile(bel.tile, bel_data(bel).rel_x, bel_data(bel).rel_y, tile)); + return chip_info->grid[tile].loc_flags & lf; + } + // ------------------------------------------------- enum LogicBelZ diff --git a/nexus/arch_place.cc b/nexus/arch_place.cc index 35b14caf..0d141013 100644 --- a/nexus/arch_place.cc +++ b/nexus/arch_place.cc @@ -104,7 +104,7 @@ bool Arch::isValidBelForCell(CellInfo *cell, BelId bel) const bool Arch::isBelLocationValid(BelId bel) const { - if (tile_is(bel, LOC_LOGIC)) { + if (bel_tile_is(bel, LOC_LOGIC)) { LogicTileStatus *lts = tileStatus[bel.tile].lts; if (lts == nullptr) return true; -- cgit v1.2.3