All,
Below is from a CBR file describing the pins, or IO for an IC
circuit. I need code that takes code as an input and returns a list
that can be read into a CAD tool in SKILL(lisp language) syntax.
Where .SUBCKT RE1321_4 is the begining of the list of pins, if a new
line is needed it is started with a + sign. Therefore, with this
circuit we have 4 lines that describe pins, three
that lines that start with + sign. Code needs to look for
the .SUBCKT RE1321_4 and look for the plus signs. There are other +
signs in the circuit.
The output needs to like this...
("ANT" "DCS_RX"....."last pin")
>From file RE1321_4.cbr
.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
Here is what I clumped together so far. I also need the file name to
be an input at the UNIX prompt, thus
> NavInput.pl RE1321_4.cbr
The code takes RE1321_4.cbr as the input file name and the output file
name would be:
RE1321_4.NavInputPins.list
#!/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);
Thank you far all and any help,
Eric
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/