From 6b5277638bc63b592e30acb4f51a4df3a8bd59d8 Mon Sep 17 00:00:00 2001 From: David Shah Date: Mon, 16 Nov 2020 13:31:43 +0000 Subject: nexus: Fix slow routing around DSPs Signed-off-by: David Shah --- nexus/arch.cc | 24 ++++++++++++++++++++++++ nexus/arch.h | 4 ++++ 2 files changed, 28 insertions(+) diff --git a/nexus/arch.cc b/nexus/arch.cc index 6cc0da0f..3a279f4a 100644 --- a/nexus/arch.cc +++ b/nexus/arch.cc @@ -582,6 +582,12 @@ ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const bb.y0 = std::min(bb.y0, y); bb.y1 = std::max(bb.y1, y); }; + + if (dsp_wires.count(src) || dsp_wires.count(dst)) { + bb.x0 -= 5; + bb.x1 += 5; + } + extend(dst_x, dst_y); return bb; @@ -617,10 +623,28 @@ bool Arch::place() return true; } +void Arch::pre_routing() +{ + for (auto cell : sorted(cells)) { + CellInfo *ci = cell.second; + if (ci->type == id_MULT9_CORE || ci->type == id_PREADD9_CORE || ci->type == id_MULT18_CORE || + ci->type == id_MULT18X36_CORE || ci->type == id_MULT36_CORE || ci->type == id_REG18_CORE || + ci->type == id_ACC54_CORE) { + for (auto port : sorted_ref(ci->ports)) { + WireId wire = getBelPinWire(ci->bel, port.first); + if (wire != WireId()) + dsp_wires.insert(wire); + } + } + } +} + bool Arch::route() { assign_budget(getCtx(), true); + pre_routing(); + route_globals(); std::string router = str_or_default(settings, id("router"), defaultRouter); diff --git a/nexus/arch.h b/nexus/arch.h index f7299cb7..debf66b0 100644 --- a/nexus/arch.h +++ b/nexus/arch.h @@ -1367,6 +1367,10 @@ struct Arch : BaseCtx bool getBudgetOverride(const NetInfo *net_info, const PortRef &sink, delay_t &budget) const; ArcBounds getRouteBoundingBox(WireId src, WireId dst) const; + // for better DSP bounding boxes + void pre_routing(); + std::unordered_set dsp_wires; + // ------------------------------------------------- // Get the delay through a cell from one port to another, returning false -- cgit v1.2.3