diff options
Diffstat (limited to 'ecp5')
-rw-r--r-- | ecp5/lpf.cc | 9 | ||||
-rw-r--r-- | ecp5/pack.cc | 10 |
2 files changed, 16 insertions, 3 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)); } diff --git a/ecp5/pack.cc b/ecp5/pack.cc index a6f31656..0c95b66c 100644 --- a/ecp5/pack.cc +++ b/ecp5/pack.cc @@ -1522,6 +1522,10 @@ class Ecp5Packer // Check if two nets have identical constant drivers bool equal_constant(NetInfo *a, NetInfo *b) { + if (a == nullptr && b == nullptr) + return true; + if ((a == nullptr) != (b == nullptr)) + return false; if (a->driver.cell == nullptr || b->driver.cell == nullptr) return (a->driver.cell == nullptr && b->driver.cell == nullptr); if (a->driver.cell->type != id_GND && a->driver.cell->type != id_VCC) @@ -2251,7 +2255,8 @@ class Ecp5Packer iol->params[id_CEMUX] = str_or_default(ci->params, id_CEMUX, "CE"); ci->movePortTo(id_CE, iol, id_CE); } else { - if (iol->getPort(id_CE) != ci->getPort(id_CE) || + if ((iol->getPort(id_CE) != ci->getPort(id_CE) && + !equal_constant(iol->getPort(id_CE), ci->getPort(id_CE))) || str_or_default(ci->params, id_CEMUX, "CE") != str_or_default(iol->params, id_CEMUX, "CE")) log_error("CE signal or polarity mismatch for IO flipflop %s with other IOFFs at " @@ -2317,7 +2322,8 @@ class Ecp5Packer iol->params[id_CEMUX] = str_or_default(ci->params, id_CEMUX, "CE"); ci->movePortTo(id_CE, iol, id_CE); } else { - if (iol->getPort(id_CE) != ci->getPort(id_CE) || + if ((iol->getPort(id_CE) != ci->getPort(id_CE) && + !equal_constant(iol->getPort(id_CE), ci->getPort(id_CE))) || str_or_default(ci->params, id_CEMUX, "CE") != str_or_default(iol->params, id_CEMUX, "CE")) log_error("CE signal or polarity mismatch for IO flipflop %s with other IOFFs at " |