From 136c8995d40f0010f4dbd474fa7cecabf388322b Mon Sep 17 00:00:00 2001 From: Dan White Date: Sun, 2 Jan 2011 12:52:25 -0600 Subject: [PATCH 2/6] gnetlist: spice-sdb: write provided subckt parameters from value= attr for input pages defining a subcircuit (has a "device=spice-subcircuit-LL" attribute). Information is 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 files changed, 26 insertions(+), 2 deletions(-) diff --git a/gnetlist/scheme/gnet-spice-sdb.scm b/gnetlist/scheme/gnet-spice-sdb.scm index 98586b6..9679f68 100644 --- a/gnetlist/scheme/gnet-spice-sdb.scm +++ b/gnetlist/scheme/gnet-spice-sdb.scm @@ -235,6 +235,28 @@ ) + +;;---------------------------------------------------------- +;; 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)) ;; assign package + (device (get-device package)) ;; assign device. + ) ;; end of let* assignments + (begin + ;; (display (string-append "in get-schematic-type, device = " device "\n")) + (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. + ) + ) + ) ; end of let* +)) + ;;----------------------------------------------------------- ;; This iterates through the schematic and compiles a list of ;; all spice-IO pins found. This is used when writing out @@ -1867,11 +1889,13 @@ (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 "subckt params: " params "\n")) ;; (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.7.0.4