;; initialize the net-name aliasing (gnetlist:build-net-aliases switcap:map-net-names all-unique-nets) ;; initialize the refdes aliasing (gnetlist:build-refdes-aliases switcap:map-refdes packages)
The other initialization which is typically done, although not required by all netlist types, is to output some sort of header. This header may be explicitly contained in the entry point function or it may be contained in its own function for code clarity. In the switcap backend, the call is:
(switcap:write-top-header port)Note that the convention is for any backend specific functions to have their names prefixed by the backend name. For example all switcap specific functions begin with ``switcap:''. Functions which are available to all backends and provided by gnetlist are prefixed by ``gnetlist:''.
The definition of ``switcap:write-top-header'' is
;; ;; Switcap netlist header ;; (define switcap:write-top-header (lambda (port) (display "/* Switcap netlist produced by gnetlist (part of gEDA) */\n" port) (display "/* See http://www.geda.seul.org for more information. */\n" port) (display "/* Switcap backend written by Dan McMahill */\n" port) (display "\n\n" port) ) )
The entry point function continues by calling functions for each section in the output netlist. The variable ``packages'' is predefined by gnetlist to be a list of all components in the design and ``all-unique-nets'' is a list of all the nets in the design. The various functions used by the backend for each section in the netlist will use these variables. For example, the main part of the switcap netlist which contains the components and their connectivity is written to the output file with
(switcap:write-netlist port packages)
Ales Hvezda 2006-01-23