ice40: Remove constant driver cells in packer

Signed-off-by: David Shah <davey1576@gmail.com>
This commit is contained in:
David Shah 2018-06-25 16:29:37 +02:00
parent a279720fc1
commit 64208da1f9

View File

@ -263,12 +263,16 @@ static void pack_constants(Context *ctx)
for (auto net : sorted(ctx->nets)) { for (auto net : sorted(ctx->nets)) {
NetInfo *ni = net.second; NetInfo *ni = net.second;
if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("GND")) { if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("GND")) {
IdString drv_cell = ni->driver.cell->name;
set_net_constant(ctx, ni, gnd_net, false); set_net_constant(ctx, ni, gnd_net, false);
gnd_used = true; gnd_used = true;
dead_nets.push_back(net.first); dead_nets.push_back(net.first);
ctx->cells.erase(drv_cell);
} else if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("VCC")) { } else if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("VCC")) {
IdString drv_cell = ni->driver.cell->name;
set_net_constant(ctx, ni, vcc_net, true); set_net_constant(ctx, ni, vcc_net, true);
dead_nets.push_back(net.first); dead_nets.push_back(net.first);
ctx->cells.erase(drv_cell);
} }
} }
@ -284,9 +288,10 @@ static void pack_constants(Context *ctx)
ctx->cells[vcc_cell->name] = vcc_cell; ctx->cells[vcc_cell->name] = vcc_cell;
ctx->nets[vcc_net->name] = vcc_net; ctx->nets[vcc_net->name] = vcc_net;
for (auto dn : dead_nets) for (auto dn : dead_nets) {
ctx->nets.erase(dn); ctx->nets.erase(dn);
} }
}
static bool is_nextpnr_iob(Context *ctx, CellInfo *cell) static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)
{ {