From 676e56e5d44e09f3ff816c5efbb85e2b2ac1086b Mon Sep 17 00:00:00 2001
From: Alessandro Comodi <acomodi@antmicro.com>
Date: Tue, 25 Jan 2022 17:46:54 +0100
Subject: nexus: add option to modify the mult factor of the estimate delay

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
---
 nexus/arch.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

(limited to 'nexus/arch.cc')

diff --git a/nexus/arch.cc b/nexus/arch.cc
index a7751425..06a901cd 100644
--- a/nexus/arch.cc
+++ b/nexus/arch.cc
@@ -601,7 +601,8 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
     int dst_x = dst.tile % chip_info->width, dst_y = dst.tile / chip_info->width;
     int dist_x = std::abs(src_x - dst_x);
     int dist_y = std::abs(src_y - dst_y);
-    return 75 * dist_x + 75 * dist_y + 250;
+
+    return estimate_delay_mult * (dist_x + dist_y) + 250;
 }
 delay_t Arch::predictDelay(BelId src_bel, IdString src_pin, BelId dst_bel, IdString dst_pin) const
 {
@@ -655,6 +656,10 @@ ArcBounds Arch::getRouteBoundingBox(WireId src, WireId dst) const
 
 bool Arch::place()
 {
+    estimate_delay_mult = 75;
+    if (getCtx()->settings.count(getCtx()->id("estimate-delay-mult")))
+        estimate_delay_mult = getCtx()->setting<int>("estimate-delay-mult");
+
     std::string placer = str_or_default(settings, id("placer"), defaultPlacer);
 
     if (placer == "heap") {
-- 
cgit v1.2.3