aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2020-11-23 22:17:47 -0500
committergatecat <gatecat@ds0.me>2021-02-12 10:36:59 +0000
commitf2a240550e14184041d3f0cfd7526386d985f27c (patch)
tree488dc3cd6ad34bcabad9010b1f6668cf14f501c2 /machxo2
parent42214b226fda6647a954cfe4895cfceee9a8cd72 (diff)
downloadnextpnr-f2a240550e14184041d3f0cfd7526386d985f27c.tar.gz
nextpnr-f2a240550e14184041d3f0cfd7526386d985f27c.tar.bz2
nextpnr-f2a240550e14184041d3f0cfd7526386d985f27c.zip
machxo2: Always remove nextpnr_iobufs for now- assume manually instantiated primitives.
Diffstat (limited to 'machxo2')
-rw-r--r--machxo2/main.cc2
-rw-r--r--machxo2/pack.cc31
2 files changed, 32 insertions, 1 deletions
diff --git a/machxo2/main.cc b/machxo2/main.cc
index 84b99edc..92a60d38 100644
--- a/machxo2/main.cc
+++ b/machxo2/main.cc
@@ -67,7 +67,7 @@ po::options_description MachXO2CommandHandler::getArchOptions()
specific.add_options()("lpf", po::value<std::vector<std::string>>(), "LPF pin constraint file(s)");
- specific.add_options()("no-iobs", "disable automatic IO buffer insertion");
+ specific.add_options()("no-iobs", "disable automatic IO buffer insertion (unimplemented- always enabled)");
return specific;
}
diff --git a/machxo2/pack.cc b/machxo2/pack.cc
index 6af7a58b..c418ceda 100644
--- a/machxo2/pack.cc
+++ b/machxo2/pack.cc
@@ -95,6 +95,36 @@ static void pack_constants(Context *ctx)
}
}
+static bool is_nextpnr_iob(Context *ctx, CellInfo *cell)
+{
+ return cell->type == ctx->id("$nextpnr_ibuf") || cell->type == ctx->id("$nextpnr_obuf") ||
+ cell->type == ctx->id("$nextpnr_iobuf");
+}
+
+static bool is_facade_iob(const Context *ctx, const CellInfo *cell) { return cell->type == ctx->id("FACADE_IO"); }
+
+// Pack IO buffers- Right now, all this does is remove $nextpnr_[io]buf cells.
+// User is expected to manually instantiate FACADE_IO with BEL/IO_TYPE
+// attributes.
+static void pack_io(Context *ctx)
+{
+ std::unordered_set<IdString> packed_cells;
+
+ log_info("Packing IOs..\n");
+
+ for (auto cell : sorted(ctx->cells)) {
+ CellInfo *ci = cell.second;
+ if (is_nextpnr_iob(ctx, ci)) {
+ for (auto &p : ci->ports)
+ disconnect_port(ctx, ci, p.first);
+ packed_cells.insert(ci->name);
+ }
+ }
+
+ for (auto pcell : packed_cells) {
+ ctx->cells.erase(pcell);
+ }
+}
// Main pack function
bool Arch::pack()
@@ -104,6 +134,7 @@ bool Arch::pack()
try {
log_break();
pack_constants(ctx);
+ pack_io(ctx);
ctx->settings[ctx->id("pack")] = 1;
ctx->assignArchInfo();
log_info("Checksum: 0x%08x\n", ctx->checksum());