diff options
Diffstat (limited to 'ecp5/globals.cc')
-rw-r--r-- | ecp5/globals.cc | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/ecp5/globals.cc b/ecp5/globals.cc index 8ee49c02..7b48e693 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -299,8 +299,8 @@ class Ecp5GlobalRouter dedicated_routing = false; if (drv.cell == nullptr) { return 0; - } else if (drv.cell->attrs.count(ctx->id("BEL"))) { - drv_bel = ctx->getBelByNameStr(drv.cell->attrs.at(ctx->id("BEL")).as_string()); + } else if (drv.cell->attrs.count(id_BEL)) { + drv_bel = ctx->getBelByNameStr(drv.cell->attrs.at(id_BEL).as_string()); } else { // Check if driver is a singleton BelId last_bel; @@ -399,7 +399,7 @@ class Ecp5GlobalRouter { BelId best_bel; WireId best_bel_pclkcib; - bool using_ce = get_net_or_empty(dcc, ctx->id("CE")) != nullptr; + bool using_ce = dcc->getPort(id_CE) != nullptr; wirelen_t best_wirelen = 9999999; bool dedicated_routing = false; for (auto bel : ctx->getBels()) { @@ -456,11 +456,10 @@ class Ecp5GlobalRouter dccptr = net->driver.cell; } else { auto dcc = create_ecp5_cell(ctx, id_DCCA, "$gbuf$" + net->name.str(ctx)); - std::unique_ptr<NetInfo> glbnet = std::unique_ptr<NetInfo>(new NetInfo); - glbnet->name = ctx->id("$glbnet$" + net->name.str(ctx)); - glbnet->driver.cell = dcc.get(); - glbnet->driver.port = id_CLKO; - dcc->ports[id_CLKO].net = glbnet.get(); + glbptr = ctx->createNet(ctx->id("$glbnet$" + net->name.str(ctx))); + glbptr->driver.cell = dcc.get(); + glbptr->driver.port = id_CLKO; + dcc->ports[id_CLKO].net = glbptr; std::vector<PortRef> keep_users; for (auto user : net->users) { if (dcs_cell != nullptr && user.cell != dcs_cell) { @@ -473,8 +472,8 @@ class Ecp5GlobalRouter } else if (is_logic_port(user)) { keep_users.push_back(user); } else { - glbnet->users.push_back(user); - user.cell->ports.at(user.port).net = glbnet.get(); + glbptr->users.push_back(user); + user.cell->ports.at(user.port).net = glbptr; } } net->users = keep_users; @@ -485,18 +484,16 @@ class Ecp5GlobalRouter clki_pr.cell = dcc.get(); net->users.push_back(clki_pr); if (net->clkconstr) { - glbnet->clkconstr = std::unique_ptr<ClockConstraint>(new ClockConstraint()); - glbnet->clkconstr->low = net->clkconstr->low; - glbnet->clkconstr->high = net->clkconstr->high; - glbnet->clkconstr->period = net->clkconstr->period; + glbptr->clkconstr = std::unique_ptr<ClockConstraint>(new ClockConstraint()); + glbptr->clkconstr->low = net->clkconstr->low; + glbptr->clkconstr->high = net->clkconstr->high; + glbptr->clkconstr->period = net->clkconstr->period; } - glbptr = glbnet.get(); - ctx->nets[glbnet->name] = std::move(glbnet); dccptr = dcc.get(); ctx->cells[dcc->name] = std::move(dcc); } - glbptr->attrs[ctx->id("ECP5_IS_GLOBAL")] = 1; - if (str_or_default(dccptr->attrs, ctx->id("BEL"), "") == "") + glbptr->attrs[id_ECP5_IS_GLOBAL] = 1; + if (str_or_default(dccptr->attrs, id_BEL, "") == "") place_dcc_dcs(dccptr); return glbptr; } @@ -517,8 +514,8 @@ class Ecp5GlobalRouter log_info("Promoting globals...\n"); auto clocks = get_clocks(); for (auto clock : clocks) { - bool is_noglobal = bool_or_default(clock->attrs, ctx->id("noglobal"), false) || - bool_or_default(clock->attrs, ctx->id("ECP5_IS_GLOBAL"), false); + bool is_noglobal = bool_or_default(clock->attrs, id_noglobal, false) || + bool_or_default(clock->attrs, id_ECP5_IS_GLOBAL, false); if (is_noglobal) continue; log_info(" promoting clock net %s to global network\n", clock->name.c_str(ctx)); @@ -536,7 +533,7 @@ class Ecp5GlobalRouter } for (auto ci : dcsc_cells) { for (auto port : {id_CLK0, id_CLK1}) { - NetInfo *net = get_net_or_empty(ci, port); + NetInfo *net = ci->getPort(port); if (net != nullptr) insert_dcc(net, ci); } @@ -612,7 +609,7 @@ class Ecp5GlobalRouter pins.push_back(id_CLK1); } for (auto pin : pins) { - NetInfo *ni = get_net_or_empty(ci, pin); + NetInfo *ni = ci->getPort(pin); if (ni == nullptr) continue; log_info(" trying dedicated routing for edge clock source %s\n", ctx->nameOf(ni)); |