All, I have a file that defines pins for an IC. The code needs to find ".SUBCKT RE1321_4" and produce a list that complies with SKILL(lisp) context for Cadence tool suite, the output needs to like ("Ant" "DCS_RX"...... "last pin ") and outputs to a file...
If pins list in the file do not fit on one line the line ends and the next line has the "+" sign. The code needs to look for the + sign if on the next line following .SUBCKT RE1321_4, in this case and stop when a + sign is not found. What I have so far is posted below. I really need the user to input the circuit name, in this case "RE1321_4" and the output file to be "RE1321_4_NavInputPins.list" file. How is that done. Thank you for any and all help you people are great! Eric .SUBCKT RE1321_4 ANT DCS_RX DCS_VRX GSM_RX GSM_TX GSM_VRX GSM_VTX HB_GND PCS_TX + PCS_VTX SHUNT_GND VRXEN X1 HB_GND GSM_RX DCS_RX DCS_VRX GSM_VRX PCS_TX SHUNT_GND ANT VRXEN GSM_VTX + GSM_TX PCS_VTX __RE1321_4 rlin=18 TXgateWLB=2200 CHB_sht=3.31 rgate=4.46 + rbias=9 rlinsg=13.45 TXgateW=1500 .ENDS RE1321_4 #!/usr/bin/perl use warnings; use strict; my $read_file = 'RE1321_4.cbr'; my $write_file = 'NavInputPins.list'; open READ, '<', $read_file or die "Can't open '$read_file' $!"; open WRITE, '>', $write_file or die "Can't open '$write_file' $!"; while( my $line = <READ> ) { if( $line =~ m{ \A \.SUBCKT\ RE1321_4}x ) { my @fields = split(' ',$line); my @pins = grep(!/\n/, @fields[ 2 .. $#fields] ); print WRITE '('; print WRITE '"', join('" "',@pins); print WRITE '")', "\n"; } } close READ or die "Couldn't close '$read_file' $!"; close WRITE or die "Couldn't close '$write_file' $!"; exit(0); -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/