From 4812c90424dfc40d26725244723887a2d16ddfd9 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 1 Oct 2007 08:01:00 -0700 Subject: Version abc71001 --- src/phys/place/hpwl | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/phys/place/hpwl (limited to 'src/phys/place/hpwl') diff --git a/src/phys/place/hpwl b/src/phys/place/hpwl new file mode 100644 index 00000000..f69a1d05 --- /dev/null +++ b/src/phys/place/hpwl @@ -0,0 +1,57 @@ +#! /usr/bin/perl + +$netsfile = shift; +$plfile = shift; + +# ------------------------------ read placement + +open FILE, $plfile; +while () { + chop; + if (/(\w+)\s+([\-\d\.]+)\s+([\-\d\.]+)\s+\:/) { + $loc{$1} = "$2 $3"; + } +} +close FILE; + +open FILE, $netsfile; +while () { + chop; + $net = $2 if /NetDegree\s+\:\s+(\d+)\s+(\w+)/; + if (/(\w+)\s+(\w+)\s+\:/) { + $netconn{$net} .= "$1 "; + $cellconn{$1} .= "$net "; + } +} +close FILE; + +# ----------------------------- compute HPWL + +$hpwl = 0; +foreach $net (keys %netconn) { + @conns = split ' ',$netconn{$net}; + $min_x = $min_y = 1e12; + $max_x = $max_y = -1e12; + foreach $cell (@conns) { + if (!exists $loc{$cell}) { + print "WARNING: Unknown cell location: $cell\n"; + } else { + ($x, $y) = split ' ',$loc{$cell}; + $min_x = $x if $x < $min_x; + $min_y = $y if $y < $min_y; + $max_x = $x if $x > $max_x; + $max_y = $y if $y > $max_y; + } + } + + if ($min_x eq 1e12 or $min_y eq 1e12 or + $max_x eq -1e12 or $max_y eq -1e12) { + print "WARNING: Unbounded box\n"; + } else { + $hpwl = $hpwl + $max_x - $min_x + $max_y - $min_y; + } +} + +print "HPWL = "; +printf "%e",$hpwl; +print "\n"; -- cgit v1.2.3