From ba15fbc1856a12f716d27fb80883547e8de4bdb1 Mon Sep 17 00:00:00 2001 From: Dan White Date: Sun, 2 Jan 2011 12:52:25 -0600 Subject: [PATCH] gnetlist: spice-sdb: write provided subckt parameters from value= attr for input pages defining a subcircuit (has a "device=spice-subcircuit-LL" attribute), parameters are provided through the value= attribute attached to the "spice-subcircuit-LL" symbol. E.g.: .subckt name n1 n2 n3 n4 M=1 foo=43 *contents .ends --- gnetlist/scheme/gnet-spice-sdb.scm | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/gnetlist/scheme/gnet-spice-sdb.scm b/gnetlist/scheme/gnet-spice-sdb.scm index 28af5a7..a2e4841 100644 --- a/gnetlist/scheme/gnet-spice-sdb.scm +++ b/gnetlist/scheme/gnet-spice-sdb.scm @@ -98,6 +98,8 @@ ;; to be used for netlisting NGspice device models. CC ;; 6.12.2011 -- Updated the Problematci name=? symbols to name=unknown and removed the ;; FIXME check for them. This should be a step closer to place holder consistancy. CC +;; 1.13.2011 -- Subcircuits use the value= attribute attached to the spice-subcircuit-LL symbol +;; to hold parameters. Dan White ;; ;;********************************************************************************** ;; @@ -245,6 +247,27 @@ ) + +;;---------------------------------------------------------- +;; Get the value= attribute of the spice-subcircuit-LL device. +;; For holding subcircuit parameters. +;;--------------------------------------------------------- +(define spice-sdb:get-subcircuit-params + (lambda (ls) + (let* ((package (car ls)) + (device (get-device package)) + ) + (begin + (if (string=? device "spice-subcircuit-LL") ;; look for subcircuit label + (let* ((value (gnetlist:get-package-attribute package "value")) + ) + (if (string=? value "unknown") "" value)) + (spice-sdb:get-subcircuit-params (cdr ls)) ;; otherwise just iterate to next package. + ) + ) + );let* +)) + ;;----------------------------------------------------------- ;; This iterates through the schematic and compiles a list of ;; all spice-IO pins found. This is used when writing out @@ -1815,11 +1838,12 @@ (debug-spew "found .SUBCKT type schematic") ;; now write out .SUBCKT header and .SUBCKT line (spice-sdb:write-subcircuit-header port) - (let ((io-nets-string (list-2-string io-nets-list)) ) + (let ((io-nets-string (list-2-string io-nets-list)) + (params (spice-sdb:get-subcircuit-params packages)) ) ;; (display (string-append "Found IO nets for subckt = " io-nets-string "\n")) ;; DEBUG stuff . . . ;; (write io-nets-list) ;; (display "\n") - (display (string-append schematic-type " " (list-2-string io-nets-list) "\n") port) + (display (string-append schematic-type " " (list-2-string io-nets-list) params "\n") port) ) ) -- 1.8.3.2