diff options
author | gatecat <gatecat@ds0.me> | 2022-02-16 16:15:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-16 16:15:26 +0000 |
commit | 25c47e5b7e12d232cac9408b7d6d339ee11793b7 (patch) | |
tree | 7700f5ce4d8b40255aa54e08d2c4489e74b906ff /machxo2/cells.cc | |
parent | 02e6d2dbca0433e6f873c6af635cee701e84f5f5 (diff) | |
parent | 30fd86ce69fa65e89dec119e23b5bccb54de70a3 (diff) | |
download | nextpnr-25c47e5b7e12d232cac9408b7d6d339ee11793b7.tar.gz nextpnr-25c47e5b7e12d232cac9408b7d6d339ee11793b7.tar.bz2 nextpnr-25c47e5b7e12d232cac9408b7d6d339ee11793b7.zip |
Merge pull request #917 from YosysHQ/gatecat/netlist-i
refactor: New NetInfo and CellInfo constructors
Diffstat (limited to 'machxo2/cells.cc')
-rw-r--r-- | machxo2/cells.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/machxo2/cells.cc b/machxo2/cells.cc index 7334234d..534d8e3c 100644 --- a/machxo2/cells.cc +++ b/machxo2/cells.cc @@ -41,13 +41,9 @@ void add_port(const Context *ctx, CellInfo *cell, IdString id, PortType dir) std::unique_ptr<CellInfo> create_machxo2_cell(Context *ctx, IdString type, std::string name) { static int auto_idx = 0; - std::unique_ptr<CellInfo> new_cell = std::unique_ptr<CellInfo>(new CellInfo()); - if (name.empty()) { - new_cell->name = ctx->id("$nextpnr_" + type.str(ctx) + "_" + std::to_string(auto_idx++)); - } else { - new_cell->name = ctx->id(name); - } - new_cell->type = type; + IdString name_id = + name.empty() ? ctx->id("$nextpnr_" + type.str(ctx) + "_" + std::to_string(auto_idx++)) : ctx->id(name); + auto new_cell = std::make_unique<CellInfo>(ctx, name_id, type); if (type == id_FACADE_SLICE) { new_cell->params[id_MODE] = std::string("LOGIC"); |