Hi, I am an intern and new to the world of perl. I have to enhance the script with new naming convention so it can parse the new rules.
Actually this script is comparing two text files, techfile and referene file. techfile used to have old set of rules and the following script is for the old techfile. Now. I have a new techfile with few new rules, so I have to enhance the old script for the new techfile.
Old tech file -

`POLYNOMIAL_BASED_EM_DC {
LENGTH_RANGES { 1e38 }
EM_POLYNOMIALS {
{ 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * (W/0.9)) }
}
}
POLYNOMIAL_BASED_EM_RMS {
LENGTH_RANGES { 1e38 }
EM_POLYNOMIALS {
{ 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * (W/0.9)) }
}
}
`

New tech file -

`POLYNOMIAL_BASED_EM_DC {
COND_RULE { L > 0 AND W > 0}
EM_POLYNOMIAL { 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * (
+W/0.9)) IMAX -2.632 + (27.136 * (W/0.9)) }
}
POLYNOMIAL_BASED_EM_RMS {
COND_RULE { L > 0 AND W > 0}
EM_POLYNOMIAL { 0.3802 + (13.4739 * sqrt(W/0.9)) + (4.6272 * (
+W/0.9)) }
}
`

Here's the part of the code.

`my $rw = open(FILE, $techfile);
if(not defined($rw)) {
die "ERROR Can't read techfile! \n";
}
while(defined(my $i = <FILE>)) {
chomp($i);
if( $i =~ /metal/ ) {
$blockMetal=1;
$curlev=&LevelList("metal ",$i);
$metals{$curlev}=();
}
if( $i =~ /via/ ) {
$blockVia=1;
$curlev=&LevelList("via ",$i);
$vias{$curlev}=();
}
#start single metal-level extraction
if($blockMetal > 0) {
$zBlock=&CharCount($zBlock,$i);
if( $i =~ /POLYNOMIAL_BASED_EM_DC/ ) {
$blockEMDC=1;
}
#start extraction
#POLYNOMIAL_BASED_EM_DC block for single metal level
if($blockEMDC > 0) {
$zzBlock=&CharCount($zzBlock,$i);
push @readin, $i; #line added to array
if($zzBlock == 0) {
$blockEMDC=0;
$readin=join(' ',@readin); #connect whole block to one
+ string
$_=&CreateHash($readin,\%{$metals{$curlev}{'POLY_BASED
+_EM_DC'}},'DC',$eps);
#if(!$_) {print("$curlev DC consistent is fine!\n")};#
+only for debugging
if($_==1){print("$curlev DC lentgh AND width ranges bl
+ock is missing!\n")}
elsif($_==2){print("$curlev DC count of lentgh-ranges
+AND count of EM_POLYNOMIALS blocks doesn't match!\n")}
elsif($_==3){print("$curlev DC count of width-ranges A
+ND count of EM_POLYNOMIALS block-lines doesn't match!\n")}
+
undef @readin;
undef $readin;
undef $zzBlock;
}
}
#end extraction
#POLYNOMIAL_BASED_EM_DC block for single metal level
`