aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorgatecat <gatecat@ds0.me>2021-02-10 11:54:54 +0000
committergatecat <gatecat@ds0.me>2021-02-10 11:54:54 +0000
commit85bb108ba40f9573571de0a785f9fbc91c4e1dd0 (patch)
tree8f198b13a648057d21c8e839afea5c4463c6189b /common
parent6bd3dba1e39780e52097533f7e89f823d7e72956 (diff)
downloadnextpnr-85bb108ba40f9573571de0a785f9fbc91c4e1dd0.tar.gz
nextpnr-85bb108ba40f9573571de0a785f9fbc91c4e1dd0.tar.bz2
nextpnr-85bb108ba40f9573571de0a785f9fbc91c4e1dd0.zip
Add getBelPinsForCellPin to Arch API
This is a basic implementation, without considering "M of N" arrangements (e.g. for LUT permuation where you only want to route to 1 out of 4/6 sinks) or using a type other than IdString to identify bel pins. But this is also enough to start working out where in nextpnr will break due to removing the 1:1 cell:bel pin cardinality, as a next step. Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'common')
-rw-r--r--common/nextpnr.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h
index c43b9dc4..cf04f831 100644
--- a/common/nextpnr.h
+++ b/common/nextpnr.h
@@ -1093,6 +1093,7 @@ template <typename R> struct ArchAPI : BaseCtx
virtual WireId getBelPinWire(BelId bel, IdString pin) const = 0;
virtual PortType getBelPinType(BelId bel, IdString pin) const = 0;
virtual typename R::BelPinsRangeT getBelPins(BelId bel) const = 0;
+ virtual typename R::CellBelPinRangeT getBelPinsForCellPin(CellInfo *cell_info, IdString pin) const = 0;
// Wire methods
virtual typename R::AllWiresRangeT getWires() const = 0;
virtual WireId getWireByName(IdStringList name) const = 0;
@@ -1176,6 +1177,8 @@ template <typename R> struct ArchAPI : BaseCtx
// This contains the relevant range types for the default implementations of Arch functions
struct BaseArchRanges
{
+ // Bels
+ using CellBelPinRangeT = std::array<IdString, 1>;
// Attributes
using BelAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
using WireAttrsRangeT = std::vector<std::pair<IdString, std::string>>;
@@ -1241,6 +1244,11 @@ template <typename R> struct BaseArch : ArchAPI<R>
return empty_if_possible<typename R::BelAttrsRangeT>();
}
+ virtual typename R::CellBelPinRangeT getBelPinsForCellPin(CellInfo *cell_info, IdString pin) const override
+ {
+ return return_if_match<std::array<IdString, 1>, typename R::CellBelPinRangeT>({pin});
+ }
+
// Wire methods
virtual IdString getWireType(WireId wire) const override { return IdString(); }
virtual typename R::WireAttrsRangeT getWireAttrs(WireId) const override