From 803c57d0529089bab71e203e7bc7e3e5be15285a Mon Sep 17 00:00:00 2001 From: rowanG077 Date: Tue, 31 Jan 2023 21:00:21 +0100 Subject: ecp5: LOCATE in LPF works on singleton vector --- ecp5/lpf.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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)); } -- cgit v1.2.3