$dirname2 = "/remote/amscae35/chihwang/TSMC/Eval2017/testcase/tcbn28hpcplusbwp30p140oppulvt_150a/INST_F";
opendir(DIR, $dirname1) or die "can't opendir $dirname1: $!";
while (defined($file = readdir(DIR))) {
$dut = $dirname1."/".$file;
$target = $dirname2."/".$file;
## print $dut."\n";
open(h1, "<$dut");
open(h2, ">>$target");
while(<h1>){
if($i eq "1"){
print h2 $_;
$i = 0 ;
}
## adding liberty attributes
if(/set_liberty_attribute/){
print h2 $_;
}
## adding slew/load index
if(/from/){
$escape_loop = 1;}
if(/to/){
$escape_loop = 1;}
if($escape_loop eq "0"){
if(/-- explicit_points_load/){
print h2 $_;
$i = 1 ;
}
if(/-- explicit_points_slew/){
print h2 $_;
$i = 1 ;
}}
$escape_loop = 0;
## adding liberty_timing_type
if($save_liberty_timing_type ge "1"){
print h2 $_;
$save_liberty_timing_type = $save_liberty_timing_type - 1 ;
}
if(/create_parameter liberty_timing_type/){
print h2 $_;
$save_liberty_timing_type =4
}
}
}
closedir(DIR);