r5826 - trunk/gta02-core/bom

werner at docs.openmoko.org werner at docs.openmoko.org
Sun Feb 7 14:59:07 CET 2010


Author: werner
Date: 2010-02-07 14:59:06 +0100 (Sun, 07 Feb 2010)
New Revision: 5826

Modified:
   trunk/gta02-core/bom/Makefile
   trunk/gta02-core/bom/annotate
Log:
Annotation now largely works. Makefile is now too messy.

- bom/annotate: corrected coordinate transformations, offsets, and alignments
- bom/annotate: added code to strike through text, for debugging
- bom/Makefile: added targets for generating and viewing annotated schematics
  (in progress)



Modified: trunk/gta02-core/bom/Makefile
===================================================================
--- trunk/gta02-core/bom/Makefile	2010-02-07 10:11:07 UTC (rev 5825)
+++ trunk/gta02-core/bom/Makefile	2010-02-07 13:59:06 UTC (rev 5826)
@@ -10,6 +10,7 @@
 .PHONY:		all spotless upload show-dup show-missing show-dk
 # mark them as phony since we have incomplete dependencies in this Makefile
 .PHONY:		fic/fic.equ fic/fic.inv fic/missing.equ
+.PHONY:		ann sch gen generate gv xpdf
 
 all:		gta02-core.ord
 
@@ -72,9 +73,11 @@
 		  ./prettyord - digi-key.dsc | \
 		  sed 's/^...  //'
 
-ann:		annotate ../pmu.sch fic/fic.dsc gta02-core.par $(EQU)
-		perl ./annotate ../pmu.sch fic/fic.dsc gta02-core.par $(EQU) \
-		  >pmu-bom.sch || { rm -f pmu-bom.sch; exit 1; }
+#ANN = pmu
+ANN = audio
+ann:		annotate ../$(ANN).sch fic/fic.dsc gta02-core.par $(EQU)
+		perl ./annotate ../$(ANN).sch fic/fic.dsc gta02-core.par \
+		  $(EQU) >$(ANN)-bom.sch || { rm -f $(ANN)-bom.sch; exit 1; }
 
 $(SCH:%=%-bom.sch): \
 		annotate $(SCH:%=../%.sch) fic/fic.dsc gta02-core.par $(EQU)
@@ -91,5 +94,17 @@
 		sed 's/\.sch"/-bom.sch"/' <$< >$@ || \
 		  { rm -f $@; exit 1; }
 
-sch:		gta02-core-bom.pro gta02-core-bom.sch #$(SCH:%=%-bom.sch)
+sch:		gta02-core-bom.pro gta02-core-bom.sch
 		eeschema `pwd`/gta02-core-bom.sch
+
+gen generate:	gta02-core-bom.pro gta02-core-bom.sch $(SCH:%=%-bom.sch)
+		eeschema --plot `pwd`/gta02-core-bom.sch
+		../scripts/all-sheets gta02-core-bom
+		gzip -f -9 gta02-core-bom-all.ps
+		../scripts/all-sheets --pdf gta02-core-bom
+
+gv:		gta02-core-bom-all.ps.gz
+		gv gta02-core-bom-all.ps.gz
+
+xpdf:		gta02-core-bom-all.pdf
+		xpdf gta02-core-bom-all.pdf

Modified: trunk/gta02-core/bom/annotate
===================================================================
--- trunk/gta02-core/bom/annotate	2010-02-07 10:11:07 UTC (rev 5825)
+++ trunk/gta02-core/bom/annotate	2010-02-07 13:59:06 UTC (rev 5826)
@@ -18,8 +18,8 @@
 
     # convert from (x0, y0, w, h) to (x0, y0, x1, y1)
     $t[2] += $t[0];
-    $t[3] += $t[1];
-    return @t;
+    $t[3] = $t[1]-$t[3];
+    return ($t[0], $t[3], $t[2], $t[1]);
 }
 
 
@@ -31,8 +31,8 @@
 sub invert
 {
     my @m = @_;
-    my $f = $_[0]*$_[3]-$_[1]*$_[2];
-    return ($f*$_[3], -$f*$_[1], -$f*$_[2], $f*$_[0]);
+    my $f = 1/($m[0]*$m[3]-$m[1]*$m[2]);
+    return ($f*$m[3], -$f*$m[1], -$f*$m[2], $f*$m[0]);
 }
 
 
@@ -40,8 +40,7 @@
 {
     my @t = &normalize(@_);
     push(@block, [ @t ]);
-#    push(@block, [ &normalize(@_) ]);
-$wnl .= "Wire Notes Line\n\t$t[0] $t[1] $t[2] $t[3]\n";
+    $wnl .= "Wire Notes Line\n\t$t[0] $t[1] $t[2] $t[3]\n";
 }
 
 
@@ -65,7 +64,7 @@
 {
     local ($x0, $y0, $ref, @s) = @_;
 
-    my $h = @s*$H;
+    my $h = @s*$L;
     my $w = 0;
     for (@s) {
 	my $t = $W*length $_;
@@ -74,10 +73,10 @@
     my $a = 270;
     my $r = 100;
     my $x, $y;
-    $y0 -= $h-$H/2;
+    my $ym = $y0-$h+$H/2;
     for ($i = 0; $i != 128; $i++) {
 	$x = int($x0+$r*cos($a/180*3.14159));
-	$y = int($y0+$r*sin($a/180*3.14159));
+	$y = int($ym+$r*sin($a/180*3.14159));
 	last if &pass($x, $y, $w, $h);
 	$a += 22.5;
 	$r += $L/8;
@@ -85,16 +84,20 @@
     warn "no place found for \"$s[0]\"" if $i == 128;
 
     my @m = &invert( @{ $m{$ref} });
-    my $dx = $x-$x0;
-    my $dy = $y-$y0;
-    my $sx = $x0+$dx*$m[0]+$dy*$m[1];
-    my $sy = $y0+$dx*$m[2]+$dy*$m[3]; #-$H/2;
-    &block($sx, $sy, $w, $h);
+    &block($x, $y+$H/2, $w, $h);
     my $n = 10;
-    for (reverse @s) {
-	my $hv = $rot{$ref} ? "V" : "H";
-	print "F $n \"$_\" $hv $x $y $H  0000 L CNN\n";
-	$y += $L;
+    for my $s (reverse @s) {
+	my $dx = $x-$x0;
+	my $dy = $y-$y0;
+	my $sx = $x0+$dx*$m[0]+$dy*$m[1];
+	my $sy = $y0+$dx*$m[2]+$dy*$m[3];
+	($hv, $hj, $vj) = ("H", "L", "C") if $m[0] == 1;
+	($hv, $hj, $vj) = ("H", "R", "C") if $m[0] == -1;
+	($hv, $hj, $vj) = ("V", "C", "B") if $m[1] == 1;
+	($hv, $hj, $vj) = ("V", "C", "T") if $m[1] == -1;
+	$s =~ s/~/-/g;
+	print "F $n \"$s\" $hv $sx $sy $H  0000 $hj ${vj}NN\n";
+	$y -= $L;
 	$n++;
     }
 }
@@ -111,7 +114,6 @@
     my @m = split(/\s+/);
     shift @m;
     $m{$ref} = [ @m ];
-    $rot{$ref} = 1 if !$m[0];
 }
 
 
@@ -137,7 +139,7 @@
     next if $flag != 0;
     $w = $size*0.8*length $s;
     # we don't need to consider H/V
-    &block($hj eq "L" ? $x : $x-$w/2, $y-$size/2, $w, $size);
+    &block($hj eq "L" ? $x : $x-$w/2, $y+$size/2, $w, $size);
 }
 
 #
@@ -172,10 +174,15 @@
 	    $seen{$_} = 1;
 	}
 	undef @f;
-	&put($x, $y, $ref, @u);
+	# $m{$ref}[0] == 1	OK
+	# $m{$ref}[0] == -1	OK
+	# $m{$ref}[1] == 1	OK
+	# $m{$ref}[1] == -1	OK (small deviations found)
+	&put($x, $y, $ref, @u) if 1 || $m{$ref}[1] == -1;
     }
     if (/\$EndSCHEMATC/) {
-	print $wnl;
+	# uncomment for debugging
+#	print $wnl;
     }
     print "$_\n";
 }




More information about the commitlog mailing list