📄 gen_explore_table.pl
字号:
#!/usr/bin/perl############################################################################################ ICC Design Planning RM## gen_explore_table.pl: parse explore run results and generate an HTML table## Version 2007.03-SP5############################################################################################ Please change perl path if it's not correct$inputDir = "";$outputDir = "";$outfile = "outfile.txt";$match_key = "feasibility_dp";$numCells=0;$print_table_row = 0;my @print_table;while (@ARGV) { if ($ARGV[0] eq "-i") { $inputDir = $ARGV[1]; } if ($ARGV[0] eq "-o") { $outputDir = $ARGV[1]; } if ($ARGV[0] eq "-m") { $match_key = $ARGV[1]; } if ($ARGV[0] eq "-f") { $outfile = $ARGV[1]; } if ($ARGV[0] eq "-h") { &usage; exit; } shift @ARGV;}$curDir = `pwd`;chomp($curDir);if (!(-e $inputDir)) { print "Error: Input directory: $inputDir does not exist....\n"; exit;}if (!(-e $outputDir)) { print "Warning: output directory: $outputDir does not exist, output to current directory....\n"; $outputDir = $curDir; }if(($outputDir eq "..") || ($outputDir eq "../")) { $outputDir = $curDir."/..";}if(($outputDir eq ".") || ($outputDir eq "./")) { $outputDir = $curDir;}$outfile = $outputDir."/".$outfile;open (OUT, ">$outfile") || die "couldn't open file: $outfile\n"; print OUT "<html><pre>\n"; print OUT "<h1 align=\"center\">ICC DP RM Explore Mode Run Results</h1>\n"; print OUT "<table border=1><tr>\n"; print OUT " <tr> <td></td> <td nowrap align=center colspan=4>Route QoR</td> <td nowrap align=center colspan=5>Timing QoR</td> <td nowrap align=center colspan=2>DRC</td> <td nowrap align=center colspan=2>Power QoR</td> <td nowrap align=center colspan=6>Links</td> </tr>\n"; print OUT " <tr> <td>Floorplan</td> <td>total</td> <td>max</td> <td nowrap align=center>%</td> <td>wirelength</td> <td nowrap align=center>wns</td> <td nowrap align=center>tns</td> <td>number</td> <td nowrap align=center >clk</td> <td>cell inst</td> <td>tran</td> <td>cap</td> <td>gnd IR drop</td> <td>pwr IR drop</td> <td>place log</td> <td>ipo log</td> <td>pna log</td> <td>route log</td> <td>timing report</td> <td>congestion map</td> </tr>\n";#print OUT ",Post PNS Route QoR,,,,Timing/Opt QoR,,,,,DRC,,Power QoR,,,,,,\n";#print OUT "Floorplan,total,max,%,wirelength,wns,tns,number,clk,cell Inst, tran,cap,gnd IR drop,gnd wire em, gnd via em,pwr IR drop,pwr wire em,pwr via em\n";close(OUT);chdir ($inputDir);@files = `ls *_final.qor`;$print_table_row = 0;foreach $name (@files) { chomp($name); $prefix = substr($name,0,-10); print "Parsing Logs: $prefix\n"; $finalQor = $name; $routeLog = $prefix."_groute.log"; $pnaLog = $prefix."_pna.log"; $runLog = $prefix."_place.log"; $ipoLog = $prefix."_ipo.log"; $timingReport = $prefix."_final.rpt"; $congestionMap = $prefix.".png"; $qorSnapshot = $prefix."_final.qor"; #if(!(-e $routeLog) || !(-e $pnaLog)) { # print "Error: Log File Set is not complete, $routeLog or $pnaLog does not exist.\n"; # exit; #} #open (OUT, ">>$outfile") || die "couldn't open file: $outfile\n"; #print OUT "\n$prefix,"; #close(OUT); &getRouteLog($routeLog,$outfile); &getFinalQor($finalQor,$outfile,$match_key); &getPnaLog($pnaLog,$outfile); $print_table_row++; }@column_max;@column_min;for($col=1; $col<=13; $col++){ $col_max = $print_table[0][$col]; $col_min = $print_table[0][$col]; for($row=0; $row<$print_table_row; $row++){ if($print_table[$row][$col] >= $col_max) { $col_max = $print_table[$row][$col]; $column_max[$col] = $print_table[$row][$col]; } if($print_table[$row][$col] <= $col_min) { $col_min = $print_table[$row][$col]; $column_min[$col] = $print_table[$row][$col]; } }}if($debug == 1) {print "MAX: ";foreach $item(@column_max) { print "$item ";}print "\n";print "MIN: ";foreach $item(@column_min) { print "$item ";}}open (OUT, ">>$outfile") || die "couldn't open file: $outfile\n";for($row=0; $row<$print_table_row; $row++){ print OUT "<tr> "; print OUT "<td>$print_table[$row][0]</td> "; for($col=1; $col<=13; $col++){ if( $column_max[$col] == $column_min[$col]) { print OUT " <td nowrap align=center>$print_table[$row][$col]</td> "; } else { if($print_table[$row][$col] == $column_max[$col]) { if(($col != 5) && ($col != 6)) { print OUT " <td nowrap align=center><font color=000000>$print_table[$row][$col]</font></td> "; #print OUT " <td nowrap align=center><b><font color=FA0000>$print_table[$row][$col]</font></b></td> "; } else { print OUT " <td nowrap align=center><b><font color=00AB00>$print_table[$row][$col]</font></b></td> "; } } elsif ($print_table[$row][$col] == $column_min[$col]) { if(($col != 5) && ($col != 6)) { print OUT " <td nowrap align=center><b><font color=00AB00>$print_table[$row][$col]</font></b></td> "; } else { print OUT " <td nowrap align=center><font color=000000>$print_table[$row][$col]</font></td> "; #print OUT " <td nowrap align=center><b><font color=FA0000>$print_table[$row][$col]</font></b></td> "; } } else { print OUT " <td nowrap align=center>$print_table[$row][$col]</td> "; } } } print OUT " <td nowrap align=center><a href=$inputDir/$print_table[$row][14]\><b>log</b></a></td> "; print OUT " <td nowrap align=center><a href=$inputDir/$print_table[$row][15]\><b>log</b></a></td> "; if ( (-e $pnaLog) ) { print OUT " <td nowrap align=center><a href=$inputDir/$print_table[$row][16]\><b>log</b></a></td> ";} else { print OUT " <td nowrap align=center>-</a></td> ";} print OUT " <td nowrap align=center><a href=$inputDir/$print_table[$row][17]\><b>log</b></a></td> "; print OUT " <td nowrap align=center><a href=$inputDir/$print_table[$row][18]\><b>rpt</b></a></td> "; print OUT " <td nowrap align=center><a href=$inputDir/$print_table[$row][19]\><b>map</b></a></td> "; print OUT " </tr>\n"; }close(OUT);chdir ($curDir);&printComments($outfile);sub getRouteLog{my $infile = $_[0];my $outfile = $_[1];open (IN, $infile) || die "couldn't open file: $infile\n";open (OUT, ">>$outfile") || die "couldn't open file: $outfile\n"; while (<IN>) { chomp; s/#.*//; next if /^(\s)*$/; if(($_ =~ /Both Dirs/) && ($_ =~ /Overflow/)) { @tmp = split (/\s/,$_); $ll = length ($tmp[12]); my $t1 = substr($tmp[12],1,$ll-3); #print OUT "$tmp[5] $tmp[8],$t1,"; $total_overflow = $tmp[5]; $max_overflow = $tmp[8]; $grc_overflow = $t1; } if($_ =~ /Total wire length/) { @tmp = split (/=/,$_); my $t1 = &trimSpace($tmp[1]); $total_wireLength = $t1; } }#print OUT "$total_overflow,$max_overflow,$grc_overflow,$total_wireLength,";close(IN);close(OUT);} sub getFinalQor{ my $infile = $_[0]; my $outfile = $_[1]; my $match_key = $_[2]; my %clk_table; my $counter = 0;# my $numCells = 0; my $stop_flag = 0; my $numClk = 0; open (IN, $infile) || die "couldn't open file: $infile\n"; open (OUT, ">>$outfile") || die "couldn't open file: $outfile\n";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -