From aaf028cacf2e2418cd9a2c9f966d5b2f26de12fa Mon Sep 17 00:00:00 2001 From: Matt Guthaus Date: Wed, 30 Jan 2019 08:49:47 -0800 Subject: [PATCH] Optimize hpwl runtime. Fix error in via cost when L shape. --- compiler/router/signal_grid.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/router/signal_grid.py b/compiler/router/signal_grid.py index 0f8d6315..2cee04a1 100644 --- a/compiler/router/signal_grid.py +++ b/compiler/router/signal_grid.py @@ -142,10 +142,9 @@ class signal_grid(grid): Either point can have positive or negative coordinates. Include the via penalty if there is one. """ - hpwl = max(abs(src.x-dest.x),abs(dest.x-src.x)) - hpwl += max(abs(src.y-dest.y),abs(dest.y-src.y)) - hpwl += max(abs(src.z-dest.z),abs(dest.z-src.z)) - if src.x!=dest.x or src.y!=dest.y: + hpwl = abs(src.x-dest.x) + hpwl += abs(src.y-dest.y) + if src.x!=dest.x and src.y!=dest.y: hpwl += grid.VIA_COST return hpwl