diff options
Diffstat (limited to 'ice40/pack.cc')
-rw-r--r-- | ice40/pack.cc | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index 92f9a369..d3f07118 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -203,23 +203,33 @@ static void pack_constants(Context *ctx) std::vector<IdString> dead_nets; + bool gnd_used = false, vcc_used = false; + for (auto net : ctx->nets) { NetInfo *ni = net.second; if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("GND")) { set_net_constant(ctx, ni, gnd_net, false); - ctx->cells[gnd_cell->name] = gnd_cell; - ctx->nets[gnd_net->name] = gnd_net; + gnd_used = true; dead_nets.push_back(net.first); } else if (ni->driver.cell != nullptr && ni->driver.cell->type == ctx->id("VCC")) { set_net_constant(ctx, ni, vcc_net, true); - ctx->cells[vcc_cell->name] = vcc_cell; - ctx->nets[vcc_net->name] = vcc_net; + vcc_used = true; dead_nets.push_back(net.first); } } + if (gnd_used) { + ctx->cells[gnd_cell->name] = gnd_cell; + ctx->nets[gnd_net->name] = gnd_net; + } + + if (vcc_used) { + ctx->cells[vcc_cell->name] = vcc_cell; + ctx->nets[vcc_net->name] = vcc_net; + } + for (auto dn : dead_nets) ctx->nets.erase(dn); } @@ -265,7 +275,8 @@ static void pack_io(Context *ctx) } } else { // Create a SB_IO buffer - sb = create_ice_cell(ctx, "SB_IO"); + sb = create_ice_cell(ctx, "SB_IO", + ci->name.str(ctx) + "$sb_io"); nxio_to_sb(ctx, ci, sb); new_cells.push_back(sb); } |