From 2285c8dbbdbc5b7e718fa849952c560bef69a8fc Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 28 Jan 2021 15:40:26 -0800 Subject: Initial refactoring of placer API. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- gowin/arch.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'gowin') diff --git a/gowin/arch.h b/gowin/arch.h index 5591744d..100ba5ba 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -422,6 +422,9 @@ 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); + } bool isValidBelForCell(CellInfo *cell, BelId bel) const; bool isBelLocationValid(BelId bel) const; -- cgit v1.2.3 From 0338368afa369d097dfb35e0705fef10baa3d20e Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Thu, 28 Jan 2021 19:24:00 -0800 Subject: Add Partition APIs to ice40, nexus, gowin archs. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- gowin/arch.cc | 9 +++++++++ gowin/arch.h | 37 +++++++++++++++++++++++++++++++++++++ gowin/archdefs.h | 1 + 3 files changed, 47 insertions(+) (limited to 'gowin') 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 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 &getCellTypes() const { + return cell_types; + } + + std::vector 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 getBelsForPartition(PartitionId partition) const { + std::vector 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 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 { -- cgit v1.2.3 From 9fe546f279cd643a308322ffa6af622630892315 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Fri, 29 Jan 2021 14:55:10 -0800 Subject: Rename Partition -> BelBucket. Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- gowin/arch.h | 16 ++++++++-------- gowin/archdefs.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'gowin') diff --git a/gowin/arch.h b/gowin/arch.h index f7379a3c..6304a15c 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -430,30 +430,30 @@ struct Arch : BaseCtx return cell_types; } - std::vector getPartitions() const { + std::vector getBelBuckets() const { return cell_types; } - IdString getPartitionName(PartitionId partition) const { - return partition; + IdString getBelBucketName(BelBucketId bucket) const { + return bucket; } - PartitionId getPartitionByName(IdString name) const { + BelBucketId getBelBucketByName(IdString name) const { return name; } - PartitionId getPartitionForBel(BelId bel) const { + BelBucketId getBelBucketForBel(BelId bel) const { return getBelType(bel); } - PartitionId getPartitionForCellType(IdString cell_type) const { + BelBucketId getBelBucketForCellType(IdString cell_type) const { return cell_type; } - std::vector getBelsForPartition(PartitionId partition) const { + std::vector getBelsInBucket(BelBucketId bucket) const { std::vector bels; for(BelId bel : getBels()) { - if(getBelType(bel) == partition) { + if(getBelType(bel) == bucket) { bels.push_back(bel); } } diff --git a/gowin/archdefs.h b/gowin/archdefs.h index 96ab5c6d..2efe1437 100644 --- a/gowin/archdefs.h +++ b/gowin/archdefs.h @@ -72,7 +72,7 @@ typedef IdString WireId; typedef IdString PipId; typedef IdString GroupId; typedef IdString DecalId; -typedef IdString PartitionId; +typedef IdString BelBucketId; struct ArchNetInfo { -- cgit v1.2.3 From da74a425d23352d7cddf9d1c4b0b7c86dd567c40 Mon Sep 17 00:00:00 2001 From: Keith Rothman <537074+litghost@users.noreply.github.com> Date: Mon, 1 Feb 2021 14:28:32 -0800 Subject: Run "make clangformat". Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com> --- gowin/arch.cc | 4 ++-- gowin/arch.h | 35 +++++++++++------------------------ 2 files changed, 13 insertions(+), 26 deletions(-) (limited to 'gowin') diff --git a/gowin/arch.cc b/gowin/arch.cc index cd4048ca..5a1a56e3 100644 --- a/gowin/arch.cc +++ b/gowin/arch.cc @@ -741,11 +741,11 @@ Arch::Arch(ArchArgs args) : args(args) decal_graphics[IdString()]; std::unordered_set bel_types; - for(BelId bel : getBels()) { + for (BelId bel : getBels()) { bel_types.insert(getBelType(bel)); } - for(IdString bel_type : bel_types) { + for (IdString bel_type : bel_types) { cell_types.push_back(bel_type); } } diff --git a/gowin/arch.h b/gowin/arch.h index 6304a15c..f12c604e 100644 --- a/gowin/arch.h +++ b/gowin/arch.h @@ -422,38 +422,25 @@ 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); - } + bool isValidBelForCellType(IdString cell_type, BelId bel) const { return cell_type == getBelType(bel); } - const std::vector &getCellTypes() const { - return cell_types; - } + const std::vector &getCellTypes() const { return cell_types; } - std::vector getBelBuckets() const { - return cell_types; - } + std::vector getBelBuckets() const { return cell_types; } - IdString getBelBucketName(BelBucketId bucket) const { - return bucket; - } + IdString getBelBucketName(BelBucketId bucket) const { return bucket; } - BelBucketId getBelBucketByName(IdString name) const { - return name; - } + BelBucketId getBelBucketByName(IdString name) const { return name; } - BelBucketId getBelBucketForBel(BelId bel) const { - return getBelType(bel); - } + BelBucketId getBelBucketForBel(BelId bel) const { return getBelType(bel); } - BelBucketId getBelBucketForCellType(IdString cell_type) const { - return cell_type; - } + BelBucketId getBelBucketForCellType(IdString cell_type) const { return cell_type; } - std::vector getBelsInBucket(BelBucketId bucket) const { + std::vector getBelsInBucket(BelBucketId bucket) const + { std::vector bels; - for(BelId bel : getBels()) { - if(getBelType(bel) == bucket) { + for (BelId bel : getBels()) { + if (getBelType(bel) == bucket) { bels.push_back(bel); } } -- cgit v1.2.3