Optimize hpwl runtime. Fix error in via cost when L shape.

This commit is contained in:
Matt Guthaus 2019-01-30 08:49:47 -08:00
parent 82a09be026
commit aaf028cacf
1 changed files with 3 additions and 4 deletions

View File

@ -142,10 +142,9 @@ class signal_grid(grid):
Either point can have positive or negative coordinates. Either point can have positive or negative coordinates.
Include the via penalty if there is one. Include the via penalty if there is one.
""" """
hpwl = max(abs(src.x-dest.x),abs(dest.x-src.x)) hpwl = abs(src.x-dest.x)
hpwl += max(abs(src.y-dest.y),abs(dest.y-src.y)) hpwl += abs(src.y-dest.y)
hpwl += max(abs(src.z-dest.z),abs(dest.z-src.z)) if src.x!=dest.x and src.y!=dest.y:
if src.x!=dest.x or src.y!=dest.y:
hpwl += grid.VIA_COST hpwl += grid.VIA_COST
return hpwl return hpwl