aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormyrtle <gatecat@ds0.me>2023-01-31 22:29:11 +0000
committerGitHub <noreply@github.com>2023-01-31 22:29:11 +0000
commit235e0d28e9a0ad13efaed9579453c917c9d7efc2 (patch)
treeefdbb633bba84edad7f98382bd07dd32f91d528d
parentbfa3e047cee0f941ac58ba7dd2907fdfe2e90fc0 (diff)
parent803c57d0529089bab71e203e7bc7e3e5be15285a (diff)
downloadnextpnr-235e0d28e9a0ad13efaed9579453c917c9d7efc2.tar.gz
nextpnr-235e0d28e9a0ad13efaed9579453c917c9d7efc2.tar.bz2
nextpnr-235e0d28e9a0ad13efaed9579453c917c9d7efc2.zip
Merge pull request #1088 from rowanG077/ecp5-singleton-lpf
ecp5: LOCATE in LPF works on singleton vector
-rw-r--r--ecp5/lpf.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/ecp5/lpf.cc b/ecp5/lpf.cc
index 4f02d22d..2e34f54a 100644
--- a/ecp5/lpf.cc
+++ b/ecp5/lpf.cc
@@ -131,9 +131,16 @@ bool Arch::apply_lpf(std::string filename, std::istream &in)
std::string cell = strip_quotes(words.at(2));
if (words.at(3) != "SITE")
log_error("expected 'SITE' after 'LOCATE COMP %s' (on line %d)\n", cell.c_str(), lineno);
- auto fnd_cell = cells.find(id(cell));
if (words.size() > 5)
log_error("unexpected input following LOCATE clause (on line %d)\n", lineno);
+ auto fnd_cell = cells.find(id(cell));
+ // 1-bit wires are treated as scalar by nextpnr.
+ // In HDL they might have been a singleton vector.
+ if (fnd_cell == cells.end() && cell.size() >= 3 && cell.substr(cell.size() - 3) == "[0]") {
+ cell = cell.substr(0, cell.size() - 3);
+ fnd_cell = cells.find(id(cell));
+ }
+
if (fnd_cell != cells.end()) {
fnd_cell->second->attrs[id_LOC] = strip_quotes(words.at(4));
}