aboutsummaryrefslogtreecommitdiffstats
path: root/ice40/chip.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ice40/chip.cc')
-rw-r--r--ice40/chip.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/ice40/chip.cc b/ice40/chip.cc
index 42252fa0..21beb648 100644
--- a/ice40/chip.cc
+++ b/ice40/chip.cc
@@ -151,6 +151,26 @@ BelId Chip::getBelByName(IdString name) const
return ret;
}
+BelRange Chip::getBelsAtSameTile(BelId bel) const
+{
+ BelRange br;
+ assert(bel != BelId());
+ // This requires Bels at the same tile are consecutive
+ int x = chip_info.bel_data[bel.index].x;
+ int y = chip_info.bel_data[bel.index].y;
+ int start = bel.index, end = bel.index;
+ while (start >= 0 && chip_info.bel_data[start].x == x &&
+ chip_info.bel_data[start].y == y)
+ start--;
+ start++;
+ br.b.cursor = start;
+ while (end < chip_info.num_bels && chip_info.bel_data[end].x == x &&
+ chip_info.bel_data[end].y == y)
+ end++;
+ br.e.cursor = end;
+ return br;
+}
+
WireId Chip::getWireBelPin(BelId bel, PortPin pin) const
{
WireId ret;