From 64208da1f986f104682c9c050c43f2273900810a Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 25 Jun 2018 16:29:37 +0200 Subject: [PATCH] ice40: Remove constant driver cells in packer Signed-off-by: David Shah --- ice40/pack.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ice40/pack.cc b/ice40/pack.cc index dd9fba27..d0419098 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -263,12 +263,16 @@ static void pack_constants(Context *ctx) for (auto net : sorted(ctx->nets)) { NetInfo *ni = net.second; 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); gnd_used = true; dead_nets.push_back(net.first); + ctx->cells.erase(drv_cell); } 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); dead_nets.push_back(net.first); + ctx->cells.erase(drv_cell); } } @@ -284,8 +288,9 @@ static void pack_constants(Context *ctx) ctx->cells[vcc_cell->name] = vcc_cell; ctx->nets[vcc_net->name] = vcc_net; - for (auto dn : dead_nets) + for (auto dn : dead_nets) { ctx->nets.erase(dn); + } } static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)