diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/basectx.cc | 7 | ||||
| -rw-r--r-- | common/design_utils.cc | 8 | ||||
| -rw-r--r-- | common/nextpnr_types.h | 6 | 
3 files changed, 10 insertions, 11 deletions
diff --git a/common/basectx.cc b/common/basectx.cc index b9036ed6..b55cd072 100644 --- a/common/basectx.cc +++ b/common/basectx.cc @@ -211,8 +211,7 @@ NetInfo *BaseCtx::createNet(IdString name)  {      NPNR_ASSERT(!nets.count(name));      NPNR_ASSERT(!net_aliases.count(name)); -    std::unique_ptr<NetInfo> net{new NetInfo}; -    net->name = name; +    auto net = std::make_unique<NetInfo>(name);      net_aliases[name] = name;      NetInfo *ptr = net.get();      nets[name] = std::move(net); @@ -252,9 +251,7 @@ void BaseCtx::lockNetRouting(IdString name)  CellInfo *BaseCtx::createCell(IdString name, IdString type)  {      NPNR_ASSERT(!cells.count(name)); -    std::unique_ptr<CellInfo> cell{new CellInfo}; -    cell->name = name; -    cell->type = type; +    auto cell = std::make_unique<CellInfo>(getCtx(), name, type);      CellInfo *ptr = cell.get();      cells[name] = std::move(cell);      refreshUi(); diff --git a/common/design_utils.cc b/common/design_utils.cc index da5decf9..9432b6cd 100644 --- a/common/design_utils.cc +++ b/common/design_utils.cc @@ -129,12 +129,8 @@ void connect_ports(Context *ctx, CellInfo *cell1, IdString port1_name, CellInfo      PortInfo &port1 = cell1->ports.at(port1_name);      if (port1.net == nullptr) {          // No net on port1; need to create one -        std::unique_ptr<NetInfo> p1net(new NetInfo()); -        p1net->name = ctx->id(cell1->name.str(ctx) + "$conn$" + port1_name.str(ctx)); -        connect_port(ctx, p1net.get(), cell1, port1_name); -        IdString p1name = p1net->name; -        NPNR_ASSERT(!ctx->cells.count(p1name)); -        ctx->nets[p1name] = std::move(p1net); +        NetInfo *p1net = ctx->createNet(ctx->id(cell1->name.str(ctx) + "$conn$" + port1_name.str(ctx))); +        connect_port(ctx, p1net, cell1, port1_name);      }      connect_port(ctx, port1.net, cell2, port2_name);  } diff --git a/common/nextpnr_types.h b/common/nextpnr_types.h index 6b594d64..6debd2b8 100644 --- a/common/nextpnr_types.h +++ b/common/nextpnr_types.h @@ -124,6 +124,7 @@ struct ClockConstraint;  struct NetInfo : ArchNetInfo  { +    explicit NetInfo(IdString name) : name(name){};      IdString name, hierpath;      int32_t udata = 0; @@ -155,8 +156,13 @@ struct PortInfo      PortType type;  }; +struct Context; +  struct CellInfo : ArchCellInfo  { +    CellInfo(Context *ctx, IdString name, IdString type) : ctx(ctx), name(name), type(type){}; +    Context *ctx = nullptr; +      IdString name, type, hierpath;      int32_t udata;  | 
