SOC時(shí)序分析中的跳變點(diǎn)
附錄 A:在SDF中考慮負(fù)互連時(shí)延的腳本
#!/usr/local/bin/perl
print n***************RUNNING PERL SCRIPT negaTIvedelinsdf_assarray.pl****nn;
if (!exists $ARGV[0] || !exists $ARGV[1]) { print USAGE:: negativedelinsdf_assarray.pl
}
open(FILEA,$ARGV[0]) || die (ERROR:: SDF file $ARGV[0] cannot be opened for reADIngn);
open(file1, >$ARGV[1]) || die (ERROR:: file $ARGV[1] cannot be opened for writingn);
while(
{ $line = $_;
$line1 = $line;
$line =~ s/^s+//g ;
if ( $line =~ INTERCONNECT.*-[0-9]) ######## FINDING NEGATIVE INTERCONNECT ######
{
@array1 = split(/s+/,$line);
$count = @array1;
if ($count == 4){ ## To accont for the fact that only one INTERCONNECT triplet is present
$array1[$count]= $array1[$count-1];
$count = $count + 1;
}
for($i=0;$i= $count -3;$i++)
{print file1 $array1[$i] ;}
$value2 = $array1[$count -1];
$value1 = $array1[$count -2];
$instance_name = $array1[2];
@instance = split(///,$instance_name);
$count2 = @instance;
$pin_name = $instance[$count2 -1]; ####### GETTING LOAD INSTANCE PIN NAME ###############
$instance_name =~ s//[^(.*/)][A-Z0-9a-z_[0-9]+]*$//g; ####### GETTING LOAD INSTANCE NAME ###############
if( $value1 =~ ::)
{ $value1 =~ s/[()]//g;
@correct_value1 = split(/::/,$value1);
$load_correct_value1_0{$instance_name} = $correct_value1[0];
$load_correct_value1_1{$instance_name} = $correct_value1[1];
if($correct_value1[0] = -0.0) #####NEGATIVE CHANGED TO ZERO DELAY######
{$correct_value1[0] = 0.000;}
if($correct_value1[1] = -0.0)
{$correct_value1[1] = 0.000;}
print file1 ($correct_value1[0]::$correct_value1[1]);
}
elsif( $value1 =~ :[^:])
{ $value1 =~ s/[()]//g;
@correct_value1 = split(/:/,$value1);
$load_correct_value1_0{$instance_name} = $correct_value1[0];
$load_correct_value1_1{$instance_name} = $correct_value1[1];
$load_correct_value1_2{$instance_name} = $correct_value1[2];
if($correct_value1[0] = -0.0) #####NEGATIVE CHANGED TO ZERO DELAY######
{$correct_value1[0] = 0.000;}
if($correct_value1[1] = -0.0)
{$correct_value1[1] = 0.000;}
if($correct_value1[2] = -0.0)
{$correct_value1[2] = 0.000;}
print file1 ($correct_value1[0]:$correct_value1[1]:$correct_value1[2]);
}
else{print file1 $value1 ;}
if( $value2 =~ ::)
{ $value2 =~ s/[()]//g;
@correct_value2 = split(/::/,$value2);
$load_correct_value2_0{$instance_name} = $correct_value2[0]; ########NEGATIVE CHANGED TO ZERO DELAY#####
$load_correct_value2_1{$instance_name} = $correct_value2[1];
if($correct_value2[0] = -0.0)
{$correct_value2[0] = 0.000;}
if($correct_value2[1] = -0.0)
{$correct_value2[1] = 0.000;}
if ($correct_value1[0] == $correct_value2[0] $correct_value1[1] == $correct_value2[1] ) { # Print these values only if they are differnet from the already printed values for the INTERCONNECT
print file1 )n;
} else {
print file1 ($correct_value2[0]::$correct_value2[1]))n;
}
}
elsif( $value2 =~ :[^:])
{ $value2 =~ s/[()]//g;
@correct_value2 = split(/:/,$value2);
$load_correct_value2_0{$instance_name} = $correct_value2[0]; ########NEGATIVE CHANGED TO ZERO DELAY#####
$load_correct_value2_1{$instance_name} = $correct_value2[1];
$load_correct_value2_2{$instance_name} = $correct_value2[2];
if($correct_value2[0] = -0.0)
{$correct_value2[0] = 0.000;}
if($correct_value2[1] = -0.0)
{$correct_value2[1] = 0.000;}
if($correct_value2[2] = -0.0)
{$correct_value2[2] = 0.000;}
if ($correct_value1[0] == $correct_value2[0] $correct_value1[1] == $correct_value2[1] $correct_value1[2] == $correct_value2[2]) { # Print these values only if they are differnet from the already printed values for the INTERCONNECT
print file1 )n;
} else {
print file1 ($correct_value2[0]:$correct_value2[1]:$correct_value2[2]))n;
}
}
$load_instance{$instance_name} = $instance_name; ##SAVE ALL LOAD INSTACES FOR NEG DELAY IN THE ASSOCIATIVE ARRAY##
$load_pin{$instance_name.$pin_name} = $pin_name; ##SAVE ALL LOAD PINS FOR NEG DELAY IN THE ASSOCIATIVE ARRAY##
}
elsif ($line =~ CELL ) {
print file1 $line;
$find = 0;
}
elsif($line =~ INSTANCE ) ##CHECKING CORRESPONDING INSTANCES AND FIND FLAG = 1 IF FOUND######
{
print file1 $line1;
@array2 = split(/s+/,$line);
$instance_name2 = $array2[1]; ##GETTING THE LOAD INSTANCE NAME FOUND HERE##########
$instance_name2 =~ s/[()]//g;
$instance_definition{$instance_name2} = $instance_name2 ;
if(exists $load_instance{$instance_name2}) ####COMPARE INSTANCE NAME WITH THAT SAVED IN ASSO ARRAY#####
{
if($load_instance{$instance_name2} eq $instance_name2)
{$find = 1;}
}
}
elsif($line =~ IOPATH $find == 1) ##AFTER INSTANCES ARE FOUND CHECKING FOR CORRSPONDING PINS######
{
@array4 = split(/s+/,$line);
if ($array4[0] =~ COND ) { ## Take care of COND statements
$pin_name2 = $array4[3];
} else {
$pin_name2 = $array4[1];
}
if($line =~ IOPATH exists $load_pin{$instance_name2.$pin_name2} ) {
if ( $load_pin{$instance_name2.$pin_name2} eq $pin_name2 )
{
@array3 = split(/s+/,$line);
$count3 = @array3 ;
@value_IOPATH = ; # This is to initialize the array to blank
if ($array3[0] =~ COND ) {
for ($j=5; $j=$count3 ; $j++) {
$value_IOPATH[$j-5] = $array3[$j];
$value_IOPATH_width = @value_IOPATH;
if ($count3 == 6) { #### In case there is only one triplet for COND.*IOPATH
$value_IOPATH[1] = $value_IOPATH[0];
}
#$value1_IOPATH = $array3[5];
#$value2_IOPATH = $array3[6];
}
$constant_fields = 4;
} elsif ($array3[0] =~ IOPATH) {
for ($k=3; $k=$count3 ; $k++) {
$value_IOPATH[$k-3] = $array3[$k];
$value_IOPATH_width = @value_IOPATH;
if ($count3 == 4) { #### In case there is only one triplet for IOPATH
$value_IOPATH[1] = $value_IOPATH[0];
}
#$value1_IOPATH = $array3[3];
#$value2_IOPATH = $array3[4];
}
$constant_fields = 2;
}
for($i=0;$i= $constant_fields;$i++)
{print file1 $array3[$i] ;}
if( $value_IOPATH[0] =~ ::) ####CORRECT OR ACCOMODATING THE NEG DELAY VALUES HERE #########
{ $value_IOPATH[0] =~ s/[()]//g;
@correct_value1_IOPATH = split(/::/,$value_IOPATH[0]);
if(exists $load_correct_value1_0{$instance_name2}) {
if($load_correct_value1_0{$instance_name2} 0.0) { # So that only negative delay value triplet is changed in the IOPATH syntax
if ( abs($load_correct_value1_0{$instance_name2}) $correct_value1_IOPATH[0] ) { ###the absolute value to negative delay is larger than the timing of load arc. ######
$correct_value1_IOPATH[0] = $correct_value1_IOPATH[0] + $load_correct_value1_0{$instance_name2};
} else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}
}
}
if(exists $load_correct_value1_1{$instance_name2})
{ if( $load_correct_value1_1{$instance_name2} 0.0) {
if ( abs($load_correct_value1_1{$instance_name2}) $correct_value1_IOPATH[1] ) {
$correct_value1_IOPATH[1] = $correct_value1_IOPATH[1] + $load_correct_value1_1{$instance_name2};}
else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}}}
print file1 ($correct_value1_IOPATH[0]::$correct_value1_IOPATH[1]);
}
elsif( $value_IOPATH[0] =~ :[^:]) ####CORRECT OR ACCOMODATING THE NEG DELAY VALUES HERE #########
{ $value_IOPATH[0] =~ s/[()]//g;
@correct_value1_IOPATH = split(/:/,$value_IOPATH[0]);
if(exists $load_correct_value1_0{$instance_name2}) {
if($load_correct_value1_0{$instance_name2} 0.0) { # So that only negative delay value triplet is changed in the IOPATH syntax
if ( abs($load_correct_value1_0{$instance_name2}) $correct_value1_IOPATH[0] ) {
$correct_value1_IOPATH[0] = $correct_value1_IOPATH[0] + $load_correct_value1_0{$instance_name2};
} else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}
}
}
if(exists $load_correct_value1_1{$instance_name2}) {
if($load_correct_value1_1{$instance_name2} 0.0) { # So that only negative delay value triplet is changed in the IOPATH syntax
if ( abs($load_correct_value1_1{$instance_name2}) $correct_value1_IOPATH[1] ) {
$correct_value1_IOPATH[1] = $correct_value1_IOPATH[1] + $load_correct_value1_1{$instance_name2};
} else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}
}
}
if(exists $load_correct_value1_2{$instance_name2}) {
if($load_correct_value1_2{$instance_name2} 0.0) { # So that only negative delay value triplet is changed in the IOPATH syntax
if ( abs($load_correct_value1_2{$instance_name2}) $correct_value1_IOPATH[2] ) {
$correct_value1_IOPATH[2] = $correct_value1_IOPATH[2] + $load_correct_value1_2{$instance_name2};
} else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}
}
}
print file1 ($correct_value1_IOPATH[0]:$correct_value1_IOPATH[1]:$correct_value1_IOPATH[2]);
}
else{print file1 $value_IOPATH[0] ;} # This is to print empty brackets in case rise and fall triplets are empty
if( $value_IOPATH[1] =~ ::)
{ $value_IOPATH[1] =~ s/[()]//g;
@correct_value2_IOPATH = split(/::/,$value_IOPATH[1]);
if(exists $load_correct_value2_0{$instance_name2}) {
if( $load_correct_value2_0{$instance_name2} 0.0)
{ if ( abs($load_correct_value2_0{$instance_name2}) $correct_value2_IOPATH[0] ) {
$correct_value2_IOPATH[0] = $correct_value2_IOPATH[0] + $load_correct_value2_0{$instance_name2};}
else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}}}
if(exists $load_correct_value2_1{$instance_name2}) {
if( $load_correct_value2_1{$instance_name2} 0.0)
{ if ( abs($load_correct_value2_1{$instance_name2}) $correct_value2_IOPATH[1] ) {
$correct_value2_IOPATH[1] = $correct_value2_IOPATH[1] + $load_correct_value2_1{$instance_name2};}
else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}}}
if ($correct_value1_IOPATH[0] == $correct_value2_IOPATH[0] $correct_value1_IOPATH[1] == $correct_value2_IOPATH[1]) { # Print these values only if they are differnet from the already printed values for the IOPATH
} else {
print file1 ($correct_value2_IOPATH[0]::$correct_value2_IOPATH[1]);
}
}
elsif( $value_IOPATH[1] =~ :[^:])
{ $value_IOPATH[1] =~ s/[()]//g;
@correct_value2_IOPATH = split(/:/,$value_IOPATH[1]);
if(exists $load_correct_value2_0{$instance_name2}) {
if( $load_correct_value2_0{$instance_name2} 0.0) {
if ( abs($load_correct_value2_0{$instance_name2}) $correct_value2_IOPATH[0] ) {
$correct_value2_IOPATH[0] = $correct_value2_IOPATH[0] + $load_correct_value2_0{$instance_name2};}
else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}}}
if(exists $load_correct_value2_1{$instance_name2}) {
if( $load_correct_value2_1{$instance_name2} 0.0) {
if ( abs($load_correct_value2_1{$instance_name2}) $correct_value2_IOPATH[1] ) {
$correct_value2_IOPATH[1] = $correct_value2_IOPATH[1] + $load_correct_value2_1{$instance_name2};}
else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}}}
if(exists $load_correct_value2_2{$instance_name2}) {
if( $load_correct_value2_2{$instance_name2} 0.0) {
if ( abs($load_correct_value2_2{$instance_name2}) $correct_value2_IOPATH[2] ) {
$correct_value2_IOPATH[2] = $correct_value2_IOPATH[2] + $load_correct_value2_2{$instance_name2};}
else { print IOPATH delay for $load_pin{$instance_name2.$pin_name2} of $instance_name2 is smaller than the INTERCONNECT delay n;}}}
if ($correct_value1_IOPATH[0] == $correct_value2_IOPATH[0] $correct_value1_IOPATH[1] == $correct_value2_IOPATH[1] $correct_value1_IOPATH[2] == $correct_value2_IOPATH[2]) { # Print these values only if they are differnet from the already printed values for the IOPATH
} else {
print file1 ($correct_value2_IOPATH[0]:$correct_value2_IOPATH[1]:$correct_value2_IOPATH[2]);
}
}
else{print file1 $value_IOPATH[1] ;} # This is to print empty brackets in case rise and fall triplets are empty
for ($m=2;$m=$value_IOPATH_width;$m++) {
if (exists $value_IOPATH[$m]) {
$value_IOPATH[$m] =~ s/)+/)/; # To account for the brackets
print file1 $value_IOPATH[$m];
}
}
if ($array4[0] =~ COND ) { ## Extra bracket for COND statements
print file1 ))n;
} else {print file1 )n;}
}
}
else
{print file1 $line1;} #######DUMPING OUT OF SDF IN FILE1######################
}
else
{print file1 $line1;}
}
close(file1);
close(fileA);
open(FILEA,$ARGV[0]) || die (ERROR:: SDF file $ARGV[0] cannot be opened for readingn);
print nn#############REPORTING INSTANCES WHOSE DEFINITION IS NOT THERE IN THE SDF#############n;
while(
{
$line2 = $_;
$line2 =~ s/^s+//g ;
if ( $line2 =~ INTERCONNECT.*-[0-9])
{ @array4 = split(/s+/,$line2);
$instance_name3 = $array4[2];
$instance_name3 =~ s//[^(.*/)][A-Z0-9a-z_[0-9]+]*$//g;
if(exists $instance_definition{$instance_name3})
{}
else
{print $line2;}
}
}
close(fileA);
print n;
評(píng)論