Hi,
I want to write a perl code to calculate total area of device pfet but the result is wrong.
The total_area_pfet_reduce = (1.5*0.325)+ (1*0.325) =0.8125
but my perl code give the the wrong result 1.3 because
(1.5*0.325) + (1*0.325) + (1.5*0.325) = 1.3
I do not why it add 3 times instead of 2 times
What I like to do is open the file test.cdl and find "pfet" then search for l=0.325 then add all w*l. If l is not equal 0.325 then ignore that area.
Many thanks,
Tony
#!/usr/bin/perl
###################################################################################
#
print " Enter device name:";
chomp(my $device = <STDIN>);
my $a = "test";
open(IN,$a) || die "can not open $a for reading: $!";
while (<IN>) {
if ($device eq 'pfet') {
if (/\bpfet/) {
@str_array = split(/=/,$_);
if ($str_array[2] = 0.325) {
$area_reduce_pfet = $str_array[1]*$str_array[2];
$total_area_pfet_reduce += $area_reduce_pfet;
}
}
}
}
printf "total_area_pfet_reduce %.2f%s\n", $total_area_pfet_reduce;