ice40: Fix getBelsByTile

Signed-off-by: David Shah <dave@ds0.me>
This commit is contained in:
David Shah 2020-06-29 11:08:21 +01:00
parent 32e655d0af
commit b24e0a609b
2 changed files with 6 additions and 2 deletions

View File

@ -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) {

View File

@ -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)