I'm working on a project that shares schematic pages, and needed a way
to map generic net names on one sheet with specific net uses on
another.  Yes, this is the way I want to do it - it lets me do the
"wiring" with a spreadsheet :-)

Anyway, I wrote a script to massage the output of the new pcb
importer, and attach it here for fun.  Note that if you map one net to
more than one output, it maps all those nets to the last output noted.
In my case, I had two nets on one sheet that shared a pin on the part
on the other sheet.

--- pcbfwd-netmap ---
#!/usr/bin/perl
# -*- perl -*-

$mapfile = shift;

open(MAP, $mapfile);
while (<MAP>) {
    ($old, $new) = split(' ');
    if ($map{$old}) {
        $map{$map{$old}} = $new;
    }
    $map{$old} = $new;
}
close MAP;

while (<>) {
    if (/Netlist\(Add,(.*),(.*)\)/) {
        $net = $1;
        $pin = $2;
        if ($map{$net}) {
            $net = $map{$net};
        }
        print "Netlist(Add,$net,$pin)\n";
    } else {
        print;
    }
}

--- Makefile --
.PHONY: sampleboard.imp
sampleboard.imp : $(SRCLIST)
        gnetlist -g pcbfwd -o sampleboard.imp.tmp $(SRCLIST)
        pcbfwd-netmap sampleboard.netmap sampleboard.imp.tmp > sampleboard.imp

--- sampleboard.netmap ---

P17     S1_TX
P16     S1_RX
P15     S1_CLK
P86     S1_RTS
P85     S1_CTS
P16     S1_SDA
P17     S1_SCL

--- .pcb attributes --

Attribute("import::mode" "make")
Attribute("import::outfile" "sampleboard.imp")
Attribute("import::src0" "sample1.sch")
Attribute("import::src1" "sample2.sch")


_______________________________________________
geda-user mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user

Reply via email to