diff options
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 |