diff options
author | David Shah <davey1576@gmail.com> | 2018-07-22 17:07:38 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-07-22 17:07:38 +0200 |
commit | 987fdc1b29d9cb7478df49c72f68ce5f3f9f740c (patch) | |
tree | fc405e99fe588df25bdd776913733df91b67eaac /ecp5/arch.cc | |
parent | 38431bd420ff2dcbaa9581571e6d0302dcfe2379 (diff) | |
download | nextpnr-987fdc1b29d9cb7478df49c72f68ce5f3f9f740c.tar.gz nextpnr-987fdc1b29d9cb7478df49c72f68ce5f3f9f740c.tar.bz2 nextpnr-987fdc1b29d9cb7478df49c72f68ce5f3f9f740c.zip |
ecp5: Adding new Bel pin API
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/arch.cc')
-rw-r--r-- | ecp5/arch.cc | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc index c7896ca6..90950492 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -224,6 +224,20 @@ WireId Arch::getBelPinWire(BelId bel, PortPin pin) const return ret; } +PortType Arch::getBelPinType(BelId bel, PortPin pin) const +{ + NPNR_ASSERT(bel != BelId()); + + int num_bel_wires = locInfo(bel)->bel_data[bel.index].num_bel_wires; + const BelWirePOD *bel_wires = locInfo(bel)->bel_data[bel.index].bel_wires.get(); + + for (int i = 0; i < num_bel_wires; i++) + if (bel_wires[i].port == pin) + return PortType(bel_wires[i].type); + + return PORT_INOUT; +} + // ----------------------------------------------------------------------- WireId Arch::getWireByName(IdString name) const @@ -314,6 +328,22 @@ std::string Arch::getBelPackagePin(BelId bel) const } return ""; } + +std::vector<PortPin> Arch::getBelPins(BelId bel) const + +{ + std::vector<PortPin> ret; + NPNR_ASSERT(bel != BelId()); + + int num_bel_wires = locInfo(bel)->bel_data[bel.index].num_bel_wires; + const BelWirePOD *bel_wires = locInfo(bel)->bel_data[bel.index].bel_wires.get(); + + for (int i = 0; i < num_bel_wires; i++) + ret.push_back(bel_wires[i].port); + + return ret; +} + // ----------------------------------------------------------------------- void Arch::estimatePosition(BelId bel, int &x, int &y, bool &gb) const |