diff options
author | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-01-28 19:24:00 -0800 |
---|---|---|
committer | Keith Rothman <537074+litghost@users.noreply.github.com> | 2021-02-02 07:34:56 -0800 |
commit | 0338368afa369d097dfb35e0705fef10baa3d20e (patch) | |
tree | 961e59d870aa6df324ef723c72dd008390588f16 /gowin | |
parent | d03d9d839b7e49a4bf3428e949bda85574adf403 (diff) | |
download | nextpnr-0338368afa369d097dfb35e0705fef10baa3d20e.tar.gz nextpnr-0338368afa369d097dfb35e0705fef10baa3d20e.tar.bz2 nextpnr-0338368afa369d097dfb35e0705fef10baa3d20e.zip |
Add Partition APIs to ice40, nexus, gowin archs.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
Diffstat (limited to 'gowin')
-rw-r--r-- | gowin/arch.cc | 9 | ||||
-rw-r--r-- | gowin/arch.h | 37 | ||||
-rw-r--r-- | gowin/archdefs.h | 1 |
3 files changed, 47 insertions, 0 deletions
diff --git a/gowin/arch.cc b/gowin/arch.cc index b3a6a47d..cd4048ca 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 100ba5ba..f7379a3c 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -425,6 +425,41 @@ struct Arch : BaseCtx bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); } + + const std::vector<IdString> &getCellTypes() const { + return cell_types; + } + + std::vector<PartitionId> getPartitions() const { + return cell_types; + } + + IdString getPartitionName(PartitionId partition) const { + return partition; + } + + PartitionId getPartitionByName(IdString name) const { + return name; + } + + PartitionId getPartitionForBel(BelId bel) const { + return getBelType(bel); + } + + PartitionId getPartitionForCellType(IdString cell_type) const { + return cell_type; + } + + std::vector<BelId> getBelsForPartition(PartitionId partition) const { + std::vector<BelId> bels; + for(BelId bel : getBels()) { + if(getBelType(bel) == partition) { + bels.push_back(bel); + } + } + return bels; + } + bool isValidBelForCell(CellInfo *cell, BelId bel) const; bool isBelLocationValid(BelId bel) const; @@ -437,6 +472,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..96ab5c6d 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 PartitionId; struct ArchNetInfo { |