Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Parsing A File

by gautam_buddha (Initiate)
on May 06, 2004 at 16:21 UTC ( [id://351195]=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing A File
in thread Parsing A File

below mwntioned is the format of my file the values of capacitances and trasition will change .... the actual file is a huge one so it will be asy if it is parsed ..... the desires output is to have the exact name of the module : net : and gate where the change has taken place. thanks for your help regards
Module: gg_PCI_PORT_bc_unit_224 [bc_pci_u3/bc_unit_u49] Net: inp_d_1 Max Capacitance = 0.61 (bc_0:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A2 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A2 [NAN2D1]) Pin Worst Transition = 7.60 VIOLATION = -6.10 Max Transition = 1.50 (bc_1:A2 [EXOR2D1]) Pin Worst Transition = 7.60 VIOLATION = -6.10 Max Transition = 1.50 (bc_2:A2 [NOR2D1]) Pin Worst Transition = 7.60 VIOLATION = -6.10 Max Transition = 1.50 (bc_3:A2 [NAN2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_4:A2 [NOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Net: inp_c_1 Max Capacitance = 0.61 (bc_0:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A1 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A1 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A1 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_flop_reg_reg:RB [SDFRPQ1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A1 [NAN2D1]) Pin Worst Transition = 7.60 VIOLATION = -6.10 Max Transition = 1.50 (bc_1:A1 [EXOR2D1]) Pin Worst Transition = 7.60 VIOLATION = -6.10 Max Transition = 1.50 (bc_2:A1 [NOR2D1]) Pin Worst Transition = 7.60 VIOLATION = -6.10 Max Transition = 1.50 (bc_3:A1 [NAN2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_4:A1 [NOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_flop_reg_reg:RB [SDFRPQ1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Module: gg_PCI_PORT_bc_unit_223 [bc_pci_u3/bc_unit_u48] Net: inp_d_1 Max Capacitance = 0.61 (bc_0:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A2 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A2 [NAN2D1]) Pin Worst Transition = 7.58 VIOLATION = -6.08 Max Transition = 1.50 (bc_1:A2 [EXOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_2:A2 [NOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_3:A2 [NAN2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_4:A2 [NOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Net: inp_c_1 Max Capacitance = 0.61 (bc_0:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A1 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A1 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A1 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_flop_reg_reg:RB [SDFRPQ1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A1 [NAN2D1]) Pin Worst Transition = 7.58 VIOLATION = -6.08 Max Transition = 1.50 (bc_1:A1 [EXOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_2:A1 [NOR2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_3:A1 [NAN2D1]) Pin Worst Transition = 7.59 VIOLATION = -6.09 Max Transition = 1.50 (bc_4:A1 [NOR2D1]) Pin Worst Transition = 7.58 VIOLATION = -6.08 Max Transition = 1.50 (bc_flop_reg_reg:RB [SDFRPQ1]) Pin Worst Transition = 7.58 VIOLATION = -6.08 Module: gg_PCI_PORT_bc_unit_222 [bc_pci_u3/bc_unit_u47] Net: inp_d_1 Max Capacitance = 0.61 (bc_0:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A2 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A2 [NAN2D1]) Pin Worst Transition = 7.52 VIOLATION = -6.02 Max Transition = 1.50 (bc_1:A2 [EXOR2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_2:A2 [NOR2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_3:A2 [NAN2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_4:A2 [NOR2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Net: inp_c_1 Max Capacitance = 0.61 (bc_0:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A1 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A1 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A1 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_flop_reg_reg:RB [SDFRPQ1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A1 [NAN2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_1:A1 [EXOR2D1]) Pin Worst Transition = 7.54 VIOLATION = -6.04 Max Transition = 1.50 (bc_2:A1 [NOR2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_3:A1 [NAN2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_4:A1 [NOR2D1]) Pin Worst Transition = 7.53 VIOLATION = -6.03 Max Transition = 1.50 (bc_flop_reg_reg:RB [SDFRPQ1]) Pin Worst Transition = 7.52 VIOLATION = -6.02 Module: gg_PCI_PORT_bc_unit_221 [bc_pci_u3/bc_unit_u46] Net: inp_d_1 Max Capacitance = 0.61 (bc_0:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A2 [EXOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_2:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_3:A2 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_4:A2 [NOR2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Transition = 1.50 (bc_0:A2 [NAN2D1]) Pin Worst Transition = 7.47 VIOLATION = -5.97 Max Transition = 1.50 (bc_1:A2 [EXOR2D1]) Pin Worst Transition = 7.48 VIOLATION = -5.98 Max Transition = 1.50 (bc_2:A2 [NOR2D1]) Pin Worst Transition = 7.47 VIOLATION = -5.97 Max Transition = 1.50 (bc_3:A2 [NAN2D1]) Pin Worst Transition = 7.48 VIOLATION = -5.98 Max Transition = 1.50 (bc_4:A2 [NOR2D1]) Pin Worst Transition = 7.48 VIOLATION = -5.98 Net: inp_c_1 Max Capacitance = 0.61 (bc_0:A1 [NAN2D1]) Net Capacitance = 6.04 VIOLATION = -5.43 Max Capacitance = 0.61 (bc_1:A1 [EXOR2D1]) Net Capacitance = 6.04

theorbtwo: Added code and readmore tags.

Replies are listed 'Best First'.
Re^3: Parsing A File
by tkil (Monk) on May 07, 2004 at 09:08 UTC
    the desires output is to have the exact name of the module : net : and gate where the change has taken place.

    What change? Without knowing which values you are trying to compare, I can't offer a complete solution.

    Ah, you have two files that you want to compare. Ok. So you turn each one into a data structure, then iterate over one, and report differences against the other.

    Just turning the format you give into a data structure is easy. Although, if the actual input is as large as you say it is, note that this might not be the right answer. If this simulation takes a substantial part of your computer's memory when done in C, trying to create a Perl data structure for the entire output will likely fail. Picking just certain gates should be ok, though.

    Here's the basic pattern you want to follow. Each line is either introducing a new thing to describe, or it is continuing the description of the most recently introduced thing. Either way, we store the description in a data structure (potentially creating a new "slot" if it is a new thing being introduced.)

      Hi! I tried a similar approach but facing problem in creating the hash structure..... in subroutine readDRC could u suggest .....
      print " #!/usr/local/bin/perl ################################################ # Author : Sayandeep Nag # Date : 04 May 2004 # Description : Utility to Compare DRC Files ################################################ my $drcFile1 ; my $drcFile2 ; my $init1; my $init2; BEGIN { require Exporter ; use Carp ; # Initialize Global Variables ; $drc::error = " " ; $drc::warn = " " ; $drc::verbose = 0 ; $drc::DEBUG_ = 0 ; $drc::tmpFile = " " ; } $drc::flag = 0 ; use strict; # if( $#ARGV-1 <= 1 ) { # If File Name is Not Specifie +d as Input Argument # print "Enter The First DRC File : " ; # $drcFile1 = <STDIN> ; chop $drcFile1 ; # length $drcFile1 ; # print "Enter The Second DRC File : " ; # $drcFile2 = <STDIN> ; chop $drcFile2 ; # length $drcFile2 ; # } # else { # %{$ARGV[0]} = "" ; # %{$ARGV[1]} = "" ; $drcFile1 = $ARGV[0] ; # Else Take file Name from I +nput Argument $drcFile2 = $ARGV[1] ; # Else Take file Name from I +nput Argument # } $init1 = drcInit( $drcFile1 ) ; # Initialising the Inpu +t Files $init2 = drcInit( $drcFile2 ) ; if ( ($init1 == -1 ) or ($init2 == -1) ) { print "$drc::error\n" ; } # DRC Files Initialised # Processing of DRC files to Eliminate Comment +s Log ( " Processing DRC File $drcFile1\n " ) if ( $drc::verbose ) ; # If $drc::verbose is set my $retValue1 ; $retValue1 = processDRC ( $drcFile1 ) ; Log ( " Processing DRC File $drcFile2\n " ) if ( $drc::verbose ) ; # If $drc::verbose is set my $retValue2 ; $retValue2 = processDRC ( $drcFile2 ) ; return -1 if ( ($retValue1 == -1) or ( $retValue2 == -1) ) ; my $retValue2 ; Log ( " Reading DRC File $drcFile2\n " ) if ( $drc::verbose ) ; # If $drc::verbose is set $retValue2 = readDRC($drcFile1 , $drc::flag ) ; return -1 if ($retValue1 == -1) ; # Log ( " Reading DRC File $drcFile2\n " ) # if ( $drc::verbose ) ; # If $drc::verbose is set # $retValue2 = readDRC($drcFile2 , $drc::flag ) ; # return -1 if ( $retValue2 == -1) ; exit 0; ###################################################################### # Name : drcInit # Description : Subroutine to Initialise Input Files # Date : 4 May 2004 ###################################################################### sub drcInit { my ( $file ) = @_ ; $drc::error = "" ; $drc::warn = "" ; do { carp " No DRC File Given ." ; $drc::error = " No DRC File Given ." ; return -1 ; } unless ( defined $file ) ; # If No DRC File Specified do { carp " DRC File $file is Not a Plain Text File ."; $drc::error = " DRC File $file is Not a Plain Text File ."; return -1; } unless ( -f $file && -T $file ) ; # If File is not a vali +d Text File return 0 ; # Initialization Successful. } ###################################################################### # Name : processDRC # Description : Subroutine to Process Input Files and Eliminate # Comments # Date : 4 May 2004 ###################################################################### sub processDRC { my ( $file ) = @_ ; $drc::tmpFile = "${file}.tmp" if ($file) ; open ( TMPDRC, ">$drc::tmpFile" ); # Opening Temporary File + In Write Mode open (DRC , "<$file" ) ; # Opening DRC File in Read Mod +e Log ( " Reading DRC File $file..... ") if ($drc::verbose ); my $line ; my $prevLine ; my $lineNo = 0 ; while ( $line = <DRC> ) { $lineNo++ ; Log ( "." ) if ( $lineNo/1000==int($lineNo/1000) && $drc::ve +rbose) ; $line =~ s/\n//g ; next unless ( length $line ) ; # ignore blank lin +es. next if ( $line =~ m/^\s*\*/ ); # weed out commen +ts. next if ( $line =~ m/^\s*\|/ ); # weed out commen +ts. next if ( $line =~ m/^\s*\+/ ); # weed out commen +ts. print TMPDRC "$prevLine\n" if ( $prevLine ) ; $prevLine = $line ; } print TMPDRC "$prevLine\n" if ( $prevLine ) ; Log ( "... done.\n" ) if ( $drc::verbose ) ; close DRC ; close TMPDRC ; return 0; # Phase 1 successful. } ###################################################################### # Name : readDRC # Description : Subroutine to read Input Files and find differences # Date : 4 May 2004 ###################################################################### sub readDRC ( ) { my ( $file , $flag ) = @_ ; $drc::tmpFile1 = "${file}.tmp" if ($file) ; my $moduleName = "" ; my $netName ; my @gateInst ; my $gate ; my $netCap ; my $violation ; my @maxTrans ; my $worstTrans ; open ( TMPDRC, "<$drc::tmpFile1" ) ; my $line ; my $i; my $j = 0 ; @drc::file1 = <TMPDRC> ; for ( $i = 0 ; $i <= $#drc::file1 - 1 ; $i++ ){ if ( $drc::file1[$i] =~ m/^\s*\Module:/i ) { $moduleName = getModuleName ( $drc::file1[$i] ) ; } # End of IF Statement if ( $drc::file1[$i] =~ /Net:/ ) { $netName = getNetName ( $drc::file1[$i] ) ; } # End of IF Statement if ( $drc::file1[$i] =~ /Max Capacitance/ ) { @gateInst = getMaxCapacitance ( $drc::file1[$i] ) ; $gate = $gateInst[5].$gateInst[6] ; } # End of IF Statement if ( $drc::file1[$i] =~ /Net Capacitance/ ) { $netCap = getNetCapacitance ( $drc::file1[$i] ) ; } # End of IF Statement if ( $drc::file1[$i] =~ /VIOLATION/ ) { $violation = getViolation ( $drc::file1[$i] ) ; if ( $drc::flag ) { $drc::rpt1{$moduleName}{$netName}{$gate}{"Cap +acitance"} = $violation; } else { $drc::rpt2{$moduleName}{$netName}{$gate}{"Capaci +tance"} = $violation; } } # End of IF Statement if ( $drc::file1[$i] =~ /Max Transition/ ) { @maxTrans = getMaxTransition ( $drc::file1[$i] ) ; $gate = $maxTrans[5].$maxTrans[6] ; } # End of IF Statement if ( $drc::file1[$i] =~ /Pin Worst Transition/ ) { $worstTrans = getWorstTransition ( $drc::file1[$i] ) ; } # End of IF Statement if ( $drc::file1[$i] =~ /VIOLATION/ ) { $violation = getViolation ( $drc::file1[$i] ) ; if ( $drc::flag ) { $drc::rpt1{$moduleName}{$netName}{$gate}{"Tra +nsition"} = $violation } else { $drc::rpt2{$moduleName}{$netName}{$gate}{"Tran +sition"} = $violation } } # End of IF Statement # } # End of FOR Loop # if ($flag) {compareFiles(\@drc::rpt1 , \@drc::rpt2 , \$drc::tmpFile +1 ) } # Calling The Function to Compare Values # only if both Hashes are +assigned printValues(\@drc::rpt1) ; # my $caps = "Capacitance" ; # my $tran = "Transition"; # if ( $drc::rpt1{$moduleName}{$netName}{$gate}{$tran} != $drc::rp +t2{$moduleName}{$netName}{$gate}{$tran}) { # print " Module = $moduleName \n" ; # print " Net = $netName \n" ; # print " Gate = $gate \n" ; # print " Transition Violation Value = $drc::rpt1{$modu +leName}{$netName}{$gate}{$tran} \n" ; # print " Capacitance Violation Value = $drc::rpt1{$mod +uleName}{$netName}{$gate}{$caps} \n" ; # print " Transition Violation NEW Value = $drc::rpt2{$ +moduleName}{$netName}{$gate}{$tran} \n" ; # } # End of IF } # End of FOR Loop close TMPDRC ; $drc::flag = 1 ; # unlink ( $drc::tmpFile1 ) if ( -f $drc::tmpFile1 ) ; return 0 ; # mission successful :=) } ###################################################################### # Name : getModuleName # Description : Subroutine to read Input Files and find Module Names # Date : 4 May 2004 ###################################################################### sub getModuleName { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; $stmt =~ s/^\s*\Module:\s+//i; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\tModule Name : $parts[0]\n" ; } if( $parts[0] ) { return $parts[0]; } else {return -1 ;} } ###################################################################### # Name : getNetName # Description : Subroutine to read Input Files and find Net Names in a + # Particular Module # Date : 7 May 2004 ###################################################################### sub getNetName { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\t\tNet Name : $parts[2] \n" ; } if( $parts[2] ) { return $parts[2]; } else {return -1 ;} } ###################################################################### # Name : getMaxCapacitance # Description : Subroutine to read Input Files and find Net Names in a + # Particular Module # Date : 7 May 2004 ###################################################################### sub getMaxCapacitance { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\t\t\t\t : $parts[5] $parts[6] \n" ; } if( $parts[2] ) { return $parts[2]; } else {return -1 ;} } ###################################################################### # Name : getNetCapacitance # Description : Subroutine to read Input Files and find Net Names in a + # Particular Module # Date : 7 May 2004 ###################################################################### sub getNetCapacitance { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\t\t\t\t : $parts[4] \n" ; } if( $parts[2] ) { return $parts[4]; } else {return -1 ;} } ###################################################################### # Name : getViolation # Description : Subroutine to read Input Files and find Net Names in a + # Particular Module # Date : 7 May 2004 ###################################################################### sub getViolation { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\t\t\t\t : $parts[3] \n" ; } if( $parts[2] ) { return $parts[3]; } else {return -1 ;} } ###################################################################### # Name : getMaxTransition # Description : Subroutine to read Input Files and find Net Names in a + # Particular Module # Date : 7 May 2004 ###################################################################### sub getMaxTransition { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\t\t\t\t : $parts[5] $parts[6]\n" ; } if( $parts[2] ) { return @parts; } else {return -1 ;} } ###################################################################### # Name : getWorstTransition # Description : Subroutine to read Input Files and find Net Names in a + # Particular Module # Date : 7 May 2004 ###################################################################### sub getWorstTransition { my ($stmt) = @_ ; $drc::error = "" ; $drc::warn = "" ; my @parts ; @parts = split /\s+/, $stmt ; if ( $drc::DEBUG_ ) { print "\t\t\t\t\t : $parts[5] \n" ; } if( $parts[2] ) { return $parts[5]; } else {return -1 ;} } ###################################################################### # Name : compareFiles # Description : Subroutine to Compare Contents of two files stored in # two different hashes # Date : 7 May 2004 ###################################################################### sub compareFiles { my ($rpt1 , $rpt2 , $file) = @_ ; $drc::tmpFile2 = "${file}.tmp" if ($file) ; open ( TMPDRC, "<$drc::tmpFile2" ) ; @drc::file2 = <TMPDRC> ; print "$file \n" ; print " Main Hoon Naa \n" ; my $moduleName = "" ; my $netName ; my @gateInst ; my $gate ; my $netCap ; my $violation ; my @maxTrans ; my $worstTrans ; my $i ; my $caps = "Capacitance" ; my $tran = "Transition"; for ( $i = 0 ; $i <= $#drc::file2 - 1 ; $i++ ){ if ( $drc::file2[$i] =~ m/^\s*\Module:/i ) { $moduleName = getModuleName ( $drc::file2[$i] ) ; } # End of IF Statement if ( $drc::file2[$i] =~ /Net:/ ) { $netName = getNetName ( $drc::file2[$i] ) ; } # End of IF Statement if ( $drc::file2[$i] =~ /Max Capacitance/ ) { @gateInst = getMaxCapacitance ( $drc::file[$i] ) ; $gate = $gateInst[5].$gateInst[6] ; } # End of IF Statement if ( $drc::file2[$i] =~ /Net Capacitance/ ) { $netCap = getNetCapacitance ( $drc::file2[$i] ) ; } # End of IF Statement if ( $drc::file[$i] =~ /VIOLATION/ ) { $violation = getViolation ( $drc::file2[$i] ) ; # if ( $drc::flag ) { $rpt1{$moduleName}{$netName}{$gate}{"Capacit +ance"} = $violation; } # else { $rpt2{$moduleName}{$netName}{$gate}{"Capacitanc +e"} = $violation; } } # End of IF Statement if ( $drc::file2[$i] =~ /Max Transition/ ) { @maxTrans = getMaxTransition ( $drc::file2[$i] ) ; $gate = $maxTrans[5].$maxTrans[6] ; } # End of IF Statement if ( $drc::file2[$i] =~ /Pin Worst Transition/ ) { $worstTrans = getWorstTransition ( $drc::file2[$i] ) ; } # End of IF Statement if ( $drc::file2[$i] =~ /VIOLATION/ ) { $violation = getViolation ( $drc::file2[$i] ) ; # if ( $drc::rpt1{$moduleName}{$netName}{$gate}{$tran} != $drc::rp +t2{$moduleName}{$netName}{$gate}{$tran}) { # print " Module = $moduleName \n" ; # print " \t\t Net = $netName \n" ; # print " \t\t\t Gate = $gate \n" ; # print " \t\t\t\t Transition Violation OLD Value = $dr +c::rpt1{$moduleName}{$netName}{$gate}{$tran} " ; # print " \t\t\t\t Transition Violation NEW Value = $dr +c::rpt2{$moduleName}{$netName}{$gate}{$tran} " ; # } # End of IF } # End of IF Statement } # End of FOR Loop } # End of SUBROUTINE ###################################################################### # Name : searchModuleName # Description : Subroutine to read Input Files and find Module Names i +n # second file # Date : 6 May 2004 ###################################################################### sub printValues { my ($rpt1) = @_ ; my $module ; my $net ; my $gate ; my $vlte ; foreach $module ( keys %rpt1 ) { print "$module"; foreach $net ( keys %{ $rpt1{$module} } ) { print "{$net}" ; foreach ( keys %{ $rpt1{$module}{$net} } ) { print "{$gate}" ; foreach $vlte ( keys %{ $rpt1{$module}{$net}{$gate} } ) { print "{$vlte}" ; } } } } # if ( $drc::rpt1{$moduleName}{$netName}{$gate}{$tran} != $drc::rp +t2{$moduleName}{$netName}{$gate}{$tran}) { # print " Module = $moduleName \n" ; # print " \t\t Net = $netName \n" ; # print " \t\t\t Gate = $gate \n" ; # print " \t\t\t\t Transition Violation OLD Value = $dr +c::rpt1{$moduleName}{$netName}{$gate}{$tran} " ; # print " \t\t\t\t Transition Violation NEW Value = $dr +c::rpt2{$moduleName}{$netName}{$gate}{$tran} " ; # } # End of IF } ###################################################################### # Name : searchModuleName # Description : Subroutine to read Input Files and find Module Names i +n # second file # Date : 6 May 2004 ###################################################################### sub searchModuleName { # Subroutind to Search Module in Second +Temporary File my ($ModuleName , $file1 , $file2) = @_ ; open ( TMPDRC2, "<$file2" ) ; my $searchModule; my $line; my $i; @drc::file2 = <TMPDRC2> ; # Storing Contents of File in an Arr +ay for ( $i = 0 ; $i <= $#drc::file2 - 1 ; $i++ ){ if ( $drc::file2[$i] =~ m/^\s*\Module:/i ) { $searchModule = getModuleName ( $drc::file2[$i] ) ; } if ( $ModuleName eq $searchModule ) { print " $ModuleName Found in both files $i \n" ; } else { print " $ModuleName Not Found in second file $i\n" ; } } # End of While Loop close TMPDRC2; return 0; } # End of Subroutine searchModuleName ###################################################################### # Name : Log # Description : Subroutine Print Log Output # Date : 6 May 2004 ###################################################################### sub Log { my ( $msg ) = @_ ; print $msg ; } ";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://351195]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2024-04-24 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found