[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: multi-page hierarchy



gene -

On Thu, Feb 14, 2008 at 06:50:13AM -0500, gene wrote:
> >> Larry Doolittle wrote:
> >>> Right.  This is a prime example of the tools being expert-friendly.
> >>> It's no sweat for someone like me to add a perl script to the
> >>> processing chain to rename the resistors in a consistent and
> >>> design-appropriate fashion.
> 
> any chance you could share that script?

No sweat.  That part is really only two lines of a perl
script that handles a lot of other "features" of my design
flow, like attaching power to all the banks of an FPGA
based on the pin definition file from Xilinx.

I'll attach the script.  The key lines for this purpose are
        s/inch_(\d)\/(\S+)1(\d\d)/$2$1$3/g;
        s/\S+\///g;
which replaces instances of e.g., inch_3/R101 with R301.
I happen to have four instantiations of the subcircuit,
named inch_1, inch_2, inch_3, and inch_4.  All components in
the subcircuit take the form C101, C102, R101, R102, U101, etc.
All the rest of the circuit needs to use components outside
those ranges, especially R1 through R99, but I do have another
section that uses R801-R899 etc.  The second line above strips
off the instance names from those parts.

My flow actually starts from Xcircuit, not gschem, but as long
as they agree on the format of a netlist (I think they do),
this processing step is not affected.

You can see this script in its full design context at
  http://recycle.lbl.gov/llrf4/
which I have mentioned many times before on this list.

   - Larry
#!/usr/bin/perl

# see board2/scripts/post for other ideas
# input is combo.pcbnet
#
# cut and paste non-connected messages from pcb message log after
# an "O" command, into the mess2 file.
# awk '$8=="U1"{gsub("\"","",$4);print $4,"U1-"$10}' mess2 >mess2x
#
# mess2x is also a reasonable source of info for a .ucf file

if (open(X,"mess2x")) {
	while (<X>) {
		chomp();
		($a,$b)=split();
		# print "found $a,$b\n";
		$fpga{$a}=$b;
	}
}

%smap = (
  "GND"    => "GND",
  "VCCINT" => "+1.2VD",
  "VCCAUX" => "+2.5VD",
  "VCCO_0" => "+2.5VD",
  "VCCO_1" => "+2.5VD",
  "VCCO_2" => "+3.3VD",
  "VCCO_3" => "+3.3VD",
  "VCCO_4" => "+3.3VD",
  "VCCO_5" => "+3.3VD",
  "VCCO_6" => "+2.5VD",
  "VCCO_7" => "+2.5VD"
);
if (open(S,"spartan3_ft256.csv")) {
	while (<S>) {
		chomp();
		($dum,$dum,$pad,$sig,$dum,$dum,$dum,$dum,$dum,$bank)=split(",");
		# print "$sig $smap{$sig} $pad\n";
		if ($smap{$sig}) {
			$spartan{$smap{$sig}} .= "   U1-".$pad." \\\n";
		}
	}
}

while (<>) {
	chomp();
	s/inch_(\d)\/(\S+)1(\d\d)/$2$1$3/g;
	s/\S+\///g;
	($name,@rest)=split();
	if ($fpga{$name}) {$append=$fpga{$name};}
	if ($append && !/\\$/) {print "$_ $append\n"; $append="";}
	elsif ($spartan{$name}) {$r=join(" ",@rest); print "$name $spartan{$name}   $r\n";}
	else { print "$_\n";}
}

_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user