aboutsummaryrefslogtreecommitdiffstats
path: root/generic/cells.cc
diff options
context:
space:
mode:
Diffstat (limited to 'generic/cells.cc')
-rw-r--r--generic/cells.cc10
1 files changed, 3 insertions, 7 deletions
diff --git a/generic/cells.cc b/generic/cells.cc
index 44b99050..967afb23 100644
--- a/generic/cells.cc
+++ b/generic/cells.cc
@@ -34,13 +34,9 @@ void add_port(const Context *ctx, CellInfo *cell, std::string name, PortType dir
std::unique_ptr<CellInfo> create_generic_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 == ctx->id("GENERIC_SLICE")) {
new_cell->params[ctx->id("K")] = ctx->args.K;
new_cell->params[ctx->id("INIT")] = 0;