aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-02-02 03:37:28 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commit3ab300a28e9fcfbc7c2d35424eab849da0d4b866 (patch)
tree406df301dc5d5bb906bcb98a54442115cb4c8513 /machxo2
parentf18df5ed59f7c119fba8cdd264d329e5ea8fd9b6 (diff)
downloadnextpnr-3ab300a28e9fcfbc7c2d35424eab849da0d4b866.tar.gz
nextpnr-3ab300a28e9fcfbc7c2d35424eab849da0d4b866.tar.bz2
nextpnr-3ab300a28e9fcfbc7c2d35424eab849da0d4b866.zip
machxo2: Add additional packing phase to pack remaining FFs.
Diffstat (limited to 'machxo2')
-rw-r--r--machxo2/pack.cc38
1 files changed, 38 insertions, 0 deletions
diff --git a/machxo2/pack.cc b/machxo2/pack.cc
index d7d40d5d..47f8c907 100644
--- a/machxo2/pack.cc
+++ b/machxo2/pack.cc
@@ -86,6 +86,43 @@ static void pack_lut_lutffs(Context *ctx)
}
}
+static void pack_remaining_ffs(Context *ctx)
+{
+ log_info("Packing remaining FFs..\n");
+
+ std::unordered_set<IdString> packed_cells;
+ std::vector<std::unique_ptr<CellInfo>> new_cells;
+
+ for (auto cell : sorted(ctx->cells)) {
+ CellInfo *ci = cell.second;
+
+ if (is_ff(ctx, ci)) {
+ if (ctx->verbose)
+ log_info("cell '%s' of type '%s remains unpacked'\n", ci->name.c_str(ctx), ci->type.c_str(ctx));
+
+ std::unique_ptr<CellInfo> packed = create_machxo2_cell(ctx, id_FACADE_SLICE, ci->name.str(ctx) + "_LC");
+ std::copy(ci->attrs.begin(), ci->attrs.end(), std::inserter(packed->attrs, packed->attrs.begin()));
+
+ auto dff_bel = ci->attrs.find(ctx->id("BEL"));
+ dff_to_lc(ctx, ci, packed.get(), false);
+ if (dff_bel != ci->attrs.end())
+ packed->attrs[ctx->id("BEL")] = dff_bel->second;
+ packed_cells.insert(ci->name);
+ if (ctx->verbose)
+ log_info("packed cell %s into %s\n", ci->name.c_str(ctx), packed->name.c_str(ctx));
+
+ new_cells.push_back(std::move(packed));
+ }
+ }
+
+ for (auto pcell : packed_cells) {
+ ctx->cells.erase(pcell);
+ }
+ for (auto &ncell : new_cells) {
+ ctx->cells[ncell->name] = std::move(ncell);
+ }
+}
+
// Merge a net into a constant net
static void set_net_constant(const Context *ctx, NetInfo *orig, NetInfo *constnet, bool constval)
{
@@ -220,6 +257,7 @@ bool Arch::pack()
pack_constants(ctx);
pack_io(ctx);
pack_lut_lutffs(ctx);
+ pack_remaining_ffs(ctx);
ctx->settings[ctx->id("pack")] = 1;
ctx->assignArchInfo();
log_info("Checksum: 0x%08x\n", ctx->checksum());