From 2cebd40f2e26207f1ac22471ac269ede2784c7d0 Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 14 May 2020 13:06:58 +0100 Subject: lpf: Support // comments Signed-off-by: David Shah --- ecp5/lpf.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ecp5/lpf.cc b/ecp5/lpf.cc index e626cc54..e740b737 100644 --- a/ecp5/lpf.cc +++ b/ecp5/lpf.cc @@ -46,6 +46,9 @@ bool Arch::applyLPF(std::string filename, std::istream &in) while (std::getline(in, line)) { ++lineno; size_t cstart = line.find('#'); + if (cstart != std::string::npos) + line = line.substr(0, cstart); + cstart = line.find("//"); if (cstart != std::string::npos) line = line.substr(0, cstart); if (isempty(line)) -- cgit v1.2.3 From 2aaef61547b78fc005cc7e0e7b6651660f58123a Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 14 May 2020 13:07:59 +0100 Subject: ecp5: Don't promote VCC/GND to globals even if connected to clock port Signed-off-by: David Shah --- ecp5/globals.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ecp5/globals.cc b/ecp5/globals.cc index 65b1710f..28061e1a 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -68,6 +68,8 @@ class Ecp5GlobalRouter std::unordered_map clockCount; for (auto &net : ctx->nets) { NetInfo *ni = net.second.get(); + if (ni->name == ctx->id("$PACKER_GND_NET") || ni->name == ctx->id("$PACKER_VCC_NET")) + continue; clockCount[ni->name] = 0; for (const auto &user : ni->users) { if (is_clock_port(user)) { -- cgit v1.2.3 From 3c60ea383d988937c45559fcc2f387b3c187287f Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 14 May 2020 13:12:30 +0100 Subject: ecp5: Improve global routing robustness Signed-off-by: David Shah --- ecp5/globals.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ecp5/globals.cc b/ecp5/globals.cc index 28061e1a..550af615 100644 --- a/ecp5/globals.cc +++ b/ecp5/globals.cc @@ -63,6 +63,13 @@ class Ecp5GlobalRouter return false; } + bool is_logic_port(const PortRef &user) + { + if (user.cell->type == id_TRELLIS_SLICE && user.port != id_CLK && user.port != id_WCK) + return true; + return false; + } + std::vector get_clocks() { std::unordered_map clockCount; @@ -162,6 +169,8 @@ class Ecp5GlobalRouter if (ctx->checkWireAvail(next)) { for (auto pip : ctx->getPipsUphill(next)) { WireId src = ctx->getPipSrcWire(pip); + if (backtrace.count(src)) + continue; backtrace[src] = pip; upstream.push(src); } @@ -414,6 +423,8 @@ class Ecp5GlobalRouter keep_users.push_back(user); } else if (net->driver.cell->type == id_EXTREFB && user.cell->type == id_DCUA) { keep_users.push_back(user); + } else if (is_logic_port(user)) { + keep_users.push_back(user); } else { glbnet->users.push_back(user); user.cell->ports.at(user.port).net = glbnet.get(); -- cgit v1.2.3 From 163dee1e1ad90091cbb2742190a07aa87fa83d7f Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 14 May 2020 13:19:57 +0100 Subject: ecp5: Disconnect dedicated DCU inputs if connected to constants Signed-off-by: David Shah --- ecp5/pack.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ecp5/pack.cc b/ecp5/pack.cc index 55b2c791..fb8a95e9 100644 --- a/ecp5/pack.cc +++ b/ecp5/pack.cc @@ -1617,6 +1617,18 @@ class Ecp5Packer for (auto pin : ctx->getBelPins(exemplar_bel)) if (ctx->getBelPinType(exemplar_bel, pin) == PORT_IN) autocreate_empty_port(ci, pin); + // Disconnect these ports if connected to constant to prevent routing failure + for (auto ndport : {id_D_TXBIT_CLKP_FROM_ND, id_D_TXBIT_CLKN_FROM_ND, id_D_SYNC_ND, + id_D_TXPLL_LOL_FROM_ND, id_CH0_HDINN, id_CH0_HDINP, id_CH1_HDINN, id_CH1_HDINP}) { + const NetInfo *net = get_net_or_empty(ci, ndport); + if (net == nullptr || net->driver.cell == nullptr) + continue; + IdString ct = net->driver.cell->type; + if (ct == ctx->id("GND") || ct == ctx->id("VCC")) { + disconnect_port(ctx, ci, ndport); + ci->ports.erase(ndport); + } + } } } for (auto cell : sorted(ctx->cells)) { -- cgit v1.2.3