Merge pull request #1088 from rowanG077/ecp5-singleton-lpf

ecp5: LOCATE in LPF works on singleton vector
This commit is contained in:
myrtle 2023-01-31 22:29:11 +00:00 committed by GitHub
commit 235e0d28e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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));
}