aboutsummaryrefslogtreecommitdiffstats
path: root/generic/viaduct_helpers.cc
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2022-05-02 09:56:36 +0100
committerLofty <dan.ravensloft@gmail.com>2022-05-02 11:02:09 +0100
commitf0d4e4fbc3847635e0f6151a9eda52b7fb952c19 (patch)
tree18da2e8b06550c0db562d123923ea9142351c158 /generic/viaduct_helpers.cc
parent20cfafa109c15ef8f12307cf23f595c893f5a2e1 (diff)
downloadnextpnr-f0d4e4fbc3847635e0f6151a9eda52b7fb952c19.tar.gz
nextpnr-f0d4e4fbc3847635e0f6151a9eda52b7fb952c19.tar.bz2
nextpnr-f0d4e4fbc3847635e0f6151a9eda52b7fb952c19.zip
generic: Add some extra helpers for viaduct uarches
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'generic/viaduct_helpers.cc')
-rw-r--r--generic/viaduct_helpers.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/generic/viaduct_helpers.cc b/generic/viaduct_helpers.cc
index a92d0de1..153d2a0e 100644
--- a/generic/viaduct_helpers.cc
+++ b/generic/viaduct_helpers.cc
@@ -25,9 +25,9 @@
NEXTPNR_NAMESPACE_BEGIN
-void ViaductHelpers::resize_ids(int x, int y)
+void ViaductHelpers::resize_ids(int x, int y, int z)
{
- NPNR_ASSERT(x >= 0 && y >= 0 && x <= 20000 && y <= 20000);
+ NPNR_ASSERT(x >= 0 && y >= 0 && x <= 20000 && y <= 20000 && z <= 1000);
while (int(x_ids.size()) <= x) {
IdString next = ctx->id(stringf("X%d", int(x_ids.size())));
x_ids.push_back(next);
@@ -36,6 +36,10 @@ void ViaductHelpers::resize_ids(int x, int y)
IdString next = ctx->id(stringf("Y%d", int(y_ids.size())));
y_ids.push_back(next);
}
+ while (int(z_ids.size()) <= y) {
+ IdString next = ctx->id(stringf("Z%d", int(z_ids.size())));
+ z_ids.push_back(next);
+ }
}
IdStringList ViaductHelpers::xy_id(int x, int y, IdString base)
@@ -52,6 +56,20 @@ IdStringList ViaductHelpers::xy_id(int x, int y, IdStringList base)
return IdStringList::concat(IdStringList(prefix), base);
}
+IdStringList ViaductHelpers::xyz_id(int x, int y, int z, IdString base)
+{
+ resize_ids(x, y, z);
+ std::array<IdString, 4> result{x_ids.at(x), y_ids.at(y), z_ids.at(z), base};
+ return IdStringList(result);
+}
+
+IdStringList ViaductHelpers::xyz_id(int x, int y, int z, IdStringList base)
+{
+ resize_ids(x, y, z);
+ std::array<IdString, 3> prefix{x_ids.at(x), y_ids.at(y), z_ids.at(z)};
+ return IdStringList::concat(IdStringList(prefix), base);
+}
+
void ViaductHelpers::remove_nextpnr_iobs(const pool<CellTypePort> &top_ports)
{
std::vector<IdString> to_remove;