[Xcircuit-dev] xcircuit 2.5.1, spice netlist bug and quick patch to netlist.c

Conrad H Ziesler nospamcziesler at umich.edu
Sun Jan 13 13:27:44 PST 2002


problem:  flat spice netlist works fine, hierarchical netlist only
outputs root cell
version: xcircuit-2.5.1

attatched is a hackish fix for the problem.  something  is wrong with
the original clear_traversed routine,

i can send a xcircuit file that fails if needed to reproduce the bug.

--conrad
-------------- next part --------------
*** xcircuit-2.5.1/netlist.c	Tue Nov 20 22:08:57 2001
--- xcircuit-2.5.1-local/netlist.c	Sun Jan 13 16:14:54 2002
***************
*** 2527,2532 ****
--- 2527,2560 ----
  
  #endif	/* HAVE_PYTHON */
  
+ 
+ 
+ 
+ 
+ /******************************
+  this is a horrible hack. but it does fix the bug, which seems to be
+    some subtle problem with the existing clear_traversed routine
+    which seems to use a different linked list of object children instead
+    of the calllist.  perhaps some inconsistency.
+ **************/
+ 
+ void hack_clear_traversed(objectptr cschem, int depth)
+ {
+   CalllistPtr calllist = cschem->calllist;
+   if(depth>1024) return;
+ 
+   for (; calllist != NULL; calllist = calllist->next) 
+     { 
+       calllist->callobj->traversed=False;
+       hack_clear_traversed(calllist->callobj,depth+1);
+     }
+ }
+ /******** end of horrible hack, cziesler at umich.edu **********/
+ 
+ 
+ 
+ 
+ 
  /*----------------------------------------------------------------------*/
  /* Write a netlist depending on the mode chosen				*/
  /*----------------------------------------------------------------------*/
***************
*** 2562,2568 ****
--- 2590,2609 ----
     if (!strcmp(mode, "spice")) {
        fprintf(fp, "*SPICE circuit \"%s\" from XCircuit v%3.2f\n\n",
  		cschem->name, version);
+      
+       
+ 
        writeglobals(cschem, fp);
+       
+       /*******************************************************/
+       /* bug: heir spice netlist doesn't output subckts
+ 	 fix/hack: clear flags in subckts for traversal, normal routine doesn't do it correctly 
+ 	 author: Conrad Ziesler, cziesler at eecs.umich.edu
+       */
+       hack_clear_traversed(cschem,0);
+       /*******************************************************/
+            
+ 
        writehierarchy(cschem, NULL, fp);
     }
     else if (!strcmp(mode, "flatspice")) {


More information about the Xcircuit-dev mailing list