Perl Script:
#!/usr/local/bin/perl
$FILE_NAME = $ARGV[0];
$pass_count = 0;
$fail_count = 0;
open(SearchFile,"<$FILE_NAME");
while(<SearchFile>){
chop $_;
@ary=split(" ",$_);
if ($ary[0] eq "Cell:") {
}
if ($ary[0] eq "Table:") {
$type = $ary[1] ;}
if ($ary[0] eq "Slew" && $ary[1] eq "Load") {
$sweep_count = 0;
}
## Count for Slew
if ($type eq "slew") {
if ($sweep_count > 1 && $sweep_count < 51) {
if ($ary[7] eq "pass") {
$slew_pass_count[$sweep_count-1] ++; }
if ($ary[7] eq "fail") {
$slew_fail_count[$sweep_count-1] ++; }
}
}
## Count for Delay
if ($type eq "delay") {
if ($sweep_count > 1 && $sweep_count < 51) {
if ($ary[7] eq "pass") {
$delay_pass_count[$sweep_count-1] ++; }
if ($ary[7] eq "fail") {
$delay_fail_count[$sweep_count-1] ++; }
}
}
## Count for slew + delay
if ($sweep_count > 1 && $sweep_count < 51) {
if ($ary[7] eq "pass") {
#print "sweep_count is $sweep_count";
$pass_count[$sweep_count-1] ++; }
if ($ary[7] eq "fail") {
#print "sweep_count is $sweep_count";
$fail_count[$sweep_count-1] ++; }
}
$sweep_count ++ ;
}
## print out analysis distribution results ##
## Slew
for ($i=1; $i<50; $i++) {
$slew_pass_rate[$i] = (($slew_pass_count[$i] / ($slew_pass_count[$i] + $slew_fail_count[$i])) * 100) ;
}
print "Slew passed rate table \n ******************** \n";
for ($j=1; $j<8; $j++) {
for ($k=1; $k<8; $k++) {
$slew_dig_0=sprintf("%.2f",$slew_pass_rate[($j-1)*7+$k]);
$slew_dig=$slew_dig_0.'%';
printf "%-10s" , $slew_dig;}
print "\n";}
## Delay
for ($i=1; $i<50; $i++) {
$delay_pass_rate[$i] = (($delay_pass_count[$i] / ($delay_pass_count[$i] + $delay_fail_count[$i])) * 100) ;
}
print "\n \n Delay passed rate table \n ******************** \n";
for ($j=1; $j<8; $j++) {
for ($k=1; $k<8; $k++) {
$delay_dig_0=sprintf("%.2f",$delay_pass_rate[($j-1)*7+$k]);
$delay_dig=$delay_dig_0.'%';
printf "%-10s" , $delay_dig;}
print "\n";}
## Total
for ($i=1; $i<50; $i++) {
$pass_rate[$i] = (($pass_count[$i] / ($pass_count[$i] + $fail_count[$i])) * 100) ;
}
print "\n \n Slew+Delay passed rate table \n ******************** \n";
for ($j=1; $j<8; $j++) {
for ($k=1; $k<8; $k++) {
$total_dig_0=sprintf("%.2f",$pass_rate[($j-1)*7+$k]);
$total_dig=$total_dig_0.'%';
printf "%-10s" , $total_dig;}
print "\n";}
Results:
amsoptr24:/remote/amscae35/chihwang/MTK>perl failed_analysis.pl cl_NCX_vs_SIS_cycle_1_timing.rpt
Slew passed rate table
********************
100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 100.00%
100.00% 100.00% 100.00% 100.00% 98.76% 97.72% 100.00%
100.00% 100.00% 100.00% 100.00% 100.00% 99.17% 98.96%
100.00% 100.00% 100.00% 100.00% 100.00% 99.79% 97.52%
100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 98.34%
99.59% 99.79% 100.00% 100.00% 100.00% 100.00% 99.17%
Delay passed rate table
********************
99.59% 99.59% 99.59% 99.59% 99.59% 99.59% 86.54%
99.59% 99.59% 99.59% 99.59% 99.59% 99.59% 86.54%
99.59% 99.59% 99.59% 99.59% 97.93% 99.59% 86.54%
99.59% 99.59% 99.59% 99.59% 99.59% 99.59% 85.30%
99.59% 99.59% 99.59% 99.59% 99.59% 100.00% 85.71%
100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 84.89%
100.00% 98.34% 100.00% 100.00% 100.00% 100.00% 85.06%
Slew+Delay passed rate table
********************
99.79% 99.79% 99.79% 99.79% 99.79% 99.79% 93.27%
99.79% 99.79% 99.79% 99.79% 99.79% 99.79% 93.27%
99.79% 99.79% 99.79% 99.79% 98.34% 98.65% 93.27%
99.79% 99.79% 99.79% 99.79% 99.79% 99.38% 92.13%
99.79% 99.79% 99.79% 99.79% 99.79% 99.90% 91.61%
100.00% 100.00% 100.00% 100.00% 100.00% 100.00% 91.61%
99.79% 99.07% 100.00% 100.00% 100.00% 100.00% 92.12%