From e751eaca47a9b506159f0ba59e0f9bacc3bd70e8 Mon Sep 17 00:00:00 2001 From: gatecat Date: Tue, 25 Feb 2025 15:58:03 +0100 Subject: [PATCH] generic: Fix archcheck crash Signed-off-by: gatecat --- generic/arch.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/generic/arch.cc b/generic/arch.cc index 91be118a..3bbe8e01 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -91,7 +91,7 @@ PipId Arch::addPip(IdStringList name, IdString type, WireId srcWire, WireId dstW tilePipDimZ[loc.x].resize(loc.y + 1); gridDimX = std::max(gridDimX, loc.x + 1); - gridDimY = std::max(gridDimY, loc.x + 1); + gridDimY = std::max(gridDimY, loc.y + 1); tilePipDimZ[loc.x][loc.y] = std::max(tilePipDimZ[loc.x][loc.y], loc.z + 1); return pip; } @@ -129,7 +129,7 @@ BelId Arch::addBel(IdStringList name, IdString type, Loc loc, bool gb, bool hidd tileBelDimZ[loc.x].resize(loc.y + 1); gridDimX = std::max(gridDimX, loc.x + 1); - gridDimY = std::max(gridDimY, loc.x + 1); + gridDimY = std::max(gridDimY, loc.y + 1); tileBelDimZ[loc.x][loc.y] = std::max(tileBelDimZ[loc.x][loc.y], loc.z + 1); return bel; } @@ -296,7 +296,10 @@ BelId Arch::getBelByLocation(Loc loc) const return BelId(); } -const std::vector &Arch::getBelsByTile(int x, int y) const { return bels_by_tile.at(x).at(y); } +const std::vector &Arch::getBelsByTile(int x, int y) const { + static const std::vector empty_list; + return y < int(bels_by_tile.at(x).size()) ? bels_by_tile.at(x).at(y) : empty_list; +} bool Arch::getBelGlobalBuf(BelId bel) const { return bel_info(bel).gb; }