From 6ad329c5404021ca38784b21fc4d01a548caed30 Mon Sep 17 00:00:00 2001 From: gatecat Date: Thu, 13 May 2021 23:51:47 +0100 Subject: [PATCH] mistral: Implement bounding boxes for router2 Signed-off-by: gatecat --- mistral/arch.cc | 14 ++++++++++++++ mistral/arch.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mistral/arch.cc b/mistral/arch.cc index ffe6e833..d5bc424c 100644 --- a/mistral/arch.cc +++ b/mistral/arch.cc @@ -382,6 +382,20 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const return 100 * std::abs(y1 - y0) + 100 * std::abs(x1 - x0) + 100; } +ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const +{ + ArcBounds bounds; + int src_x = CycloneV::rn2x(src.node); + int src_y = CycloneV::rn2y(src.node); + int dst_x = CycloneV::rn2x(dst.node); + int dst_y = CycloneV::rn2y(dst.node); + bounds.x0 = std::min(src_x, dst_x); + bounds.y0 = std::min(src_y, dst_y); + bounds.x1 = std::max(src_x, dst_x); + bounds.y1 = std::max(src_y, dst_y); + return bounds; +} + delay_t Arch::predictDelay(const NetInfo *net_info, const PortRef &sink) const { if (net_info->driver.cell == nullptr || net_info->driver.cell->bel == BelId()) diff --git a/mistral/arch.h b/mistral/arch.h index c0ab86e5..3d5a8617 100644 --- a/mistral/arch.h +++ b/mistral/arch.h @@ -386,7 +386,7 @@ struct Arch : BaseArch delay_t getDelayFromNS(float ns) const override { return delay_t(ns * 1000.0f); }; uint32_t getDelayChecksum(delay_t v) const override { return v; }; - ArcBounds getRouteBoundingBox(WireId src, WireId dst) const override { return ArcBounds(); } + ArcBounds getRouteBoundingBox(WireId src, WireId dst) const override; // -------------------------------------------------