diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-07-22 12:08:52 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-07-22 12:08:52 +0200 |
commit | e13fc7edabb449d21ad6473bab23d5c1b2cf3761 (patch) | |
tree | 88fd3c6f3b69f9cc84bb0aad28f1649e5ddf6776 | |
parent | b60c9485d2d324a221c7050aa6437b291b3dedf4 (diff) | |
download | nextpnr-e13fc7edabb449d21ad6473bab23d5c1b2cf3761.tar.gz nextpnr-e13fc7edabb449d21ad6473bab23d5c1b2cf3761.tar.bz2 nextpnr-e13fc7edabb449d21ad6473bab23d5c1b2cf3761.zip |
Add Arch::getBelPins() to generic and iCE40 archs
Signed-off-by: Clifford Wolf <clifford@clifford.at>
-rw-r--r-- | generic/arch.cc | 7 | ||||
-rw-r--r-- | generic/arch.h | 1 | ||||
-rw-r--r-- | ice40/arch.cc | 15 | ||||
-rw-r--r-- | ice40/arch.h | 2 |
4 files changed, 25 insertions, 0 deletions
diff --git a/generic/arch.cc b/generic/arch.cc index 8c7a7670..0f2f5fe3 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -226,6 +226,13 @@ BelPin Arch::getBelPinUphill(WireId wire) const { return wires.at(wire).uphill_b const std::vector<BelPin> &Arch::getBelPinsDownhill(WireId wire) const { return wires.at(wire).downhill_bel_pins; } +std::vector<PortPin> Arch::getBelPins(BelId bel) const +{ + std::vector<PortPin> ret; + for (auto &it : bels.at(bel).pins) + ret.push_back(it.first); +} + // --------------------------------------------------------------- WireId Arch::getWireByName(IdString name) const diff --git a/generic/arch.h b/generic/arch.h index 2a74b1ae..e650906d 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -150,6 +150,7 @@ struct Arch : BaseCtx PortType getBelPinType(BelId bel, PortPin pin) const; BelPin getBelPinUphill(WireId wire) const NPNR_DEPRECATED; const std::vector<BelPin> &getBelPinsDownhill(WireId wire) const NPNR_DEPRECATED; + std::vector<PortPin> getBelPins(BelId bel) const; WireId getWireByName(IdString name) const; IdString getWireName(WireId wire) const; diff --git a/ice40/arch.cc b/ice40/arch.cc index 5f0384a3..65b21afd 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -340,6 +340,21 @@ WireId Arch::getBelPinWire(BelId bel, PortPin pin) const return ret; } +std::vector<PortPin> Arch::getBelPins(BelId bel) const +{ + std::vector<PortPin> ret; + + NPNR_ASSERT(bel != BelId()); + + int num_bel_wires = chip_info->bel_data[bel.index].num_bel_wires; + const BelWirePOD *bel_wires = chip_info->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; +} + // ----------------------------------------------------------------------- WireId Arch::getWireByName(IdString name) const diff --git a/ice40/arch.h b/ice40/arch.h index f3016424..2e2018fb 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -494,6 +494,8 @@ struct Arch : BaseCtx return range; } + std::vector<PortPin> getBelPins(BelId bel) const; + // ------------------------------------------------- WireId getWireByName(IdString name) const; |