aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-27 15:24:34 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-27 15:24:34 +0200
commit885fe93a17fc841912c5a58bcf6c89668f453a4d (patch)
tree25f295c04ab6311cdb9d3241060890b684cad709
parent92ddc31003b9847ae8496f6917b64468cd6ed564 (diff)
downloadnextpnr-885fe93a17fc841912c5a58bcf6c89668f453a4d.tar.gz
nextpnr-885fe93a17fc841912c5a58bcf6c89668f453a4d.tar.bz2
nextpnr-885fe93a17fc841912c5a58bcf6c89668f453a4d.zip
ice40: Carry packer bugfix
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r--ice40/main.cc1
-rw-r--r--ice40/pack.cc35
2 files changed, 17 insertions, 19 deletions
diff --git a/ice40/main.cc b/ice40/main.cc
index 6c2602dc..8f500efb 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -364,6 +364,7 @@ int main(int argc, char *argv[])
if (vm.count("freq"))
freq = vm["freq"].as<double>() * 1e6;
assign_budget(&ctx, freq);
+ ctx.check();
print_utilisation(&ctx);
bool timing_driven = true;
if (vm.count("no-tmdriv"))
diff --git a/ice40/pack.cc b/ice40/pack.cc
index bcb84219..69bea740 100644
--- a/ice40/pack.cc
+++ b/ice40/pack.cc
@@ -153,21 +153,28 @@ static void pack_carries(Context *ctx)
if (i0_net) {
for (auto usr : i0_net->users) {
if (is_lc(ctx, usr.cell) && usr.port == ctx->id("I1")) {
- i0_matches.insert(usr.cell->name);
- if (!i1_net) {
- // I1 is don't care when disconnected, duplicate I0
- i1_matches.insert(usr.cell->name);
+ if (ctx->cells.find(usr.cell->name) != ctx->cells.end()) {
+ // This clause stops us double-packing cells
+ i0_matches.insert(usr.cell->name);
+ if (!i1_net) {
+ // I1 is don't care when disconnected, duplicate I0
+ i1_matches.insert(usr.cell->name);
+ }
}
+
}
}
}
if (i1_net) {
for (auto usr : i1_net->users) {
if (is_lc(ctx, usr.cell) && usr.port == ctx->id("I2")) {
- i1_matches.insert(usr.cell->name);
- if (!i0_net) {
- // I0 is don't care when disconnected, duplicate I1
- i0_matches.insert(usr.cell->name);
+ if (ctx->cells.find(usr.cell->name) != ctx->cells.end()) {
+ // This clause stops us double-packing cells
+ i1_matches.insert(usr.cell->name);
+ if (!i0_net) {
+ // I0 is don't care when disconnected, duplicate I1
+ i0_matches.insert(usr.cell->name);
+ }
}
}
}
@@ -202,17 +209,7 @@ static void pack_carries(Context *ctx)
new_cells.push_back(std::move(created_lc));
} else {
- IdString lc_name = *carry_lcs.begin();
- if (ctx->cells.find(lc_name) != ctx->cells.end()) {
- carry_lc = ctx->cells.at(lc_name).get();
- } else {
- // Name might not be found in the Context, if it is a new cell
- auto new_pack =
- std::find_if(new_cells.begin(), new_cells.end(),
- [lc_name](std::unique_ptr<CellInfo> &nc) { return nc->name == lc_name; });
- assert(new_pack != new_cells.end());
- carry_lc = new_pack->get();
- }
+ carry_lc = ctx->cells.at(*(carry_lcs.begin())).get();
}
}
carry_lc->params[ctx->id("CARRY_ENABLE")] = "1";