aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ice40/arch.cc6
-rw-r--r--ice40/chipdb.py2
2 files changed, 6 insertions, 2 deletions
diff --git a/ice40/arch.cc b/ice40/arch.cc
index 52246001..be346fd7 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -192,7 +192,11 @@ BelRange Arch::getBelsByTile(int x, int y) const
// are used
BelRange br;
- br.b.cursor = Arch::getBelByLocation(Loc(x, y, 0)).index;
+ for (int i = 0; i < 4; i++) {
+ br.b.cursor = Arch::getBelByLocation(Loc(x, y, i)).index;
+ if (br.b.cursor != -1)
+ break;
+ }
br.e.cursor = br.b.cursor;
if (br.e.cursor != -1) {
diff --git a/ice40/chipdb.py b/ice40/chipdb.py
index 7b3ad999..efdde1a1 100644
--- a/ice40/chipdb.py
+++ b/ice40/chipdb.py
@@ -1060,7 +1060,7 @@ for tile_xy, tile_type in sorted(tiles.items()):
if ec[1] == tile_xy[0] and ec[2] == tile_xy[1]:
add_bel_ec(ec)
-for ec in sorted(extra_cells.keys()):
+for ec in sorted(extra_cells.keys(), key=lambda ec: (ec[1], ec[2], ec[3], ec[0])):
if ec[1] in (0, dev_width - 1) and ec[2] in (0, dev_height - 1):
add_bel_ec(ec)