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 /ice40 | |
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 'ice40')
-rw-r--r-- | ice40/arch.h | 10 | ||||
-rw-r--r-- | ice40/bitstream.cc | 8 | ||||
-rw-r--r-- | ice40/cells.cc | 2 | ||||
-rw-r--r-- | ice40/cells.h | 2 | ||||
-rw-r--r-- | ice40/chains.cc | 2 | ||||
-rw-r--r-- | ice40/pack.cc | 19 |
6 files changed, 21 insertions, 22 deletions
diff --git a/ice40/arch.h b/ice40/arch.h index 29396f49..9c9a118f 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -400,10 +400,10 @@ struct Arch : BaseArch<ArchRanges> const ChipInfoPOD *chip_info; const PackageInfoPOD *package_info; - mutable std::unordered_map<IdStringList, int> bel_by_name; - mutable std::unordered_map<IdStringList, int> wire_by_name; - mutable std::unordered_map<IdStringList, int> pip_by_name; - mutable std::unordered_map<Loc, int> bel_by_loc; + mutable dict<IdStringList, int> bel_by_name; + mutable dict<IdStringList, int> wire_by_name; + mutable dict<IdStringList, int> pip_by_name; + mutable dict<Loc, int> bel_by_loc; std::vector<bool> bel_carry; std::vector<CellInfo *> bel_to_cell; @@ -414,7 +414,7 @@ struct Arch : BaseArch<ArchRanges> // fast access to X and Y IdStrings for building object names std::vector<IdString> x_ids, y_ids; // inverse of the above for name->object mapping - std::unordered_map<IdString, int> id_to_x, id_to_y; + dict<IdString, int> id_to_x, id_to_y; ArchArgs args; Arch(ArchArgs args); diff --git a/ice40/bitstream.cc b/ice40/bitstream.cc index 6b625b6a..56b5561c 100644 --- a/ice40/bitstream.cc +++ b/ice40/bitstream.cc @@ -252,7 +252,7 @@ static BelPin get_one_bel_pin(const Context *ctx, WireId wire) } // Permute LUT init value given map (LUT input -> ext input) -unsigned permute_lut(unsigned orig_init, const std::unordered_map<int, int> &input_permute) +unsigned permute_lut(unsigned orig_init, const dict<int, int> &input_permute) { unsigned new_init = 0; @@ -387,8 +387,8 @@ void write_asc(const Context *ctx, std::ostream &out) } // Scan for PLL and collects the affected SB_IOs - std::unordered_set<Loc> sb_io_used_by_pll_out; - std::unordered_set<Loc> sb_io_used_by_pll_pad; + pool<Loc> sb_io_used_by_pll_out; + pool<Loc> sb_io_used_by_pll_pad; for (auto &cell : ctx->cells) { if (cell.second->type != ctx->id("ICESTORM_PLL")) @@ -447,7 +447,7 @@ void write_asc(const Context *ctx, std::ostream &out) std::vector<bool> lc(20, false); // Discover permutation - std::unordered_map<int, int> input_perm; + dict<int, int> input_perm; std::set<int> unused; for (int i = 0; i < 4; i++) unused.insert(i); diff --git a/ice40/cells.cc b/ice40/cells.cc index d23b6c49..9517c590 100644 --- a/ice40/cells.cc +++ b/ice40/cells.cc @@ -412,7 +412,7 @@ void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_l replace_port(dff, ctx->id("Q"), lc, ctx->id("O")); } -void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, std::unordered_set<IdString> &todelete_cells) +void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, pool<IdString> &todelete_cells) { if (nxio->type == ctx->id("$nextpnr_ibuf")) { sbio->params[ctx->id("PIN_TYPE")] = 1; diff --git a/ice40/cells.h b/ice40/cells.h index 777ca3e2..d4c0edf4 100644 --- a/ice40/cells.h +++ b/ice40/cells.h @@ -130,7 +130,7 @@ void lut_to_lc(const Context *ctx, CellInfo *lut, CellInfo *lc, bool no_dff = tr void dff_to_lc(const Context *ctx, CellInfo *dff, CellInfo *lc, bool pass_thru_lut = false); // Convert a nextpnr IO buffer to a SB_IO -void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, std::unordered_set<IdString> &todelete_cells); +void nxio_to_sb(Context *ctx, CellInfo *nxio, CellInfo *sbio, pool<IdString> &todelete_cells); // Return true if a port is a clock port bool is_clock_port(const BaseCtx *ctx, const PortRef &port); diff --git a/ice40/chains.cc b/ice40/chains.cc index f75d329f..cfc8b4a1 100644 --- a/ice40/chains.cc +++ b/ice40/chains.cc @@ -253,7 +253,7 @@ class ChainConstrainer return i3_next; return (CellInfo *)nullptr; }); - std::unordered_set<IdString> chained; + pool<IdString> chained; for (auto &base_chain : carry_chains) { for (auto c : base_chain.cells) chained.insert(c->name); diff --git a/ice40/pack.cc b/ice40/pack.cc index 1d05a8c2..62b08534 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -21,7 +21,6 @@ #include <algorithm> #include <iterator> -#include <unordered_set> #include "cells.h" #include "chains.h" #include "design_utils.h" @@ -35,7 +34,7 @@ static void pack_lut_lutffs(Context *ctx) { log_info("Packing LUT-FFs..\n"); int lut_only = 0, lut_and_ff = 0; - std::unordered_set<IdString> packed_cells; + pool<IdString> packed_cells; std::vector<std::unique_ptr<CellInfo>> new_cells; for (auto &cell : ctx->cells) { CellInfo *ci = cell.second.get(); @@ -100,7 +99,7 @@ static void pack_nonlut_ffs(Context *ctx) { log_info("Packing non-LUT FFs..\n"); - std::unordered_set<IdString> packed_cells; + pool<IdString> packed_cells; std::vector<std::unique_ptr<CellInfo>> new_cells; int ff_only = 0; @@ -144,8 +143,8 @@ static bool net_is_constant(const Context *ctx, NetInfo *net, bool &value) static void pack_carries(Context *ctx) { log_info("Packing carries..\n"); - std::unordered_set<IdString> exhausted_cells; - std::unordered_set<IdString> packed_cells; + pool<IdString> exhausted_cells; + pool<IdString> packed_cells; std::vector<std::unique_ptr<CellInfo>> new_cells; int carry_only = 0; @@ -274,7 +273,7 @@ static void pack_ram(Context *ctx) { log_info("Packing RAMs..\n"); - std::unordered_set<IdString> packed_cells; + pool<IdString> packed_cells; std::vector<std::unique_ptr<CellInfo>> new_cells; for (auto &cell : ctx->cells) { @@ -466,8 +465,8 @@ static bool is_ice_iob(const Context *ctx, const CellInfo *cell) // Pack IO buffers static void pack_io(Context *ctx) { - std::unordered_set<IdString> packed_cells; - std::unordered_set<IdString> delete_nets; + pool<IdString> packed_cells; + pool<IdString> delete_nets; std::vector<std::unique_ptr<CellInfo>> new_cells; log_info("Packing IOs..\n"); @@ -1119,7 +1118,7 @@ static void pack_special(Context *ctx) { log_info("Packing special functions..\n"); - std::unordered_set<IdString> packed_cells; + pool<IdString> packed_cells; std::vector<std::unique_ptr<CellInfo>> new_cells; // Handle LED_DRV_CUR first to set the ledCurConnected flag before RGB_DRV is handled below. @@ -1299,7 +1298,7 @@ void pack_plls(Context *ctx) { log_info("Packing PLLs..\n"); - std::unordered_set<IdString> packed_cells; + pool<IdString> packed_cells; std::vector<std::unique_ptr<CellInfo>> new_cells; for (auto &cell : ctx->cells) { CellInfo *ci = cell.second.get(); |