aboutsummaryrefslogtreecommitdiffstats
path: root/nexus/pack.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2020-10-22 16:54:49 +0100
committerDavid Shah <dave@ds0.me>2020-11-30 08:45:28 +0000
commitc89d830e1689116955c9257dd2933ff49eceeaba (patch)
treecfcbf9919abe117e761a66b0ad9345c80fbb115e /nexus/pack.cc
parent00ff7c6cfe1a39bc1548776ae306ce065d48917b (diff)
downloadnextpnr-c89d830e1689116955c9257dd2933ff49eceeaba.tar.gz
nextpnr-c89d830e1689116955c9257dd2933ff49eceeaba.tar.bz2
nextpnr-c89d830e1689116955c9257dd2933ff49eceeaba.zip
nexus: Add WIDEFN9 support
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'nexus/pack.cc')
-rw-r--r--nexus/pack.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/nexus/pack.cc b/nexus/pack.cc
index e12ce305..ea3b4aca 100644
--- a/nexus/pack.cc
+++ b/nexus/pack.cc
@@ -1074,6 +1074,52 @@ struct NexusPacker
}
}
+ void pack_widefn()
+ {
+ std::vector<CellInfo *> widefns;
+ for (auto cell : sorted(ctx->cells)) {
+ CellInfo *ci = cell.second;
+ if (ci->type != id_WIDEFN9)
+ continue;
+ widefns.push_back(ci);
+ }
+
+ for (CellInfo *ci : widefns) {
+ std::vector<CellInfo *> combs;
+ for (int i = 0; i < 2; i++)
+ combs.push_back(
+ ctx->createCell(ctx->id(stringf("%s$widefn_comb[%d]$", ctx->nameOf(ci), i)), id_OXIDE_COMB));
+
+ for (int i = 0; i < 2; i++) {
+ replace_port(ci, bus_flat("A", i), combs[i], id_A);
+ replace_port(ci, bus_flat("B", i), combs[i], id_B);
+ replace_port(ci, bus_flat("C", i), combs[i], id_C);
+ replace_port(ci, bus_flat("D", i), combs[i], id_D);
+ }
+
+ replace_port(ci, id_SEL, combs[0], id_SEL);
+ replace_port(ci, id_Z, combs[0], id_OFX);
+
+ NetInfo *f1 = ctx->createNet(ctx->id(stringf("%s$widefn_f1$", ctx->nameOf(ci))));
+ combs[0]->addInput(id_F1);
+ combs[1]->addOutput(id_F);
+ connect_port(ctx, f1, combs[1], id_F);
+ connect_port(ctx, f1, combs[0], id_F1);
+
+ combs[0]->params[id_INIT] = ctx->parse_lattice_param(ci, id_INIT0, 16, 0);
+ combs[1]->params[id_INIT] = ctx->parse_lattice_param(ci, id_INIT1, 16, 0);
+
+ combs[1]->constr_parent = combs[0];
+ combs[1]->constr_x = 0;
+ combs[1]->constr_y = 0;
+ combs[1]->constr_z = 1;
+ combs[1]->constr_abs_z = false;
+ combs[0]->constr_children.push_back(combs[1]);
+
+ ctx->cells.erase(ci->name);
+ }
+ }
+
explicit NexusPacker(Context *ctx) : ctx(ctx) {}
void operator()()
@@ -1082,6 +1128,7 @@ struct NexusPacker
convert_prims();
pack_bram();
pack_lutram();
+ pack_widefn();
pack_ffs();
pack_constants();
pack_luts();