[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gEDA-user: gschem2pcb Issues



Eric Winsor wrote:

> Bryan,
> 
> I have seen this too and it seams to be a problem with the definition of
> the SIL package in misc.inc.  I am by no means an expert with m4 so I
> haven't divined what is wrong yet.  I have some jumpers on my board that
> I was desiring to use 1X2 headers on so I used SIL 2 in the footprint
> definition.  I then ended up with an infinite loop when gschem2pcb was
> run.  I stopped the job and examined the *.tmp.pcb file and found the
> culprit element.  I have some parts using SIL 4 and they worked with
> gschem2pcb fine, so I tried SIL 3 and I also got another infinite loop. 
> I then put SIL 4 (as a sanity check) into the element and all was fine. 
> I have the documentation on gnu m4 and am digging into this because I
> want to work on the plcc.inc file too.  I am a bit absorbed with some
> noise analysis that is pulling my time however.
> 
> Oh that black magic
> 

The SIL package definition is broken for less than 4 pins. I never use 
SIL so I hadn't notice before.
This is because the forloop is broken in m4. In essence a for i=1 to 0 
will loop forever.

The following patch fixes the SIL definition in misc.inc. I added a test
to make sure the number of pins was greater than 3 before doing the loop.

Chris.

BTW I hacked the plcc.inc too a while back if you're interested.



--- misc.inc.org	Fri Jun 28 09:35:43 2002
+++ misc.inc	Fri Jun 28 10:12:10 2002
@@ -93,6 +93,8 @@
  )')

  # -------------------------------------------------------------------
+# fixed infinite loop when parameter $4 number of
+# pins was less then 4 - Chris Ellec 6/28/2002
  # the definition of a SIL package without a common pin
  # $1: canonical name
  # $2: name on PCB
@@ -101,7 +103,7 @@
  define(`PKG_SIL',
  	`define(`MAXY', `eval(`$4' * 100 -50)')
  Element(0x00 "$1" "$2" "$3" 160 10 3 100 0x00)
-(
+ifelse(eval($4 > 3), 1, `(
  	forloop(`i', 1, $4,
  		`PIN(50, eval(i * 100 -50), 50, 20, i)
  	')
@@ -113,7 +115,16 @@
  		`ElementLine(0 eval(i * 200) 100 eval(i * 200) 10)
  	')
  	Mark(50 50)
-)')
+)', `(
+ 
forloop(`i', 1, $4,
+ 
	`PIN(50, eval(i * 100 -50), 50, 20, i)
+ 
')
+ 
ElementLine(  0 50   0 MAXY 20)
+ 
ElementLine(100 50 100 MAXY 20)
+ 
ElementArc(50  50 50 50 180 180 20)
+ 
ElementArc(50 MAXY 50 50   0 180 20)
+ 
Mark(50 50)
+)')')

  # -------------------------------------------------------------------
  # the definition of a SIL package with a common pin