aboutsummaryrefslogtreecommitdiffstats
path: root/gowin
diff options
context:
space:
mode:
Diffstat (limited to 'gowin')
-rw-r--r--gowin/arch.cc9
-rw-r--r--gowin/arch.h27
-rw-r--r--gowin/archdefs.h1
3 files changed, 37 insertions, 0 deletions
diff --git a/gowin/arch.cc b/gowin/arch.cc
index b3a6a47d..5a1a56e3 100644
--- a/gowin/arch.cc
+++ b/gowin/arch.cc
@@ -739,6 +739,15 @@ Arch::Arch(ArchArgs args) : args(args)
}
// Dummy for empty decals
decal_graphics[IdString()];
+
+ std::unordered_set<IdString> bel_types;
+ for (BelId bel : getBels()) {
+ bel_types.insert(getBelType(bel));
+ }
+
+ for (IdString bel_type : bel_types) {
+ cell_types.push_back(bel_type);
+ }
}
void IdString::initialize_arch(const BaseCtx *ctx)
diff --git a/gowin/arch.h b/gowin/arch.h
index 5591744d..f12c604e 100644
--- a/gowin/arch.h
+++ b/gowin/arch.h
@@ -422,6 +422,31 @@ struct Arch : BaseCtx
// Get the TimingClockingInfo of a port
TimingClockingInfo getPortClockingInfo(const CellInfo *cell, IdString port, int index) const;
+ bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); }
+
+ const std::vector<IdString> &getCellTypes() const { return cell_types; }
+
+ std::vector<BelBucketId> getBelBuckets() const { return cell_types; }
+
+ IdString getBelBucketName(BelBucketId bucket) const { return bucket; }
+
+ BelBucketId getBelBucketByName(IdString name) const { return name; }
+
+ BelBucketId getBelBucketForBel(BelId bel) const { return getBelType(bel); }
+
+ BelBucketId getBelBucketForCellType(IdString cell_type) const { return cell_type; }
+
+ std::vector<BelId> getBelsInBucket(BelBucketId bucket) const
+ {
+ std::vector<BelId> bels;
+ for (BelId bel : getBels()) {
+ if (getBelType(bel) == bucket) {
+ bels.push_back(bel);
+ }
+ }
+ return bels;
+ }
+
bool isValidBelForCell(CellInfo *cell, BelId bel) const;
bool isBelLocationValid(BelId bel) const;
@@ -434,6 +459,8 @@ struct Arch : BaseCtx
// Internal usage
void assignArchInfo();
bool cellsCompatible(const CellInfo **cells, int count) const;
+
+ std::vector<IdString> cell_types;
};
NEXTPNR_NAMESPACE_END
diff --git a/gowin/archdefs.h b/gowin/archdefs.h
index adeb8a0d..2efe1437 100644
--- a/gowin/archdefs.h
+++ b/gowin/archdefs.h
@@ -72,6 +72,7 @@ typedef IdString WireId;
typedef IdString PipId;
typedef IdString GroupId;
typedef IdString DecalId;
+typedef IdString BelBucketId;
struct ArchNetInfo
{