################################################################################ #!/usr/bin/perl -w # # pin_expansion.pl - expand the multi-bits signals and generate a new .io file. # # By Chung-Ching Peng http://plaza.ufl.edu/peng6808/asic.html # # For usage help: Type pin_expansion.pl with no parameters # ################################################################################ if(@ARGV[0] eq "") { print "ERROR: Insufficient input fields\n"; print "\n"; print "Usage:unix> ./pin_expansion.pl <.lib file > \n"; print "\n"; exit; } ################################################################################ # Generate Buffer Statements ################################################################################ $i = 1; $j = 1; $bit_num=0; open(out,">@ARGV[0].new") || die "Couldn't open output file.\n "; print "-----------------\n"; print "output files are $ARGV[0].new \n"; print "-----------------\n"; ################################################################################ # Main Codes ################################################################################ open(infile0,"<@ARGV[0]") || die "Couldn't open infile0. @ARGV[0]\n "; while ($line = ) { if($line =~ /^Pin/) { #try to find the keyword 'Pin' chomp($line); # remove EOL print "$line\n"; if($line =~ /(^Pin):\s+(\w+)(\[(\d+):(\d+)\])\s+(\w+)/ ) { $pin_now = $2; $bit_num = $4; $direction = $6; while ($bit_num>=0) { print out "Pin: $pin_now\[$bit_num\] $direction\n"; $bit_num=$bit_num-1; } } if($line =~ /(^Pin):\s+(\w+)\s+(\w+)/ ) { $pin_now = $2; $direction = $3; print out "Pin: $pin_now $direction\n"; } } } #while ($compline1 = ) print "$i\n"; close(out); print "-----------------\n"; print "output files are $ARGV[0].new \n"; print "-----------------\n";