#!/usr/bin/perl
$input_library = $ARGV[0];
$timing_flag=0; $timing_type_flag=0; $get_value_flag=0; $table_count=0;
open(LIB,"<$input_library");
open(NEW, ">hold_sigma.lib") || die "Can not open the file : temp.txt \n";
while(<LIB>){
print NEW "$_";
chop $_;
$table_count++;
#if(/timing \(\) {/){
# # $timing_flag=1;
# # print "$_ \n";
# #}
#
if(/timing_type : hold_rising/ || /timing_type : hold_falling/){
$timing_type_flag=1;
#print "$_ \n";
}
if(/values \( / && ($timing_type_flag=="1")){
$get_value_flag=1; $timing_type_flag=0;
$table_count=0;
#print "$_ \n";
}
if($get_value_flag==1 && $table_count>0){
#print "start to get values: $table_count\n";
$_ =~ s/", \\//; $_ =~ s/" \\//; $_ =~ s/"//; $_ =~ s/,//g; #removed unnecessary symbols
@ary=split(" ",$_);
for ($i=0; $i<5; $i++) {
$table_array[(($table_count-1)*5)+$i]=$ary[$i];
}
#print NEW "$_\n";
if($table_count>79){
$table_count=0; $get_value_flag=0; $timing_type_flag=0;
#print NEW @table_array; print NEW "\n";
print NEW "ADD sigma table\n";
for ($j=0; $j<25; $j++) {
$sigma=((($table_array[125+$j]**2)+($table_array[175+$j]**2)+($table_array[225+$j]**2)+($table_array[275+$j]**2)+($table_array[325+$j]**2)+($table_array[375+$j]**2))**0.5);
print NEW "$sigma ";
if((($j+1)%5)=="0"){print NEW "\n";}
}
print NEW "\n";
}
}
}
close(LIB);
close(NEW);
######################################################################
#!/usr/bin/perl
# input file cell.ldb
# output add on sigma for mpw
$input_library = $ARGV[0];
$timing_flag=0; $timing_type_flag=0; $get_value_flag=0; $table_count=0;
open(LIB,"<$input_library");
open(NEW, ">mpw_sigma.ldb") || die "Can not open the file : temp.txt \n";
while(<LIB>){
print NEW "$_";
chop $_;
$table_count++;
#if(/timing \(\) {/){
# # $timing_flag=1;
# # print "$_ \n";
# #}
#
if(/timing_type : min_pulse_width/){
$timing_type_flag=1;
#print "$_ \n";
}
if(/values \( / && ($timing_type_flag=="1")){
$get_value_flag=1; $timing_type_flag=0;
$table_count=0;
#print "$_ \n";
}
if($get_value_flag==1 && $table_count>0){
#print "start to get values: $table_count\n";
$_ =~ s/", \\//; $_ =~ s/" \\//; $_ =~ s/"//; $_ =~ s/,//g; #removed unnecessary symbols
@ary=split(" ",$_);
#save 5X1 values into a array
for ($i=0; $i<5; $i++) {
$table_array[(($table_count-1)*5)+$i]=$ary[$i];
}
#print NEW "$_\n";
if($table_count>15){
$table_count=0; $get_value_flag=0; $timing_type_flag=0;
#print NEW @table_array; print NEW "\n";
print NEW "ADD sigma table\n";
for ($j=0; $j<5; $j++) {
$sigma=((($table_array[25+$j]**2)+($table_array[35+$j]**2)+($table_array[45+$j]**2)+($table_array[55+$j]**2)+($table_array[65+$j]**2)+($table_array[75+$j]**2))**0.5);
print NEW "$sigma ";
$sigma_plus_nominal[$j]=($sigma*3)+($table_array[15+$j]);
#if((($j+1)%5)=="0"){print NEW "\n";}
}
print NEW "\n";
print NEW "ADD 3sigma+nominal table\n";
for ($k=0; $k<5; $k++) {
print NEW "$sigma_plus_nominal[$k] ";
}
print NEW "\n";
}
}
}
close(LIB);
close(NEW);
沒有留言:
張貼留言