aboutsummaryrefslogtreecommitdiffstats
path: root/machxo2
diff options
context:
space:
mode:
authorWilliam D. Jones <thor0505@comcast.net>2021-10-29 18:00:05 -0400
committerWilliam D. Jones <thor0505@comcast.net>2021-12-16 16:59:37 -0500
commitd2ac6dffbcd1bcb6dbf3cadd03f33794b2af5c80 (patch)
tree4f2d9d67ef2ae5966d1101ce62b2b306730edbe6 /machxo2
parentd04cfd5f0f6da184f5b8a03f0ce18fbd1d98eca3 (diff)
downloadnextpnr-d2ac6dffbcd1bcb6dbf3cadd03f33794b2af5c80.tar.gz
nextpnr-d2ac6dffbcd1bcb6dbf3cadd03f33794b2af5c80.tar.bz2
nextpnr-d2ac6dffbcd1bcb6dbf3cadd03f33794b2af5c80.zip
machxo2: Correct which PIO wires get adjusted when writing text bitstream. Add verbose logging for adjustments.
Diffstat (limited to 'machxo2')
-rw-r--r--machxo2/bitstream.cc35
1 files changed, 26 insertions, 9 deletions
diff --git a/machxo2/bitstream.cc b/machxo2/bitstream.cc
index ed67975a..913d7b58 100644
--- a/machxo2/bitstream.cc
+++ b/machxo2/bitstream.cc
@@ -19,6 +19,7 @@
*/
#include <fstream>
+#include <iostream>
#include "bitstream.h"
#include "config.h"
@@ -59,13 +60,20 @@ static std::string get_trellis_wirename(Context *ctx, Location loc, WireId wire)
// Handle MachXO2's wonderful naming quirks for wires in left/right tiles, whose
// relative coords push them outside the bounds of the chip.
+ // Indents are based on wires proximity/purpose.
auto is_pio_wire = [](std::string name) {
return (name.find("DI") != std::string::npos || name.find("JDI") != std::string::npos ||
- name.find("PADD") != std::string::npos || name.find("INDD") != std::string::npos ||
- name.find("IOLDO") != std::string::npos || name.find("IOLTO") != std::string::npos ||
- name.find("JCE") != std::string::npos || name.find("JCLK") != std::string::npos ||
- name.find("JLSR") != std::string::npos || name.find("JONEG") != std::string::npos ||
- name.find("JOPOS") != std::string::npos || name.find("JTS") != std::string::npos ||
+ name.find("PADD") != std::string::npos || name.find("INDD") != std::string::npos ||
+ name.find("IOLDO") != std::string::npos || name.find("IOLTO") != std::string::npos ||
+ // JCE0-3, JCLK0-3, JLSR0-3 connect to PIO wires named JCEA-D, JCLKA-D, JLSRA-D.
+ name.find("JCEA") != std::string::npos || name.find("JCEB") != std::string::npos ||
+ name.find("JCEC") != std::string::npos || name.find("JCED") != std::string::npos ||
+ name.find("JCLKA") != std::string::npos || name.find("JCLKB") != std::string::npos ||
+ name.find("JCLKC") != std::string::npos || name.find("JCLKD") != std::string::npos ||
+ name.find("JLSRA") != std::string::npos || name.find("JLSRB") != std::string::npos ||
+ name.find("JLSRC") != std::string::npos || name.find("JLSRD") != std::string::npos ||
+ name.find("JONEG") != std::string::npos || name.find("JOPOS") != std::string::npos ||
+ name.find("JTS") != std::string::npos ||
name.find("JIN") != std::string::npos || name.find("JIP") != std::string::npos ||
// Connections to global mux
name.find("JINCK") != std::string::npos);
@@ -92,10 +100,19 @@ static std::string get_trellis_wirename(Context *ctx, Location loc, WireId wire)
if (loc == wire.location) {
// TODO: JINCK is not currently handled by this.
if (is_pio_wire(basename)) {
- if (wire.location.x == 0)
- return "W1_" + basename;
- else if (wire.location.x == max_col)
- return "E1_" + basename;
+ if (wire.location.x == 0) {
+ std::string pio_name = "W1_" + basename;
+ if (ctx->verbose)
+ log_info("PIO wire %s was adjusted by W1 to form Trellis name %s.\n", \
+ ctx->nameOfWire(wire), pio_name.c_str());
+ return pio_name;
+ } else if (wire.location.x == max_col) {
+ std::string pio_name = "E1_" + basename;
+ if (ctx->verbose)
+ log_info("PIO wire %s was adjusted by E1 to form Trellis name %s.\n", \
+ ctx->nameOfWire(wire), pio_name.c_str());
+ return pio_name;
+ }
}
return basename;
}