From 5e1aac67db4bec579ca9e8075aa32e4183d1004f Mon Sep 17 00:00:00 2001 From: David Shah Date: Thu, 16 Jan 2020 12:00:52 +0000 Subject: ecp5: Improve bounding box accuracy Signed-off-by: David Shah --- ecp5/arch.cc | 23 +++++++++++++++++++---- ecp5/arch_place.cc | 21 +++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-) (limited to 'ecp5') diff --git a/ecp5/arch.cc b/ecp5/arch.cc index e620b3a3..a10be174 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -496,6 +496,19 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const { ArcBounds bb; + + bb.x0 = src.location.x; + bb.y0 = src.location.y; + bb.x1 = src.location.x; + bb.y1 = src.location.y; + + auto extend = [&](int x, int y) { + bb.x0 = std::min(bb.x0, x); + bb.x1 = std::max(bb.x1, x); + bb.y0 = std::min(bb.y0, y); + bb.y1 = std::max(bb.y1, y); + }; + auto est_location = [&](WireId w) -> std::pair { const auto &wire = locInfo(w)->wire_data[w.index]; if (w == gsrclk_wire) { @@ -516,16 +529,18 @@ ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const }; auto src_loc = est_location(src); + extend(src_loc.first, src_loc.second); + if (wire_loc_overrides.count(src)) { + extend(wire_loc_overrides.at(src).first, wire_loc_overrides.at(src).second); + } std::pair dst_loc; + extend(dst.location.x, dst.location.y); if (wire_loc_overrides.count(dst)) { dst_loc = wire_loc_overrides.at(dst); } else { dst_loc = est_location(dst); } - bb.x0 = std::min(src_loc.first, dst_loc.first); - bb.y0 = std::min(src_loc.second, dst_loc.second); - bb.x1 = std::max(src_loc.first, dst_loc.first); - bb.y1 = std::max(src_loc.second, dst_loc.second); + extend(dst_loc.first, dst_loc.second); return bb; } diff --git a/ecp5/arch_place.cc b/ecp5/arch_place.cc index 6057605b..c5330694 100644 --- a/ecp5/arch_place.cc +++ b/ecp5/arch_place.cc @@ -203,17 +203,26 @@ void Arch::setupWireLocations() CellInfo *ci = cell.second; if (ci->bel == BelId()) continue; - if (ci->type == id_MULT18X18D || ci->type == id_DCUA) { + if (ci->type == id_MULT18X18D || ci->type == id_DCUA || ci->type == id_DDRDLL || ci->type == id_DQSBUFM || + ci->type == id_EHXPLLL) { for (auto &port : ci->ports) { - if (port.second.type != PORT_IN || port.second.net == nullptr) + if (port.second.net == nullptr) continue; WireId pw = getBelPinWire(ci->bel, port.first); if (pw == WireId()) continue; - for (auto uh : getPipsUphill(pw)) { - WireId pip_src = getPipSrcWire(uh); - wire_loc_overrides[pw] = std::make_pair(pip_src.location.x, pip_src.location.y); - break; + if (port.second.type == PORT_OUT) { + for (auto dh : getPipsDownhill(pw)) { + WireId pip_dst = getPipDstWire(dh); + wire_loc_overrides[pw] = std::make_pair(pip_dst.location.x, pip_dst.location.y); + break; + } + } else { + for (auto uh : getPipsUphill(pw)) { + WireId pip_src = getPipSrcWire(uh); + wire_loc_overrides[pw] = std::make_pair(pip_src.location.x, pip_src.location.y); + break; + } } } } -- cgit v1.2.3