diff options
author | gatecat <gatecat@ds0.me> | 2021-06-02 10:01:36 +0100 |
---|---|---|
committer | gatecat <gatecat@ds0.me> | 2021-06-02 15:05:19 +0100 |
commit | ecc19c2c083f7e3ed7da95557731ded803d2cb1d (patch) | |
tree | 864780d38cb9a49b6846a0045ac93e1b4dfcc88d /mistral | |
parent | f4fed62c05a9595e22a8ec54add5531225911741 (diff) | |
download | nextpnr-ecc19c2c083f7e3ed7da95557731ded803d2cb1d.tar.gz nextpnr-ecc19c2c083f7e3ed7da95557731ded803d2cb1d.tar.bz2 nextpnr-ecc19c2c083f7e3ed7da95557731ded803d2cb1d.zip |
Using hashlib in arches
Signed-off-by: gatecat <gatecat@ds0.me>
Diffstat (limited to 'mistral')
-rw-r--r-- | mistral/arch.h | 29 | ||||
-rw-r--r-- | mistral/archdefs.h | 2 | ||||
-rw-r--r-- | mistral/lab.cc | 4 | ||||
-rw-r--r-- | mistral/pins.cc | 2 | ||||
-rw-r--r-- | mistral/qsf.cc | 2 |
5 files changed, 19 insertions, 20 deletions
diff --git a/mistral/arch.h b/mistral/arch.h index ee2c84a3..1a42530a 100644 --- a/mistral/arch.h +++ b/mistral/arch.h @@ -85,7 +85,7 @@ struct BelInfo // For cases where we need to determine an original block index, due to multiple bels at the same tile this // might not be the same as the nextpnr z-coordinate int block_index; - std::unordered_map<IdString, PinInfo> pins; + dict<IdString, PinInfo> pins; // Info for different kinds of bels union { @@ -153,7 +153,7 @@ struct UpDownhillPipRange UpDownhillPipIterator b, e; UpDownhillPipRange(const std::vector<WireId> &v, WireId other_wire, bool is_uphill) - : b(v.cbegin(), other_wire, is_uphill), e(v.cend(), other_wire, is_uphill){}; + : b(v.begin(), other_wire, is_uphill), e(v.end(), other_wire, is_uphill){}; UpDownhillPipIterator begin() const { return b; } UpDownhillPipIterator end() const { return e; } @@ -161,7 +161,7 @@ struct UpDownhillPipRange // This iterates over the list of wires, and for each wire yields its uphill pips, as an efficient way of going over // all the pips in the device -using WireMapIterator = std::unordered_map<WireId, WireInfo>::const_iterator; +using WireMapIterator = dict<WireId, WireInfo>::const_iterator; struct AllPipIterator { WireMapIterator base, end; @@ -196,8 +196,7 @@ struct AllPipRange { AllPipIterator b, e; - AllPipRange(const std::unordered_map<WireId, WireInfo> &wires) - : b(wires.cbegin(), wires.cend(), -1), e(wires.cend(), wires.cend(), 0) + AllPipRange(const dict<WireId, WireInfo> &wires) : b(wires.begin(), wires.end(), -1), e(wires.end(), wires.end(), 0) { // Starting the begin iterator at index -1 and incrementing it ensures we skip over the first wire if it has no // uphill pips @@ -211,7 +210,7 @@ struct AllPipRange // This transforms a map to a range of keys, used as the wire iterator template <typename T> struct key_range { - key_range(const T &t) : b(t.cbegin()), e(t.cend()){}; + key_range(const T &t) : b(t.begin()), e(t.end()){}; typename T::const_iterator b, e; struct xformed_iterator : public T::const_iterator @@ -224,7 +223,7 @@ template <typename T> struct key_range xformed_iterator end() const { return xformed_iterator(e); } }; -using AllWireRange = key_range<std::unordered_map<WireId, WireInfo>>; +using AllWireRange = key_range<dict<WireId, WireInfo>>; struct ArchRanges : BaseArchRanges { @@ -489,7 +488,7 @@ struct Arch : BaseArch<ArchRanges> static const std::string defaultRouter; static const std::vector<std::string> availableRouters; - std::unordered_map<WireId, WireInfo> wires; + dict<WireId, WireInfo> wires; // List of LABs std::vector<LABInfo> labs; @@ -499,13 +498,13 @@ struct Arch : BaseArch<ArchRanges> // Conversion between numbers and rnode types and IdString, for fast wire name implementation std::vector<IdString> int2id; - std::unordered_map<IdString, int> id2int; + dict<IdString, int> id2int; std::vector<IdString> rn_t2id; - std::unordered_map<IdString, CycloneV::rnode_type_t> id2rn_t; + dict<IdString, CycloneV::rnode_type_t> id2rn_t; // This structure is only used for nextpnr-created wires - std::unordered_map<IdStringList, WireId> npnr_wirebyname; + dict<IdStringList, WireId> npnr_wirebyname; std::vector<std::vector<BelInfo>> bels_by_tile; std::vector<BelId> all_bels; @@ -525,18 +524,18 @@ struct Arch : BaseArch<ArchRanges> // ------------------------------------------------- void assign_default_pinmap(CellInfo *cell); - static const std::unordered_map<IdString, IdString> comb_pinmap; + static const dict<IdString, IdString> comb_pinmap; // ------------------------------------------------- - typedef std::unordered_map<IdString, CellPinStyle> CellPinsData; // pins.cc - static const std::unordered_map<IdString, CellPinsData> cell_pins_db; // pins.cc + typedef dict<IdString, CellPinStyle> CellPinsData; // pins.cc + static const dict<IdString, CellPinsData> cell_pins_db; // pins.cc CellPinStyle get_cell_pin_style(const CellInfo *cell, IdString port) const; // pins.cc // ------------------------------------------------- // List of IO constraints, used by QSF parser - std::unordered_map<IdString, std::unordered_map<IdString, Property>> io_attr; + dict<IdString, dict<IdString, Property>> io_attr; void read_qsf(std::istream &in); // qsf.cc // ------------------------------------------------- diff --git a/mistral/archdefs.h b/mistral/archdefs.h index 9d953223..71e14ec2 100644 --- a/mistral/archdefs.h +++ b/mistral/archdefs.h @@ -203,7 +203,7 @@ struct ArchCellInfo : BaseClusterInfo } ffInfo; }; - std::unordered_map<IdString, ArchPinInfo> pin_data; + dict<IdString, ArchPinInfo> pin_data; CellPinState get_pin_state(IdString pin) const; }; diff --git a/mistral/lab.cc b/mistral/lab.cc index abd0fec3..56bc604a 100644 --- a/mistral/lab.cc +++ b/mistral/lab.cc @@ -718,7 +718,7 @@ void Arch::reassign_alm_inputs(uint32_t lab, uint8_t alm) // - C, E0, and F0 are exclusive to the top LUT5 secion // - D, E1, and F1 are exclusive to the bottom LUT5 section // First find up to two shared inputs - std::unordered_map<IdString, int> shared_nets; + dict<IdString, int> shared_nets; if (luts[0] && luts[1]) { for (int i = 0; i < luts[0]->combInfo.lut_input_count; i++) { for (int j = 0; j < luts[1]->combInfo.lut_input_count; j++) { @@ -826,7 +826,7 @@ void Arch::reassign_alm_inputs(uint32_t lab, uint8_t alm) // This default cell-bel pin mapping is used to provide estimates during placement only. It will have errors and // overlaps and a correct mapping will be resolved twixt placement and routing -const std::unordered_map<IdString, IdString> Arch::comb_pinmap = { +const dict<IdString, IdString> Arch::comb_pinmap = { {id_A, id_F0}, // fastest input first {id_B, id_E0}, {id_C, id_D}, {id_D, id_C}, {id_D0, id_C}, {id_D1, id_B}, {id_E, id_B}, {id_F, id_A}, {id_Q, id_COMBOUT}, {id_SO, id_COMBOUT}, diff --git a/mistral/pins.cc b/mistral/pins.cc index c3637115..51cb83c4 100644 --- a/mistral/pins.cc +++ b/mistral/pins.cc @@ -23,7 +23,7 @@ NEXTPNR_NAMESPACE_BEGIN -const std::unordered_map<IdString, Arch::CellPinsData> Arch::cell_pins_db = { +const dict<IdString, Arch::CellPinsData> Arch::cell_pins_db = { // For combinational cells, inversion and tieing can be implemented by manipulating the LUT function {id_MISTRAL_ALUT2, {{{}, PINSTYLE_COMB}}}, {id_MISTRAL_ALUT3, {{{}, PINSTYLE_COMB}}}, diff --git a/mistral/qsf.cc b/mistral/qsf.cc index 9a128595..88f51b1b 100644 --- a/mistral/qsf.cc +++ b/mistral/qsf.cc @@ -34,7 +34,7 @@ struct QsfOption bool required; // error out if this option isn't passed }; -typedef std::unordered_map<std::string, std::vector<std::string>> option_map_t; +typedef dict<std::string, std::vector<std::string>> option_map_t; struct QsfCommand { |