[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: gEDA-user: How I'd write a netlister in Scheme... Was: Introduction and some questions/thoughts on gEDA/gaf...



Paul Bunyk wrote:
Hello again, everyone!

Well, I've been studying gEDA/gnetlist codebas for a while now and
I do have a feeling that there ought to be a better way to do netlisting,
espcially since it is conceptually a rather simple operation. Well, the hard
part is maintaining net connectivity, which is done now on libgeda level,
in C, right? Nothing prevents us from storing a list of nets to which
individual pins of a component are connected as an instance attribute
(alternatively, can we attach attributes to instance pins? -- this is what
Cadence DFII is doing during "Check and Save", but having a single list
attached to an instance in pinseq order is just fine too).

After that the job of a netlister is to loop through all components on a
schematic page and call special-purpose element-writing functions.
The most natural way to pass component attributes to those functions
is to (eval (let ((model "modelName")
                        (refdes "U25")
                        (netnames (list "net1" "net15" "GND"))
                         <all other attributes on the component>)
                       (processElement) ; special-purpose function
                       ;; update attributes -- see below
                      ))
-- of course the (let) block is  constructed on the fly with macros.
Now, (processElement) sees all relevant attributes as just scheme
variables, moreover, if, say, (model) is not defined for a given element
scheme itself can search up the scope for an appropriate default.

Now, for netlister we need read-only access to schematic, but an iterator
over all elements can be made even more useful by, after (processElement)
is called, chacking if attributes (scheme variables) were changed  by
(processElement)
and, if yes, saving chages back to schematic (backannotation, scaling, etc.)

To handle hierarchy it would be up to (processElement) function to decide
if we want flat netlist, then call (netlist source) recursively if
source is defined
or, if we want to preserve hierarchy in the netlist, to add 'source'
to the set of
things to netlist later.

Is there anything else that generic netlister has to do besides this? If no,
I'll try to prototype it as soon as I get some kind of scheme command line
working...

netname and refdes aliasing.

I wonder if we ever want to include something like the CDF/siminfo stuff cadence uses.

Whatever I end up doing will have to take this into account (read: I will
probably stick with scheme but use a different portable interpreter).

-Ales


Any thoughts on what could that be? I can see that guile is not the most
active project (well, kind of competes with Hurd ;-) ), even Gimp now
uses another smaller scheme interpreter. PLT scheme seems to be
quite popular in the crowd, and they do have leight-weighted embeddable
MzScheme (http://www.plt-scheme.org/software/mzscheme/) package,
as well as nice development environment
http://www.plt-scheme.org/software/drscheme/,
seems to be pretty active too.

Not to ask a silly question, but lack of frequent releases could mean the product is more or less complete and "done". That said, I haven't really looked much at how guile hooks into the C side of things. I've only used it from the scheme end. Without having looked at how much CPU and/or operating system dependent stuff is in guile my biggest fear is that if it is not maintained that it will stagnate with newer processors and operating systems.


As far as mzscheme, I compiled it on NetBSD-2.0.2/i386 and Solaris-2.9/sparc all with gcc-3. Got 5 warnings on the i386 box, 27 on the solaris one. Without much digging it seems at least some are real bugs. There were some warnings about dreferencing type punned pointers. Not sure if those will cause problems. The build system is a bit of a hack. Also tried to build on NetBSD-2.0.2/alpha and it failed to link. Haven't quite gotten to the bottom of it yet. I was able to run the mzscheme binary and try

(print "hello,world")
(exit)

-Dan