P
perl_newbie
I have created a data structure that checks the hierarchy list to a
list found in cadence. I'd like to use the getopt::long package to do
the following but do not know if this could be done.
1) when the flag 'unused' is chosen then it should get the $cadecells
and have them be executed by a command to remove them
"dssc remove $cadcell"
2)I am unable to reference the $hier->{$cell} in my last subroutine.
the $hierec->{$cell} contains the $lib but when I use the
data:umper;the $hierec->{$cell} ;which should have all $lib shows up
empty, why?.
use strict
use Getopt::Long;
use Data:umper;
my $show_file={};
my $hierec={};
my $cell={};
my $lib={};
my $cadcell={};
my $cadlib={};
my @cell=();
if (! & GetOptions('help', 'unused'))
{ print"Invalid Flag. please try -help.\n";}
if (@ARGV == 2 )
{
my $list1=$ARGV[0];
my $list2=$ARGV[1];
open(L1,"<$list1") || die "cannot open first file";
open(L2,"<$list2") || die "cannot open second file";
}
if (! my $opt_nosyntax)
{
print ("\nARGS were: ",join(" ",@ARGV),"\n");
print ("\nSYNTAX is:\n",
"hierarchy_list cadence_list <Flag_options>\n");
print("\tFlag_options include:\n");
print("\t\t-help\n");
print("\t\t-unused\n");
}
while(<L1>)
{
$show_file=$_;
if ($show_file=~/^\s?(\S+)\s+(\S+)/)
{
my ( $cell, $lib)= ($2, $1);
$hierec->{$cell}->{$lib}=1;
}
}
&comp_2_cell_list;
sub comp_2_cell_list
{
foreach(<L2>)
{
if(~/^\s?(\S+)\s+(\S+)/)
{
my ($cadlib,$cadcell)=($1,$2);
if(! exists($hierec->{$cadcell}))
{
print "list to dump: $cadcell\n";
}
unless ( exists $hierec->{$cell}->{$cadlib})
cannot obtain the keys from my hash to be reference here for comparing
if the same cell is found in the same lib. help???
{
print "mismatch in:{$hierec} ($hierec->{$cell},$cadlib)\n";
}
}
}
}
-----------------input files----------------------------
lib0 cell1
lib1 cell2
lib2 cell3
lib3 cell4
lib4 cell5
cadence:
lib0 cell1
lib0 cell1A --to be marked for deletion
lib1 cell2
lib3 cell4
lib3 cell4a --to be marked for deletion;
lib4 cell4 --to be marked for deletion; found in wrong lib
lib4 cell5
list found in cadence. I'd like to use the getopt::long package to do
the following but do not know if this could be done.
1) when the flag 'unused' is chosen then it should get the $cadecells
and have them be executed by a command to remove them
"dssc remove $cadcell"
2)I am unable to reference the $hier->{$cell} in my last subroutine.
the $hierec->{$cell} contains the $lib but when I use the
data:umper;the $hierec->{$cell} ;which should have all $lib shows up
empty, why?.
use strict
use Getopt::Long;
use Data:umper;
my $show_file={};
my $hierec={};
my $cell={};
my $lib={};
my $cadcell={};
my $cadlib={};
my @cell=();
if (! & GetOptions('help', 'unused'))
{ print"Invalid Flag. please try -help.\n";}
if (@ARGV == 2 )
{
my $list1=$ARGV[0];
my $list2=$ARGV[1];
open(L1,"<$list1") || die "cannot open first file";
open(L2,"<$list2") || die "cannot open second file";
}
if (! my $opt_nosyntax)
{
print ("\nARGS were: ",join(" ",@ARGV),"\n");
print ("\nSYNTAX is:\n",
"hierarchy_list cadence_list <Flag_options>\n");
print("\tFlag_options include:\n");
print("\t\t-help\n");
print("\t\t-unused\n");
}
while(<L1>)
{
$show_file=$_;
if ($show_file=~/^\s?(\S+)\s+(\S+)/)
{
my ( $cell, $lib)= ($2, $1);
$hierec->{$cell}->{$lib}=1;
}
}
&comp_2_cell_list;
sub comp_2_cell_list
{
foreach(<L2>)
{
if(~/^\s?(\S+)\s+(\S+)/)
{
my ($cadlib,$cadcell)=($1,$2);
if(! exists($hierec->{$cadcell}))
{
print "list to dump: $cadcell\n";
}
unless ( exists $hierec->{$cell}->{$cadlib})
cannot obtain the keys from my hash to be reference here for comparing
if the same cell is found in the same lib. help???
{
print "mismatch in:{$hierec} ($hierec->{$cell},$cadlib)\n";
}
}
}
}
-----------------input files----------------------------
lib0 cell1
lib1 cell2
lib2 cell3
lib3 cell4
lib4 cell5
cadence:
lib0 cell1
lib0 cell1A --to be marked for deletion
lib1 cell2
lib3 cell4
lib3 cell4a --to be marked for deletion;
lib4 cell4 --to be marked for deletion; found in wrong lib
lib4 cell5