r4978 - in trunk/gta02-core: . scripts
werner at docs.openmoko.org
werner at docs.openmoko.org
Wed May 13 18:17:32 CEST 2009
Author: werner
Date: 2009-05-13 18:17:31 +0200 (Wed, 13 May 2009)
New Revision: 4978
Added:
trunk/gta02-core/scripts/
trunk/gta02-core/scripts/all-sheets-ps
trunk/gta02-core/scripts/expand-pintype
Log:
expand-pintype: adds a text field with the pin type to each pin.
all-sheets-ps: uses psmerge to concatenate the Postscript files (generated
with the "Plot" function) of all the sheets of the gta02-core schematics.
Added: trunk/gta02-core/scripts/all-sheets-ps
===================================================================
--- trunk/gta02-core/scripts/all-sheets-ps (rev 0)
+++ trunk/gta02-core/scripts/all-sheets-ps 2009-05-13 16:17:31 UTC (rev 4978)
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+B=gta02-core
+
+OUT=$B-all
+SHEETS="$B $B-CPU $B-PMU $B-MEMORY $B-AUDIO $B-IO"
+
+psmerge -o$OUT.ps `for n in $SHEETS; do echo $n.ps; done`
Property changes on: trunk/gta02-core/scripts/all-sheets-ps
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/gta02-core/scripts/expand-pintype
===================================================================
--- trunk/gta02-core/scripts/expand-pintype (rev 0)
+++ trunk/gta02-core/scripts/expand-pintype 2009-05-13 16:17:31 UTC (rev 4978)
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+#
+# expand-pintype
+#
+# usage:
+#
+# expand-pintype input.lib
+# expand-pintype input.lib output.lib
+#
+
+
+$GAP = 50; # gap between pin and type, in mil
+$CHAR_WIDTH = 66; # default character width, in mil
+$NAME_WIDTH = 15; # name field width in ASCII mode, in characters
+
+
+%map = (
+ "I" => "Input",
+ "O" => "Output",
+ "B" => "BiDi",
+ "T" => "3-state",
+ "P" => "Passive",
+ "U" => "Unspec",
+ "W" => "Pwr In",
+ "w" => "Pwr Out",
+ "C" => "OC",
+ "E" => "OE",
+);
+
+if (@ARGV < 2) {
+ $out = 0;
+} elsif (@ARGV == 2) {
+ $file = pop @ARGV;
+ $out = 1;
+ open(FILE, ">$file") || die "$file: $!";
+} else {
+ print STDERR "usage: expand-pintype input.lib [output.lib]\n";
+ exit(1);
+}
+
+while (<>) {
+ if ($out) {
+ # make name differ so that KiCad's cache doesn't get confused
+ s/^DEF\s+/$&X/;
+ s/^F1\s+"+/$&X/;
+ print FILE || die;
+ }
+ next unless /^X/;
+ @a = split(/\s+/);
+ ($name, $pin, $x, $y, $dir, $unit, $pt) = @a[1, 2, 3, 4, 6, 9, 11];
+ $type = $map{$pt};
+ $type = "???" unless defined $type;
+ if ($out) {
+ $off = $GAP+(length $type)*$CHAR_WIDTH/2;
+ if ($dir eq "U") {
+ ($a, $y) = (90, $y-$off);
+ } elsif ($dir eq "D") {
+ ($a, $y) = (90, $y+$off);
+ } elsif ($dir eq "R") {
+ ($a, $x) = (0, $x-$off);
+ } else {
+ ($a, $x) = (0, $x+$off);
+ }
+ $type =~ y/ /~/;
+ print FILE sprintf("T %d %d %d 60 0 %d 0 %s Normal 0\n",
+ $a*10, $x, $y, $unit, $type);
+ } else {
+ $s = "$name ($pin)";
+ $f = $NAME_WIDTH-length $s;
+ $f = "-" x ($f > 0 ? $f : 0);
+ print "$s $f $type\n";
+ }
+}
+if ($out) {
+ close FILE || die;
+}
Property changes on: trunk/gta02-core/scripts/expand-pintype
___________________________________________________________________
Name: svn:executable
+ *
More information about the commitlog
mailing list