diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2019-05-31 13:38:18 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2019-05-31 13:38:18 +0200 |
commit | f1b3a14bc23ccee6acaf6bbe27827523dc13c111 (patch) | |
tree | 40236792b25a4c76fa7353cd549054d49ea1a129 | |
parent | 1657479c8153199cbe008aad552ce07b8170293a (diff) | |
download | nextpnr-f1b3a14bc23ccee6acaf6bbe27827523dc13c111.tar.gz nextpnr-f1b3a14bc23ccee6acaf6bbe27827523dc13c111.tar.bz2 nextpnr-f1b3a14bc23ccee6acaf6bbe27827523dc13c111.zip |
Do not add VCC if not used, loading json works
-rw-r--r-- | ice40/pack.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ice40/pack.cc b/ice40/pack.cc index 390cbf57..d8796ede 100644 --- a/ice40/pack.cc +++ b/ice40/pack.cc @@ -352,6 +352,7 @@ static void pack_constants(Context *ctx) std::vector<IdString> dead_nets; bool gnd_used = false; + bool vcc_used = false; for (auto net : sorted(ctx->nets)) { NetInfo *ni = net.second; @@ -364,6 +365,7 @@ static void pack_constants(Context *ctx) } 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.get(), true); + vcc_used = true; dead_nets.push_back(net.first); ctx->cells.erase(drv_cell); } @@ -373,11 +375,10 @@ static void pack_constants(Context *ctx) ctx->cells[gnd_cell->name] = std::move(gnd_cell); ctx->nets[gnd_net->name] = std::move(gnd_net); } - // Vcc cell always inserted for now, as it may be needed during carry legalisation (TODO: trim later if actually - // never used?) - ctx->cells[vcc_cell->name] = std::move(vcc_cell); - ctx->nets[vcc_net->name] = std::move(vcc_net); - + if (vcc_used) { + ctx->cells[vcc_cell->name] = std::move(vcc_cell); + ctx->nets[vcc_net->name] = std::move(vcc_net); + } for (auto dn : dead_nets) { ctx->nets.erase(dn); } |