1 ;;; spice-mode.el --- Major mode for SPICE
3 ;; Emacs Lisp Archive Entry
4 ;; Author: Geert A. M. Van der Plas <geert_vanderplas@email.com> 1999-
5 ;; Emmanuel Rouat <emmanuel.rouat@wanadoo.fr> 1997-
6 ;; Carlin J. Vieri, MIT AI Lab <cvieri@ai.mit.edu> 1994
7 ;; Keywords: spice, spice2g6, spice3, eldo, hspice, layla, mondriaan, fasthenry, CDL, spectre compatibility, netlist editing
8 ;; Package-Requires: ((emacs "24.3"))
9 ;; Filename: spice-mode.el
11 ;; Maintainer: Geert A. M. Van der Plas <geert_vanderplas@email.com>
12 ;; Last-Updated: 01 November 2004
13 ;; Description: spice file editing
14 ;; URL: http://spice-mode.4t.com/
15 ;; old-URL: http://www.esat.kuleuven.ac.be/~vdplas/emacs/
17 ;; Please send suggestions and bug reports to
18 ;; mailto:Geert_VanderPlas@email.com
20 ;; Copyright (C) 1994, MIT Artificial Intelligence Lab
21 ;; Copyright (C) 1997- Emmanuel Rouat
22 ;; Copyright (C) 1999- Geert A. M. Van der Plas
24 ;; This file is free software; you can redistribute it and/or modify
25 ;; it under the terms of the GNU General Public License as published by
26 ;; the Free Software Foundation; either version 2, or (at your option)
29 ;; This file is distributed in the hope that it will be useful,
30 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
31 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 ;; GNU General Public License for more details.
34 ;; You should have received a copy of the GNU General Public License
35 ;; along with GNU Emacs; see the file COPYING. If not, write to
36 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
41 ;; byte compile spice-mode.el to spice-mode.elc (see `byte-compile-file')
42 ;; put these two files in an arbitrary, but accesible directory
43 ;; for example: $HOME/emacs, /usr/lib/emacs/site-lisp/ or
44 ;; /usr/local/lib/emacs/site-lisp/
46 ;; If you chose a non-standard place to put the files add the following
47 ;; line to your Emacs start-up file (`.emacs') or custom `site-start.el'
48 ;; file (replace <directory-name> by the directory where you placed
49 ;; spice-mode.el and spice-mode.elc):
50 ;; (setq load-path (cons (expand-file-name "<directory-name>") load-path))
52 ;; To use spice-mode, add either the following to your `.emacs' file. This
53 ;; assumes that you will use the .sp, .cir, .ckt, .mod, ... extensions for
54 ;; your spice source decks and output files:
55 ;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
56 ;; (setq auto-mode-alist (append (list (cons "\\.sp$" 'spice-mode)
57 ;; (cons "\\.cir$" 'spice-mode)
58 ;; (cons "\\.ckt$" 'spice-mode)
59 ;; (cons "\\.mod$" 'spice-mode)
60 ;; (cons "\\.cdl$" 'spice-mode)
61 ;; (cons "\\.chi$" 'spice-mode) ;eldo outpt
62 ;; (cons "\\.inp$" 'spice-mode))
65 ;; Other way to load spice mode (by Andrew Scott):
66 ;; ;;; Testing for spice-mode (Another spice mode, also works on Spice,
67 ;; ;;; Eldo, Layla; this one works on GNU Emacs-20.6 issues).
68 ;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
69 ;; (add-to-list 'auto-mode-alist '("\\.cir$" . spice-mode))
70 ;; (add-to-list 'auto-mode-alist '("\\.ckt$" . spice-mode))
71 ;; (add-to-list 'auto-mode-alist '("\\.inp$" . spice-mode))
72 ;; (add-to-list 'auto-mode-alist '("\\.spout$" . spice-mode));hspice out
73 ;; (add-to-list 'auto-mode-alist '("\\.pdir$" . spice-mode))
75 ;; (add-to-list 'auto-mode-alist '("\\.[sS][pP]$" . spice-mode))
76 ;; (add-to-list 'auto-mode-alist '("\\.[sm]?t0$" . spice-mode))
77 ;; (add-to-list 'auto-mode-alist '("\\.[h]?spice$" . spice-mode))
82 ;; use customization to modify the behaviour of spice-mode; add
83 ;; custom-set-variables to your `.emacs' file, for example:
84 ;; (custom-set-variables
85 ;; ; '(spice-initialize-file-function (quote geert-spice-file-header)) ;; use geert-spice-file-header function (not included in this file !)
86 ;; '(spice-initialize-empty-file t) ;; initialize empty/new spice file
87 ;; ; '(spice-standard '(spice2g6 (hspice eldo eldorf eldovloga layla))) ;; all 4 modes
88 ;; '(spice-standard (quote (spice2g6 (hspice eldo)))) ;; hspice and eldo
89 ;; '(spice-standard (quote (spice2g6 ()))) ;; spice2g6/3 only
90 ;; '(spice-simulator "Spice3") ;; default simulator
91 ;; '(spice-waveform-viewer "Nutmeg") ;; default waveform
92 ;; '(spice-highlight-keywords nil) ;; less highlighting
93 ;; '(spice-section-alist ;; add own sections
94 ;; ;; this is ugly, I know ;)
95 ;; (append (nth 1 (nth 0 (get 'spice-section-alist 'standard-value)))
97 ;; (list "My Header" "MY HEADER" nil)
99 ;; '(spice-show-describe-mode nil) ;; don't describe mode at startup
102 ;; This can also be achieved interactively through customizations !
104 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
108 ;; The original spice-mode.el created by C. Vieri has been modified
109 ;; extensively. These changes have been heavily influenced by the eldo-mode.el
110 ;; of Emmanuel Rouat (the tempo-templates for one) and the vhdl-mode.el of
111 ;; Reto Zimmermann and Rodney J. Whitby (the font-locking, the
112 ;; customization, the menus, ...) Help in understanding 'advanced' Lisp
113 ;; was provided by G. Debyser <geert.debyser@advalvas.be>, our (Common) Lisp
114 ;; expert. Since version 0.97 a lot of input/ideas have been provided by
115 ;; Emmanuel Rouat. Just take a look and search for eldo-mode ;)
117 ;; This package provides an Emacs major mode for editing SPICE decks.
119 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
123 ;; - customization group spice- needs to be improved
124 ;; activate customizations needs to be looked at (potentially removed)
125 ;; - fix problem imenu sometimes truncating filenames of include files
126 ;; by replacing the functionality with own function
127 ;; - improve Y instance handling. use builtin macromodels, and own development;; models
130 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134 ;; - searching for .subckt could be buggy because of user's file structure
135 ;; - xinstance highlighting is buggy, and probably always will ?
136 ;; - font-lock expressions are incredibly complicated, and multiple spice
137 ;; formats are not handled correctly at the same time...
139 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
141 ;; If you have any questions about this mode, feel free to contact me
142 ;; at the following address: geert_vanderplas@email.com. If I find the
143 ;; time, I can take a look at the problem
145 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
148 (defconst spice-version
"1.2.25 (03 Jan 2007)"
149 "Current version of spice mode (spice2g6/spice3/hspice/eldo(rf&verilog-a)/fasthenry/layla/mondriaan/draccdl/spectre).")
151 (defconst spice-developer
152 "Geert Van der Plas & Emmanuel Rouat (<geert_vanderplas@email.com>, <emmanuel.rouat@wanadoo.fr>)"
153 "Current developers/maintainers of spice-mode.")
155 (defvar spice-tempo-tags nil
156 "List of templates used in spice mode.")
160 (defun spice-custom-set (variable value
&rest functions
)
161 "Set VARIABLE as VALUE in `custom-set-default' and call FUNCTIONS (if bound) afterwards."
162 (if (fboundp 'custom-set-default
)
163 (custom-set-default variable value
)
164 (set-default variable value
))
166 (when (fboundp (car functions
)) (funcall (car functions
)))
167 (setq functions
(cdr functions
))))
171 "Customizations for Spice mode."
173 :link
'(url-link "http://spice-mode.4t.com/")
179 (defcustom spice-mode-hook nil
180 "*List of hook functions run by `spice-mode' (see `run-hooks')."
186 (defcustom spice-standard
'(spice2g6 (hspice eldo eldorf eldovloga fasthenry
))
187 "Spice standards used.
190 Spice2g6 : Original Berkeley Spice (leave this always on!)
191 Additional standards:
192 Hspice (TM) : Commercial Spice, formerly Meta Software, now owned by Synopsys
193 Eldo (TM) : Commercial Spice, formerly Anacad, now owned by Mentor Graphics
194 EldoRf (TM) : RF Steady State analyses of Eldo (also turn on Eldo!)
195 EldoVlogA : Verilog-A extensions to Eldo netlist language (also turn on Eldo!)
196 FastHenry : Multipole-accelerated inductance analysis program from MIT
197 Layla : KULeuven LAYLA (layout synthesis) extensions to Spice format
198 Mondriaan : KULeuven MONDRIAAN (layout synthesis) extensions (also turn on Layla!)
199 DracCDL (TM): Dracula CDL extensions (Cadence LOGLVS netlists)
200 Spectre (TM): Spice compatibility of Spectre language (simulator language=spice decks)."
201 :type
'(list (choice :tag
"Basic standard"
202 (const :tag
"Spice2g6" spice2g6
))
203 (set :tag
"Additional standards" :indent
2
204 (const :tag
"Hspice" hspice
)
205 (const :tag
"Eldo" eldo
)
206 (const :tag
"Eldo RF" eldorf
)
207 (const :tag
"Eldo Verilog-A" eldovloga
)
208 (const :tag
"FastHenry" fasthenry
)
209 (const :tag
"Layla" layla
)
210 (const :tag
"Mondriaan" mondriaan
)
211 (const :tag
"DracCDL" draccdl
)
212 (const :tag
"Spectre Spice Compatibility" spectre
)))
213 :set
(lambda (variable value
)
214 (spice-custom-set variable value
215 'spice-check-spice-standard
216 'spice-mode-syntax-table-init
218 'spice-font-lock-init
220 'spice-update-existing-buffers
))
225 (defcustom spice-imenu-add-to-menubar t
226 "Spice mode adds imenu (Index) item to menubar."
228 :set
(lambda (variable value
)
229 (spice-custom-set variable value
230 'spice-update-existing-buffers
))
234 (defcustom spice-show-describe-mode nil
; was t
235 "Spice mode runs `describe-mode' once at start of spice-mode."
240 (defcustom spice-echo-intro t
241 "Spice mode echos introductory message on entry to spice-mode."
245 (defgroup spice-initialize-file nil
246 "Customizations for initialization of empty/new spice files."
250 (defcustom spice-initialize-empty-file nil
251 "Spice initialize empty/new file setting."
252 :group
'spice-initialize-file
256 (defcustom spice-initialize-template-file
"~/.spice-default"
257 "File containing the default header in new empty file.
258 See also `spice-initialize-empty-file'."
259 :group
'spice-initialize-file
263 (defcustom spice-default-header nil
264 "Default header for new Spice netlists, see also `spice-initialize-empty-file'."
265 :group
'spice-initialize-file
269 (defcustom spice-initialize-file-function
'spice-initialize-empty-file
270 "Optional initialize function for empty/new files,
272 See also `spice-initialize-empty-file'.
274 If a different function is specified it should insert a default
275 header/template in the current buffer. This function should check
276 which submode is in use with `spice-standard-p' and adapt its
277 output accordingly. It may also use the `spice-default-header'
278 variable and insert its contents into the buffer."
279 :group
'spice-initialize-file
282 (defgroup spice-simulate nil
283 "Customizations for simulation."
287 (defcustom spice-simulator-alist
289 ;; Spice3; spice3 -b <file.cir>
291 ("Spice3" "spice3 -b" ""
292 ("\\s-*Error[\t ]+on[ \t]+line[\t ]+\\([0-9]+\\) +:.+"
293 0 1 nil
(buffer-file-name))
294 ("Circuit: \\(.*\\)$" 1)) ; spice3 hack, is not the filename, but that's no prob
295 ;; Hspice; hspice <file.cir>
296 ;; **error**: only 1 connection at node 0:2
297 ("Hspice" "hspice" ""
298 ("\\s-*\\(..?error..?[: ]\\).+" 0 spice-linenum
1 (buffer-file-name))
299 ("[* ]* [iI]nput [fF]ile: +\\([^ \t]+\\).*$" 1))
300 ;; Eldo; eldo -i <file.cir>
301 ;; ERROR 503: MODEL "NMOS": Undeclared model reference.
303 ("\\s-*\\(E[rR][rR][oO][rR] +[0-9]+:\\).*"
304 0 spice-linenum
1 (buffer-file-name))
305 ("Running \\(eldo\\).*$" 1)) ; eldo hack, true filename can not be found
306 ;; Spectre; spectre <file.cir>
307 ;; "viblok2.cir" 7: Unknown dot word `.param'.
308 ("Spectre" "spectre" ""
309 ("\\s-*\"\\([^ \t\n]+\\)\" +\\([0-9]+\\):.*"
311 ("" 0)) ; filename is in regexp of error
312 ;;; Add your local simulators here:
315 "*List of available Spice simulators and their properties.
316 Each list entry specifies the following items for a simulator:
318 Simulator Name : name used in variable `spice-simulator' to choose
320 Simulate Command : command including options used for simulation program
321 Extra switches : extra switches for simulator, after filename
323 Regexp : regular expression to match error messages
324 File Subexp Index: index of subexpression that matches the file name
325 Line Subexp Index: index of subexpression that matches the line number.
326 use function `spice-linenum' when the line number
328 Col Subexp Index : index of subexpression that matches the column number
329 if not available but `spice-linenum' has been
330 supplied in the previous field, use 1
332 Regexp : regular expression to match a file name message
333 File Subexp Index: index of subexpression that matches the file name
335 See also variable `spice-simulator-switches' to add options to the
338 Most simulators do not include the file name in the error message, but print
339 out a file name message in advance. In this case, set \"File Subexp Index\"
340 to 0 and fill out the \"File Message\" entries."
341 :type
'(repeat (list :tag
"Simulator" :indent
2
342 (string :tag
"Simulator Name ")
343 (string :tag
"Simulate Command ")
344 ;(string :tag "From Directory " "./")
345 (string :tag
"Extra Switches ")
346 (list :tag
"Error Message" :indent
4
347 (regexp :tag
"Regexp ")
348 (integer :tag
"File Subexp Index")
349 (integer :tag
"Line Subexp Index"))
350 (list :tag
"File Message" :indent
4
351 (regexp :tag
"Regexp ")
352 (integer :tag
"File Subexp Index"))))
353 :set
(lambda (variable value
)
354 (spice-custom-set variable value
356 'spice-compile-variables-init
357 'spice-update-existing-buffers
))
358 :group
'spice-simulate
)
362 (defcustom spice-simulator nil
; example: "Hspice"
363 "Spice command, used when compiling buffer with `compile-mode', see also `spice-simulator-switches'."
364 :group
'spice-simulate
369 (defcustom spice-simulator-switches
"" ; example "-noconf"
370 "Spice command switches, used when compiling buffer with `compile-mode', see also `spice-simulator'."
371 :group
'spice-simulate
375 (defcustom spice-waveform-viewer-alist
377 ;; Nutmeg; nutmeg <waveformdata.dat>
379 ("Nutmeg" "nutmeg" "" spice-run-interactive
(".dat" ".ac0" ".tr0")) ; spice3 nutmeg viewer
380 ("Gwave" "gwave" "" spice-run-silent
381 (".raw" ".braw" ".ac0" ".tr0" ".sw0" ".W" ".N" ".acs")) ; gwave viewer
382 ("Xelga" "xelga" "" spice-run-silent
".cou") ; xelga eldo viewer
383 ("Awaves" "awaves_emacs" "" spice-run-silent
(".ac0" ".tr0")) ; awaves hspice viewer, this doesn't work yet and will it ever ? Explanation: awaves is a script that starts an executable/binary in the background. This means the shell starting awaves ends immediately after the forking of the executable; after which all backgrounded programs get killed by emacs since their parent's parent shell (/bin/sh) ends. awaves shouldn't return immediately and then this will work; that's why I called the program awaves_emacs...
385 ;; ("Awaves2" "echo_awaves" "" spice-run-silent nil) ; awaves hspice viewer
386 ;;; Add your local waveform viewers here:
389 "*List of available Waveform viewers and their properties.
390 Each list entry specifies the following items for a waveform viewer:
392 Wave Viewer Name : name used in variable `spice-waveform-viewer' to choose
394 Wave Viewer Command : command including options used for waveform viewer
395 Extra switches : extra switches for waveform viewer, after filename
397 See also variable `spice-waveform-viewer-switches' to add options to the
398 waveform viewer command."
399 :type
'(repeat (list :tag
"Waveform Viewer" :indent
2
400 (string :tag
"Waveform Viewer Name ")
401 (string :tag
"Waveform Viewing Command ")
402 (string :tag
"Extra Switches ")
404 :value spice-run-silent
405 (function-item spice-run-silent
)
406 (function-item spice-run-interactive
)
407 (function :tag
"Other"))
408 (choice (string :tag
"Filename Suffix ")
409 (function :tag
"Function Deriving Filename")
410 (repeat (list :tag
"List of Filename Suffixes")))))
411 :set
(lambda (variable value
)
412 (spice-custom-set variable value
414 'spice-update-existing-buffers
))
415 :group
'spice-simulate
)
419 (defcustom spice-waveform-viewer nil
; example: "Nutmeg"
420 "Spice command, used when starting waveform viewer, see also `spice-waveform-viewer-switches'."
421 :group
'spice-simulate
426 (defcustom spice-waveform-viewer-switches
"" ; example "-b"
427 "Spice waveform viewer command switches, see also `spice-waveform-viewer'."
428 :group
'spice-simulate
432 (defgroup spice-commands nil
433 "Customizations for commands."
437 (defcustom spice-shell
438 (if (memq system-type
'(ms-dos emx windows-nt
))
441 "*Name of shell used to parse spice commands."
442 :group
'spice-commands
446 (defcustom spice-shell-command-option
447 (cond ((memq system-type
'(ms-dos emx windows-nt
) )
448 (cond ((boundp 'shell-command-option
)
449 shell-command-option
)
450 ((boundp 'shell-command-switch
)
451 shell-command-switch
)
454 (t ;Unix & EMX (Emacs 19 port to OS/2)
456 "*Shell argument indicating that next argument is the command."
457 :group
'spice-commands
461 (defgroup spice-hide nil
462 "Customizations for hiding of comments."
466 (defcustom spice-hide-line-prefix
467 (if (featurep 'newcomment
)
470 (concat comment-start
471 (if (boundp 'comment-padding
)
472 (if (integerp comment-padding
)
473 (make-string comment-padding ?
)
476 "[a-z\\*!$0-9+\\.]"))
477 "Regexp string describing lines that are commented out and will be hidden.
479 The regexp is matched to the beginning of a line, the ^ is added
480 automatically. The initialization of this variable is handled in
481 `spice-hide-init', which is after the setting of `comment-start'
482 and `comment-padding' variables."
487 (defcustom spice-auto-hide-comments nil
488 "*Boolean indicating automatic hiding of all commented regions at load time."
493 (defgroup spice-section nil
494 "Customizations for sections."
497 ;; sections (entirely different implementation but sections idea has
498 ;; been taken from eldo-mode.el)
500 (defcustom spice-section-alist
503 ("Libraries" "LIBRARIES" nil
) ;
505 ("Netlist" "NETLIST" nil
) ;
507 ("Main Circuit" "MAIN CIRCUIT" nil
) ;
509 ("Options" "SIMULATION OPTIONS" nil
) ;
511 ("Supplies" "SUPPLIES/REFERENCES" nil
) ;
513 ("Input Signals" "INPUT SIGNALS" nil
) ;
515 ("DC Analysis" "DC ANALYSIS" nil
) ;
517 ("AC Analysis" "AC ANALYSIS" nil
) ;
518 ;; Transient Analysis
519 ("Transient Analysis" "TRANSIENT ANALYSIS" nil
) ;
520 ;;; Add your site-local spice sections here:
523 "*List of valid sections in a Spice file and their options.
524 Each list entry specifies the following items for a section:
526 Section Name : name used in to select/create find section, make this
527 name short and descriptive.
528 Section String : string used in file to start section (usually all
529 uppercase variant of name).
530 Extra switches : extra switches for a section, unspecified for now."
531 :type
'(repeat (list :tag
"Section" :indent
2
532 (string :tag
"Section Name ")
533 (string :tag
"Section String ")
534 (sexp :tag
"Extra Switches (nil)")))
535 :set
(lambda (variable value
)
536 (spice-custom-set variable value
538 'spice-font-lock-init
541 'spice-update-existing-buffers
))
542 :group
'spice-section
)
545 (defgroup spice-faces nil
546 "Customizations for highlighting."
550 (defcustom spice-highlight-keywords t
551 "*Non-nil means highlight SPICE keywords and other standardized words.
552 The following faces are used:
553 `spice-title-face' : title (first line in a spice file)
554 `spice-doc-face' : doc strings
555 `spice-analysis-face' : analyses
556 `spice-instance-name-face' : instance/element names
557 `spice-model-name-face' : subckt model names
558 `spice-layla-function-name-face': layla function names
559 `spice-include-file-face' : include files and libraries
560 `font-lock-keyword-face' : keywords
561 `font-lock-warning-face' : warnings
562 `font-lock-comment-face' : comment
563 `font-lock-function-name-face': subcircuit references / names of objects
564 `font-lock-type-face' : types
565 `font-lock-string-face' : strings & include files
566 `font-lock-constant-face' : simulator's options
567 `font-lock-variable-name-face': names of .param's & variables
568 NOTE: Activate the new setting in a spice buffer by re-fontifying it (menu
569 entry \"Fontify Buffer\")."
573 ;; We try to use usual/standard font-lock faces, plus a few specific ones:
575 'spice-faces
'font-lock-comment-face
'custom-face
)
577 'spice-faces
'font-lock-keyword-face
'custom-face
)
579 'spice-faces
'font-lock-type-face
'custom-face
)
581 'spice-faces
'font-lock-function-name-face
'custom-face
)
583 'spice-faces
'font-lock-variable-name-face
'custom-face
)
585 'spice-faces
'font-lock-warning-face
'custom-face
)
587 'spice-faces
'font-lock-string-face
'custom-face
)
590 (defgroup spice-output nil
591 "Customizations for spice output file handling."
595 (defcustom spice-output-filename-alist
598 (eldo (concat (file-name-sans-extension (buffer-file-name)) ".chi")) ;
599 (hspice (concat (file-name-sans-extension (buffer-file-name)) ".lis")) ;
600 (hspice (concat (file-name-sans-extension (buffer-file-name)) ".spout")) ;
601 (hspice (concat (file-name-sans-extension (buffer-file-name)) ".hspout")) ;
602 (spice2g6 (concat (file-name-sans-extension (buffer-file-name)) ".out")) ;
604 "List of valid output names depending on selected spice standard.
606 Spice Standard : one of spice2g6, hspice, eldo or layla
607 Expression : expression calculating the output filename."
608 :type
'(repeat (list :tag
"Output Filenames" :indent
2
609 (symbol :tag
"Spice Standard ")
610 (sexp :tag
"Expression ")))
611 :group
'spice-output
)
614 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
615 ;; buffer local vars for spice-mode
617 ;;(defvar spice-standard-local nil
618 ;; "buffer local version of spice-standard.")
620 (defvar spice-output-local nil
621 "Buffer local version of spice-output.")
623 (defun spice-standard-p (standard)
624 "Check if STANDARD is specified as used standard on local variable."
625 (or (eq standard
(car spice-standard
))
626 (memq standard
(cadr spice-standard
))))
629 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
630 ;; regexps for spice mode
632 (defconst spice-continuation-prefix
"+"
633 "Continuation prefix for normal spice line.")
635 (defconst spice-line-break
"\\(\n\\s-*\\+\\s-*\\)*"
636 "Regexp that matches a (possible) line break (\n+).")
638 (defconst spice-model-name
"\\([a-z][^ \t\n=]*\\)" ; "\\([a-z]\\sw*[^ \t\n=]*\\)"
639 "Regexp that describes a syntactically correct model or subckt name.")
641 (defconst spice-library-regexp-start
642 "^\\.\\(inc\\|include\\|verilog\\|use_veriloga\\|lib\\(\\s-+key=\\w+\\)?\\|libfas\\|subckt\\s-+lib\\|model\\s-+lib\\)\\s-+[\"']?"
643 "Regexp that matches the beginning of library or include filename.")
645 (defconst spice-library-regexp-end
647 "Regexp that matches the end of library or include filename.") ; doesn't catch end of buffer
649 (defconst spice-section-regexp-start
"\\(^[*!$]\\s-*\\)"
650 "Spice mode section header start regexp.")
652 (defconst spice-spice2g6-keywords
656 "opt" ; opt is actually a spice3 keyword, not 2g6
658 "model" "macro" "include" ; include is actually a spice3 keyword, not 2g6
661 "List of Spice2g6 keywords.")
663 (defconst spice-spice2g6-analyses
665 "tran" "op" "noise" "four" "disto" "dc" "ac"
667 "List of Spice2g6 analysis keywords.")
669 (defconst spice-spice2g6-analysis-modifiers
671 "dec" "lin" "oct" ;; the ubiquitous spice2g6 ac modifiers
672 "pol" "zer" "pz" "cur" "vol" ;; pz analysis spice3
673 "ac" ;; .sens analysis spice3
675 "List of Spice2g6 analysis modifier keywords.")
677 (defconst spice-eldo-keywords
679 "width" "use" "unprotect" "tvinclude" "topcell"
680 "table" "subdup" "solve" "sinus" "sigbus"
681 "setsoa" "setbus" "save" "restart" "ramp"
682 "protect" "probe" "plotbus"
683 "param" "overwrite_input" "optwind" "optpwl" "optnoise" "options"
685 "notrc" "nocom" "modlogic"
686 "moddup" "meas" "mcmod" "lotgroup" "loop" "load"
687 "libfas" "lib" "init" "include" "ic" "hier" "guess" "global"
688 "extract" "endl" "enddata" "dspf_include" "distrib" "del"
689 "defwave" "defplotdig" "defmac" "data" "d2a" "comchar" "conso" "connect"
690 "chrsim" "chrent" "chrand" "checksoa" "checkbus" "alter" "addlib" "a2d"
692 "List of Eldo keywords.")
694 (defconst spice-eldo-colon-keywords
696 "param" "pin" "model"
698 "List of Eldo colon keywords.")
700 (defconst spice-eldo-macromodel-keywords
702 "opamp0" "opamp0d" "opamp1" "opamp1d" "opamp2" "opamp2d"
703 "satr" "satv" "vswitch" "cswitch"
704 "tri2sin" "stairgen" "sawgen" "trigen"
711 "add" "sub" "mult" "div"
712 "sc_ideal" "sc_i" "sc_n" "sc_p" "sc_s1" "sc_s2"
713 "sc_sp1" "sc_sp2" "sc_b" "sc_u"
715 "List of Eldo macromodels.")
717 (defconst spice-eldo-analyses
720 "step" "snf" "sens" "pz"
723 "List of Eldo analysis keywords.")
725 (defconst spice-eldo-analysis-modifiers
728 "List of Eldo analysis modifier keywords.")
730 (defconst spice-eldorf-keywords
734 "List of Eldo RF keywords.")
736 (defconst spice-eldovloga-keywords
738 "verilog" "use_veriloga"
740 "List of Eldo Verilog-A keywords.")
742 (defconst spice-eldovloga-colon-keywords
746 "List of Eldo Verilog-A colon keywords.")
748 (defconst spice-eldorf-analyses
750 "sstac" "sstxf" "sstnoise"
752 "List of Eldo RF keywords.")
754 (defconst spice-hspice-keywords
756 "width" "unprot" "unprotect" "uic"
757 "title" "sys" "system" "save"
758 "sample" "prot" "protect"
759 "probe" "pc" "parameter"
760 "param" "options" "option"
762 "measure" "meas" "macro"
763 "load" "lib" "include" "inc" "ic" "graph" "global"
764 "eom" "enddata" "dellib" "delete"
765 "del" "dcvolt" "data" "control" "comment"
767 "fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
769 "List of Hspice keywords.")
771 (defconst spice-hspice-analyses
776 "net" ;; S, Z, Y and H parameters
782 "List of Hspice analysis keywords.")
784 (defconst spice-hspice-analysis-modifiers
788 "List of Hspice analysis modifier keywords.")
790 (defconst spice-fasthenry-keywords
792 "units" "default" "external" "equiv"
794 "List of FastHenry keywords.")
796 (defconst spice-fasthenry-analyses
800 "List of FastHenry analysis keywords.")
802 (defconst spice-fasthenry-analysis-modifiers
805 "List of FastHenry analysis modifier keywords.")
807 (defconst spice-layla-keywords
810 "port" "performance" "parameter"
811 "param" "options" "option"
817 "List of Layla keywords.")
819 (defconst spice-mondriaan-keywords
821 "master" "routingarea" "routingchannel" "ports" "portgrid" "net"
823 "List of Mondriaan keywords.")
825 (defconst spice-draccdl-keywords
827 "bipolar" "busdelimiter" "capa" "caparea" "capval" "default" "dioarea"
828 "dioperi" "diode" "edifdelimiter" "busdelimiter" "equation" "equiv"
829 "gnonswap" "ldd" "mega" "nonswap" "nopin" "nosub" "pin" "pininfo"
830 "resi" "ressize" "resval" "reverse" "scale" "spice" "unspec"
831 "eom" "global" "param" "macro" "swap"
833 "List of Dracula CDL keywords.")
835 (defconst spice-spice2g6-types
837 "ac" "dc" "exp" "pulse" "pwl" "sffm" "sin"
839 "List of types in spice2g6.")
841 (defconst spice-hspice-types
843 "metal" "dielectric" "pec" "rectangle" "circle" "strip" "polygon" ;; ""
845 "List of types in hspice.")
847 (defconst spice-eldo-types
851 "List of source types in eldo.")
853 (defconst spice-eldorf-types
855 "fpulse" "four" "probe"
857 "List of source types in eldorf.")
859 (defconst spice-fasthenry-types
861 "point" "rect" "circle"
862 "user1" "user2" "user3" "user4" "user5" "user6" "user7"
864 "List of source types in fasthenry.")
866 (defconst spice-special-model-type-names
868 "d" "npn" "pnp" "nmos" "pmos"
870 "List of model type names which are excluded for imenu.")
872 (defconst spice-spice2g6-model-type-names
879 "List of model type names in spice2g6.")
881 (defconst spice-eldo-model-type-names
886 "List of model type names extra in eldo.")
888 (defconst spice-eldo-vloga-model-type-names
892 "List of model type names extra in Eldo Verilog-A.")
894 (defconst spice-hspice-model-type-names
896 "l" "core" "w" "plot"
898 "List of model type names extra in hspice.")
900 (defconst spice-spice2g6-output-keywords
902 "List of output keywords in spice2g6.")
904 (defconst spice-spice2g6-output-types
906 "List of output types in spice2g6.")
908 (defconst spice-eldo-output-keywords
910 "List of output keywords in eldo.")
912 (defconst spice-eldo-output-types
913 '("dcac" "dcsweep" "dctran" "noise" "four" "sweep")
914 "List of output types in eldo.")
916 (defconst spice-eldorf-output-types
917 '("fsst" "tsst" "sstac" "sstxf" "ssnoise" )
918 "List of output types in eldo.")
920 (defconst spice-hspice-output-keywords
921 '("probe" "graph" "measure")
922 "List of output keywords in hspice.")
924 (defconst spice-hspice-output-types
926 "List of output types in hspice.")
928 (defconst spice-spice2g6-options-keywords
930 "List of spice2g6/3 options keywords.")
932 (defconst spice-eldo-options-keywords
933 '("wsf" "wsfascii" "sda"
934 "precise" "spi3asc" "spi3bin" "spicedc" "spiout" "libfas" "nolib"
935 "ammeter" "msgbias" "nowarn" "ulogic" "aspec" "mod4pins" "modwl" "wl"
936 "captab" "coustep" "input" "lcapop" "list" "noascii" "ascii"
937 "autostop" "nobound_phase" "nocou" "node" "nomod" "nopage" "nosizechk"
938 "notrc" "trap" "smooth" "be" "gear" "newton" "iem" "analog" "digital"
939 "osr" "mixed" "pstran" "dptran" "itl6" "itl7" "itl8" "nmaxsize"
940 "noconvassist" "nolat" "pivrel" "pivtol" "qtrunc" "noconvassist"
941 "nolat" "pivrel" "pivtol" "qtrunc" "relvar" "splitc" "noswitch"
942 "unbound" "randmc" "usedefap" "engnot" "nodcpart" "probeop"
943 "noprobeop" "histlim" "wbulk" "noinit" "nonoise" "tempcouk" "nofnsiem"
944 "icdc" "icdev" "carlo_gauss" "cteprec" "d2dmvl9bit" "defconvmsg"
945 "maxnodeord" "notrclib" "motorola" "aex")
946 "List of eldo options keywords.")
948 (defconst spice-eldorf-options-keywords
950 "List of Eldo RF options keywords.")
952 (defconst spice-hspice-options-keywords
954 "absh" "acout" "cds" "scale" "cshdc" "alt999" "alt9999" "csdf"
955 "accurate" "dvdt" "measout" "acout" "brief" "cshunt" "gshunt" "probe"
956 "kcltest" "dctran" "di" "itl5" "list" "sda" "gshunt" "cshunt" "post"
957 "node" "noelck" "gshunt" "maxamp" "nomod" "aspec" "icsweep" "relh"
958 "nopage" "newtol" "reli" "notop" "parhier" "off" "spice" "wl"
959 "dvtr" "nxx" "seed" "risetime" "imax" "nopiv" "imin" "opts" "cscal"
960 "vntol" "absv" "pathnum" "badchr" "fmax" "plim" "diagnostic" "pivref"
961 "fscal" "autostop" "nowarn" "gscal" "search" "lscal" "bypass" "verify"
962 "sparse" "pivot" "pzabs" "cpu" "pztol" "fast" "interp" "h9007" "expli"
963 "ritol" "itlpz" "itrprt" "unwrap" "captab" "newtol" "dccap")
964 "List of hspice options keywords.")
966 (defconst spice-spice2g6-options-parameters
967 '("gmin" "reltol" "abstol" "vntol" "trtol" "chgtol" "pivtol" "pivrel"
968 "tnom" "temp" "lvlcod" "itl1" "itl2" "itl3" "itl4" "itl5" "defl"
969 "defw" "defad" "defas" "method")
970 "List of spice2g6/3 options parameters.")
972 (defconst spice-eldo-options-parameters
973 '("cptime" "msgnode" "zoomtime" "bsim3ver" "defnrd" "defnrs" "defpd" "defps"
974 "gramp" "scale" "scalebsim" "scalm" "soiback" "flicker_noise"
975 "thermal_noise" "cousmp" "limprobe" "ascii" "savetime" "simudiv"
976 "stat" "timediv" "maxord" "bloc" "epsdig" "absvar" "capanw" "chgtol"
977 "dvdt" "eps" "fluxtol" "freqsmp" "ft" "hmin" "hmax" "itol" "lvltim"
978 "maxnodes" "maxtran" "maxv" "netsize" "ngtol" "ratprint" "reltrunc"
979 "sample" "startsmp" "step" "trtol" "tuning" "vmin" "vntol" "xa"
980 "numdgt" "dcpart" "couresol" "defa2d" "defd2a" "vbcsat" "dclog" "epso"
982 "List of eldo options parameters.")
984 (defconst spice-eldorf-options-parameters
985 '("sst_start" "sst_stop" "sst_nper"
986 "sst_npt" "sst_ovrsmp" "sst_spectrum" "sst_uic"
987 "sst_max_liniter" "sst_verbose")
988 "List of Eldo RF options parameters.")
990 (defconst spice-hspice-options-parameters
991 '("artist" "dcap" "absh" "absvar" "absi" "absv" "delmax" "absmos"
992 "dcfor" "dchold" "fs" "mentor" "absvdc" "dcon" "ft" "co" "reltol" ; "post"
993 "cvtol" "di" "dcstep" "imin" "ingold" "imax" "lennam" "psf" "maxamp"
994 "dv" "defl" "relh" "gmax" "relvar" "measdgt" "zuken" "defnrd" "reli"
995 "gmindc" "rmax" "defnrs" "relmos" "gramp" "rmin" "defpd" "relv"
996 "slopetol" "defps" "relvdc" "timeres" "limpts" "scalm" "relq" "numdgt"
997 "resmin" "optlst" "trtol" "genk" "pivot" "sparse" "lvltim" "klim"
998 "maxord" "post_version" "bkpsiz" "mu" "xmu" "warnlimit" "expli"
999 "bytol" "cptime" "epsmin" "mbypass" "expmax" "limtim" "vfloor")
1000 "List of hspice options parameters.")
1002 (defconst spice-layla-options-parameters
1003 '("begin_temp_iterations" "begin_acc_prob" "min_temp_scale_factor"
1004 "max_temp_scale_factor" "max_inner_loop_delta" "max_cost_delta"
1005 "min_range_scale_factor" "nr_temp_steps"
1006 "min_stable_inner_loops" "min_local_iterations" "max_local_iterations"
1007 "max_iterations" "bank_min_ar" "bank_max_ar" "bank_orientations"
1008 "bank_routing_space" "bus_sides" "bus_layer" "bus_port_width"
1009 "bus_port_height" "bus_port_distance" "bus_routing_space" "cap_min_ar"
1010 "cap_max_ar" "cap_orientations" "cap_routing_space" "cap_ar_step"
1011 "coil_orientations" "coil_routing_space" "alfa_area"
1012 "alfa_performance" "alfa_aspect_ratio" "alfa_overlap" "alfa_overlap_min"
1013 "alfa_overlap_max" "kappa_overlap" "device_min_ar" "device_max_ar"
1014 "device_orientations" "device_routing_space" "device_current"
1015 "diode_min_ar" "diode_max_ar" "diode_orientations"
1016 "diode_routing_space" "diode_current" "matching_compute_method"
1017 "dummy_min_ar" "dummy_max_ar" "dummy_orientations"
1018 "dummy_routing_space" "dummy_ar_step"
1019 "mos_min_ar" "mos_max_ar" "mos_orientations" "mos_routing_space"
1020 "mos_current" "prob_reshape" "prob_reorientation"
1021 "prob_symmetric_translation" "prob_symmetric_swap"
1022 "prob_symmetric_flip" "prob_symmetric_flip" "prob_symmetric_shift"
1023 "prob_independent_translation" "prob_independent_swap"
1024 "prob_independent_flip" "min_move_range" "net_compute_method"
1025 "write_init" "write_int" "int_write_interval" "write_fin" "write_final"
1026 "mentor_write_ipc" "gds2_write_ipc" "construct_net_performance"
1027 "construct_matching_performance" "aspect_ratio" "field_grow_factor"
1028 "field_aspect_ratio" "disable_symmetry" "disable_matching"
1029 "do_kul_routing" "kul_router_program" "kul_router_directives_file"
1030 "number_of_randomize_loops" "port_inherit_terminals" "bus_priority"
1031 "port_sides" "port_layer" "port_width" "port_height" "port_distance"
1032 "port_abutment" "port_routing_space" "port_no_routing" "port_current"
1033 "res_ar_step" "res_min_ar" "res_max_ar" "res_orientations"
1034 "res_routing_space" "res_width" "res_current" "disable_couple_flipping"
1035 "symmetry_max_offset_factor" "print_cost" "placement_name"
1036 "write_final_ample" "write_final_skill" "write_final_gds2_bin"
1037 "write_final_gds2_cells" "write_final_tud"
1038 "write_final_ample_generators" "write_final_ample_cells"
1039 "write_final_cif" "write_final_rose" "write_final_kul"
1041 "write_int_ample" "write_int_skill" "write_int_gds2_bin"
1042 "write_int_gds2_cells" "write_int_tud" "write_int_ample_generators"
1043 "write_int_ample_cells" "write_int_cif" "write_int_rose"
1044 "write_int_kul" "write_int_text"
1045 "write_init_ample" "write_init_skill" "write_init_gds2_bin"
1046 "write_init_gds2_cells" "write_init_tud" "write_init_ample_generators"
1047 "write_init_ample_cells" "write_init_cif" "write_init_rose"
1048 "write_init_kul" "write_init_text" "time_out"
1049 "random_seed" "anneal_rs" )
1050 "List of LAYLA options parameters.")
1052 (defconst spice-layla-functions
1054 "bus_double_param" "bus_integer_param" "bus_string_param"
1055 "device_double_param" "device_integer_param" "device_string_param"
1056 "net_double_param" "net_integer_param" "net_string_param"
1057 "placement_double_param" "placement_integer_param" "placement_string_param"
1058 "port_double_param" "port_integer_param" "port_string_param"
1059 "symmetry_double_param" "symmetry_integer_param" "symmetry_string_param"
1061 "List of functions in Layla mode.")
1063 (defconst spice-draccdl-device-keywords
1065 "List of Dracula CDL device keywords.")
1067 (defconst spice-draccdl-device-parameters
1068 '("w" "l" "sub" "ea" ;; CDL parameters
1069 "x" "y") ;; added X&Y, dracula extracts them (not CDL!)
1070 "List of Dracula & CDL device parameters.")
1072 (defconst spice-spice2g6-entity-start-keywords
1074 "ends" "macro" "subckt"
1076 "List of spice2g6 entity start keywords.")
1078 (defconst spice-eldo-entity-start-keywords
1082 "List of eldo entity start keywords.")
1084 (defconst spice-hspice-entity-start-keywords
1087 "fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
1089 "List of hspice entity start keywords.")
1091 (defconst spice-layla-entity-start-keywords
1093 "bus" "net" "symmetry" "performance" "port"
1095 "List of layla entity start keywords.")
1097 (defconst spice-mondriaan-entity-start-keywords
1099 "routingarea" "routingchannel" ;; "net" ; already in layla
1101 "List of mondriaan entity start keywords.")
1103 (defconst spice-draccdl-entity-start-keywords
1107 "List of DracCDL entity start keywords.")
1109 (defvar spice-keywords nil
1110 "List of spice mode keywords.")
1112 (defvar spice-colon-keywords nil
1113 "List of spice mode colon keywords.")
1115 (defvar spice-analyses nil
1116 "List of spice mode analyses.")
1118 (defvar spice-analysis-modifiers nil
1119 "List of spice mode analysis modifiers.")
1121 (defvar spice-types nil
1122 "List of spice mode standardized types.")
1124 (defvar spice-functions nil
1125 "List of spice mode functions.")
1127 (defvar spice-section-headings nil
1128 "List of spice mode section headings.")
1130 (defvar spice-misc-model-type-names nil
1131 "List of miscellaneous model type name.")
1133 (defvar spice-model-type-names nil
1134 "List of all model type name.")
1136 (defvar spice-output-keywords nil
1137 "List of all output keywords.")
1139 (defvar spice-output-types nil
1140 "List of all output types.")
1142 (defvar spice-options-keywords nil
1143 "List of all output options keywords.")
1145 (defvar spice-options-parameters nil
1146 "List of all output options parameters.")
1148 (defvar spice-entity-start-keywords nil
1149 "List of entity definition keywords.")
1151 (defvar spice-keywords-regexp nil
1152 "Regexp for keywords.")
1154 (defvar spice-colon-keywords-regexp nil
1155 "Regexp for colon keywords.")
1157 (defvar spice-analyses-regexp nil
1158 "Regexp for analyses.")
1160 (defvar spice-analysis-modifiers-regexp nil
1161 "Regexp for analysis modifiers.")
1163 (defvar spice-layla-keywords-regexp nil
1164 "Regexp for layla keywords.")
1166 (defvar spice-mondriaan-keywords-regexp nil
1167 "Regexp for mondriaan keywords.")
1169 (defvar spice-draccdl-keywords-regexp nil
1170 "Regexp for dracula CDL keywords.")
1172 (defvar spice-types-regexp nil
1173 "Regexp for spice mode types.")
1175 (defvar spice-functions-regexp nil
1176 "Regexp for spice mode functions (Layla).")
1178 (defvar spice-section-headings-regexp nil
1179 "Regexp for spice mode section headings.")
1181 (defvar spice-xinstance-regexp nil
1182 "Regexp for x instances.")
1184 (defvar spice-model-name-regexp nil
1185 "Regexp model names of elements.")
1187 (defvar spice-entity-start-regexp nil
1188 "Regexp for start of entity definition.")
1190 (require 'font-lock
)
1192 (defvar spice-instance-name-face
'spice-instance-name-face
1193 "Face name to use spice instances.")
1195 (defface spice-instance-name-face
1196 '((((class grayscale
) (background light
)) (:foreground
"LightGray" :bold t
))
1197 (((class grayscale
) (background dark
)) (:foreground
"DimGray" :bold t
))
1198 (((class color
) (background light
)) (:foreground
"ForestGreen" :bold t
))
1199 (((class color
) (background dark
)) (:foreground
"Yellow" :bold t
))
1201 "Spice mode face used to highlight instances."
1202 :group
'spice-faces
)
1204 (defvar spice-model-name-face
'spice-model-name-face
1205 "Face name to use spice instances.")
1207 (defface spice-model-name-face
1208 '((((class grayscale
) (background light
)) (:foreground
"LightGray"))
1209 (((class grayscale
) (background dark
)) (:foreground
"DimGray"))
1210 (((class color
) (background light
)) (:foreground
"Red3"))
1211 (((class color
) (background dark
)) (:foreground
"LightSteelBlue"))
1213 "Spice mode face used to highlight models."
1214 :group
'spice-faces
)
1216 (defvar spice-title-face
'spice-title-face
1217 "Face name for title string.")
1219 (defface spice-title-face
1220 '((((class grayscale
) (background light
)) (:foreground
"LightGray" :bold t
))
1221 (((class grayscale
) (background dark
)) (:foreground
"DimGray" :bold t
))
1222 (((class color
) (background light
))
1223 (:foreground
"Yellow" :background
"black" :bold t
))
1224 (((class color
) (background dark
))
1225 (:foreground
"green3":background
"lightyellow" :bold t
))
1227 "Spice mode face used for title string."
1228 :group
'spice-faces
)
1230 (defvar spice-layla-function-name-face
'spice-layla-function-name-face
1231 "Face name to use for layla function names.")
1233 (defface spice-layla-function-name-face
1234 '((((class grayscale
) (background light
)) (:foreground
"LightGray" :bold t
))
1235 (((class grayscale
) (background dark
)) (:foreground
"DimGray" :bold t
))
1236 (((class color
) (background light
))
1237 (:foreground
"Darkgreen"))
1238 (((class color
) (background dark
)) (:foreground
"green"))
1240 "Spice mode face used to higlight layla functions."
1241 :group
'spice-faces
)
1244 (defvar spice-analysis-face
'spice-analysis-face
1245 "Face name to highlight spice mode analysis commands.")
1247 (defface spice-analysis-face
1248 '((((class color
) (background light
)) (:foreground
"Magenta" :bold t
:underline t
))
1249 (((class color
) (background dark
)) (:foreground
"Lightgreen" :bold t
:underline t
))
1251 "Spice mode face used to highlight analysis commands."
1252 :group
'spice-faces
)
1254 (defvar spice-doc-face
'font-lock-string-face
1255 "Face name to use for doc strings.")
1257 (custom-add-to-group 'spice-faces
'font-lock-string-face
'custom-face
)
1260 (defvar spice-constant-face
'font-lock-constant-face
1261 "Face name to use for constants.")
1263 (custom-add-to-group 'spice-faces
'font-lock-constant-face
'custom-face
)
1265 (defvar spice-include-file-face
'font-lock-string-face
1266 "Face name to use for include files and libraries.")
1268 (custom-add-to-group 'spice-faces
'font-lock-string-face
'custom-face
)
1270 (custom-add-to-group 'spice-faces
'font-lock-builtin-face
'custom-face
)
1272 (defvar spice-builtin-face
'font-lock-builtin-face
1273 "Face name for builtin types.")
1275 (defun spice-keywords-init ()
1276 "Initialize reserved words."
1277 (setq spice-keywords
1278 (append spice-spice2g6-keywords
1279 (when (spice-standard-p 'hspice
)
1280 spice-hspice-keywords
)
1281 (when (spice-standard-p 'eldo
)
1282 spice-eldo-keywords
)
1283 (when (spice-standard-p 'eldorf
)
1284 spice-eldorf-keywords
)
1285 (when (spice-standard-p 'fasthenry
)
1286 spice-fasthenry-keywords
)))
1287 (setq spice-colon-keywords
1288 (append (when (spice-standard-p 'eldo
)
1289 spice-eldo-colon-keywords
)
1290 (when (spice-standard-p 'eldovloga
)
1291 spice-eldovloga-colon-keywords
)))
1292 (setq spice-analyses
1293 (append spice-spice2g6-analyses
1294 (when (spice-standard-p 'hspice
)
1295 spice-hspice-analyses
)
1296 (when (spice-standard-p 'eldo
)
1297 spice-eldo-analyses
)
1298 (when (spice-standard-p 'eldorf
)
1299 spice-eldorf-analyses
)
1300 (when (spice-standard-p 'fasthenry
)
1301 spice-fasthenry-analyses
)))
1302 (setq spice-analysis-modifiers
1303 (append spice-spice2g6-analysis-modifiers
1304 (when (spice-standard-p 'hspice
)
1305 spice-hspice-analysis-modifiers
)
1306 (when (spice-standard-p 'eldo
)
1307 spice-eldo-analysis-modifiers
)
1308 (when (spice-standard-p 'fasthenry
)
1309 spice-fasthenry-analysis-modifiers
)))
1310 (setq spice-misc-model-type-names
1311 (append spice-spice2g6-model-type-names
1312 (when (spice-standard-p 'hspice
)
1313 spice-hspice-model-type-names
)
1314 (when (spice-standard-p 'eldovloga
)
1315 spice-eldo-vloga-model-type-names
)
1316 (when (spice-standard-p 'eldo
)
1317 spice-eldo-model-type-names
)))
1318 (setq spice-output-keywords
1319 (append spice-spice2g6-output-keywords
1320 (when (spice-standard-p 'hspice
)
1321 spice-hspice-output-keywords
)
1322 (when (spice-standard-p 'eldo
)
1323 spice-eldo-output-keywords
)))
1324 (setq spice-output-types
1325 (append spice-spice2g6-output-types
1326 (when (spice-standard-p 'hspice
)
1327 spice-hspice-output-types
)
1328 (when (spice-standard-p 'eldo
)
1329 spice-eldo-output-types
)
1330 (when (spice-standard-p 'eldorf
)
1331 spice-eldorf-output-types
)))
1332 (setq spice-model-type-names
1333 (append spice-misc-model-type-names
1334 spice-special-model-type-names
))
1336 (append spice-spice2g6-types
1337 (when (spice-standard-p 'hspice
)
1339 (when (spice-standard-p 'eldo
)
1341 (when (spice-standard-p 'eldorf
)
1343 (when (spice-standard-p 'fasthenry
)
1344 spice-fasthenry-types
)))
1345 (setq spice-options-keywords
1346 (append spice-spice2g6-options-keywords
1347 (when (spice-standard-p 'hspice
)
1348 spice-hspice-options-keywords
)
1349 (when (spice-standard-p 'eldo
)
1350 spice-eldo-options-keywords
)
1351 (when (spice-standard-p 'eldorf
)
1352 spice-eldorf-options-keywords
)))
1353 (setq spice-options-parameters
1354 (append spice-spice2g6-options-parameters
1355 (when (spice-standard-p 'hspice
)
1356 spice-hspice-options-parameters
)
1357 (when (spice-standard-p 'layla
)
1358 spice-layla-options-parameters
)
1359 (when (spice-standard-p 'eldo
)
1360 spice-eldo-options-parameters
)
1361 (when (spice-standard-p 'eldorf
)
1362 spice-eldorf-options-parameters
)))
1363 (setq spice-functions spice-layla-functions
)
1364 (setq spice-section-headings
(list "Changelog")) ; Changelog is special case
1365 (let ((section-alist spice-section-alist
) heading
)
1366 (while section-alist
1367 (setq heading
(downcase (car (cdr (car section-alist
)))))
1368 (setq spice-section-headings
(append spice-section-headings
1370 (setq section-alist
(cdr section-alist
))))
1371 (setq spice-entity-start-keywords
1372 (append spice-spice2g6-entity-start-keywords
1373 (when (spice-standard-p 'hspice
)
1374 spice-hspice-entity-start-keywords
)
1375 (when (spice-standard-p 'layla
)
1376 spice-layla-entity-start-keywords
)
1377 (when (spice-standard-p 'mondriaan
)
1378 spice-mondriaan-entity-start-keywords
)
1379 (when (spice-standard-p 'draccdl
)
1380 spice-draccdl-entity-start-keywords
)
1381 (when (spice-standard-p 'eldo
)
1382 spice-eldo-entity-start-keywords
)))
1383 (setq spice-section-headings-regexp
1384 (concat spice-section-regexp-start
"\\("
1385 (regexp-opt spice-section-headings
) "\\)\\(.*\\)$"
1388 (setq spice-keywords-regexp
1390 (regexp-opt spice-keywords
)
1392 (setq spice-colon-keywords-regexp
1394 (regexp-opt spice-colon-keywords
)
1396 (setq spice-analyses-regexp
1399 (regexp-opt spice-analyses
)
1401 (setq spice-analysis-modifiers-regexp
1402 (concat "\\<\\(" (regexp-opt spice-analysis-modifiers
) "\\)\\>"))
1403 (setq spice-layla-keywords-regexp
1404 (concat "^\\s-*\\*?"
1406 (regexp-opt spice-layla-keywords
)
1408 (setq spice-mondriaan-keywords-regexp
1409 (concat "^\\s-*\\*?"
1411 (regexp-opt spice-mondriaan-keywords
)
1413 (setq spice-draccdl-keywords-regexp
1416 (regexp-opt spice-draccdl-keywords
)
1418 (setq spice-types-regexp
1419 (concat "\\<\\(" ;"\\(\\s-+\\|\n\\+\\s-*\\)\\<\\("
1420 (regexp-opt spice-types
)
1422 (setq spice-functions-regexp
1423 (concat "^\\s-*\\(\\*?\\.\\("
1424 (regexp-opt spice-functions
)
1425 "\\)\\)\\>(\\([^,]+\\),\\([^,]+\\),[^,]+)"))
1426 ; old xinstance regexp
1427 ; "\\([ \t]+[^ $!(=\t\n][^ (=\t\n]*\\|\n[+]\\)*" ; $! are hspice & eldo's doc string starters
1428 (setq spice-xinstance-regexp
1429 (concat "^\\(x\\S-*\\)"
1431 ;; "\\(\\([ \t]*[^ *" ;; should solve problem when no space between + and name, but fails horribly due to CPU hungry recursion in matcher....
1432 (when (spice-standard-p 'hspice
) "$")
1433 (when (spice-standard-p 'eldo
) "!")
1434 ":(=\t\n][^ :(=\t\n]*\\|[ \t]*\\(\n?[*"
1435 (when (spice-standard-p 'hspice
) "$")
1436 (when (spice-standard-p 'eldo
) "!")
1437 "].*\\)?\n[+]\\)*\\s-*\\)" ;; \\([a-z]\\w*\\)
1438 "\\<" spice-model-name
"\\>"
1439 "\\(\\s-*\n\\|\\s-+[^=\n]\\)"
1442 (setq spice-model-name-regexp
1443 (concat "^\\([qmd]\\S-*\\)" ;; only bips, mos and diodes
1444 "\\([ \t]+[^ *" ;; first '*' was '+' ! but fails see spice-xinstance-regexp...
1445 (when (spice-standard-p 'hspice
) "$")
1446 (when (spice-standard-p 'eldo
) "!")
1447 "(=\t\n][^ (=\t\n]*\\|[ \t]*\\([*"
1448 (when (spice-standard-p 'hspice
) "$")
1449 (when (spice-standard-p 'eldo
) "!")
1450 "].*\\)?\n[+]\\)*\\s-*" ;; \\([a-z]\\w*\\)
1451 "\\<" spice-model-name
"\\>"
1452 "\\(\\s-*\n\\|\\s-+[^=]\\)"
1454 (setq spice-entity-start-regexp
1455 (concat "^\\*?\\.\\("
1456 (regexp-opt spice-entity-start-keywords
)
1460 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1461 ;; Font lock initialization
1462 (defvar spice-font-lock-keywords-0 nil
1463 ;; set in `spice-font-lock-init' because dependent on custom variables
1464 "For consideration as a value of `spice-font-lock-keywords'.
1465 This does highlighting of keywords and standard identifiers.")
1467 (defvar spice-font-lock-keywords-1 nil
1468 ;; set in `spice-font-lock-init' because dependent on custom variables
1469 "For consideration as a value of `spice-font-lock-keywords'.
1470 This does highlighting of keywords and standard identifiers.")
1472 (defvar spice-font-lock-keywords-2 nil
1473 ;; set in `spice-font-lock-init' because dependent on custom variables
1474 "For consideration as a value of `spice-font-lock-keywords'.
1475 This does highlighting of keywords and standard identifiers.")
1477 (defvar spice-font-lock-keywords-3 nil
1478 ;; set in `spice-font-lock-init' because dependent on custom variables
1479 "For consideration as a value of `spice-font-lock-keywords'.
1480 This does highlighting of keywords and standard identifiers.")
1482 (defvar spice-font-lock-keywords-4 nil
1483 ;; set in `spice-font-lock-init' because dependent on custom variables
1484 "For consideration as a value of `spice-font-lock-keywords'.
1485 This does highlighting of keywords and standard identifiers.")
1487 (defvar spice-font-lock-keywords-5 nil
1488 ;; set in `spice-font-lock-init' because dependent on custom variables
1489 "For consideration as a value of `spice-font-lock-keywords'.
1490 This does highlighting of keywords and standard identifiers.")
1492 (defvar spice-font-lock-keywords-6 nil
1493 ;; set in `spice-font-lock-init' because dependent on custom variables
1494 "For consideration as a value of `spice-font-lock-keywords'.
1495 This does highlighting of keywords and standard identifiers.")
1497 (defvar spice-font-lock-keywords-7 nil
1498 ;; set in `spice-font-lock-init' because dependent on custom variables
1499 "For consideration as a value of `spice-font-lock-keywords'.
1500 This does highlighting of keywords and standard identifiers.")
1502 (defvar spice-font-lock-keywords-8 nil
1503 ;; set in `spice-font-lock-init' because dependent on custom variables
1504 "For consideration as a value of `spice-font-lock-keywords'.
1505 This does highlighting of keywords and standard identifiers.")
1507 (defvar spice-font-lock-keywords-9 nil
1508 ;; set in `spice-font-lock-init' because dependent on custom variables
1509 "For consideration as a value of `spice-font-lock-keywords'.
1510 This does highlighting of keywords and standard identifiers.")
1512 (defvar spice-font-lock-keywords-10 nil
1513 ;; set in `spice-font-lock-init' because dependent on custom variables
1514 "For consideration as a value of `spice-font-lock-keywords'.
1515 This does highlighting of keywords and standard identifiers.")
1517 (defvar spice-font-lock-keywords-11 nil
1518 ;; set in `spice-font-lock-init' because dependent on custom variables
1519 "For consideration as a value of `spice-font-lock-keywords'.
1520 This does highlighting of keywords and standard identifiers.")
1522 (defvar spice-font-lock-keywords-12 nil
1523 ;; set in `spice-font-lock-init' because dependent on custom variables
1524 "For consideration as a value of `spice-font-lock-keywords'.
1525 This does highlighting of keywords and standard identifiers.")
1527 (defvar spice-font-lock-keywords-13 nil
1528 ;; set in `spice-font-lock-init' because dependent on custom variables
1529 "For consideration as a value of `spice-font-lock-keywords'.
1530 This does highlighting of keywords and standard identifiers.")
1533 ;; fast variable name matcher in parameter=value constructs
1534 (defun spice-match-variable-name (limit)
1535 "Match variable names with LIMIT."
1536 (let (pos found
(start (point)))
1538 (setq pos
(search-forward "=" limit
'end
)) ;
1542 (if (< (point) start
) (goto-char pos
))
1543 (if (looking-at "\\([a-z]\\w*\\)\\s-*\\(=\\)")
1546 ;; (message (match-string 1))
1550 (setq pos
(search-forward "=" limit
'end
)))))
1553 ;; font-lock aux functions
1554 (defun spice-match-eldo-colon-keywords (limit)
1555 "Match with LIMIT ((param|pin|model|port|generic):)."
1556 ;; latter two are eldo verilog-A
1557 (let (pos found
(start (point)))
1559 (setq pos
(search-forward ":" limit
'end
)) ;
1562 (if (< (point) start
) (goto-char pos
))
1563 ;; (message "pos is %d" pos)
1564 (if (looking-at ;; "\\(\\(param\\|pin\\|model\\|port\\|generic\\):\\)")
1565 spice-colon-keywords-regexp
)
1572 (setq pos
(search-forward ":" limit
'end
)))))
1575 ;; these are try outs to solve the font-locking of problematic xinstances:
1577 (defun spice-match-xinstances-dummy (limit)
1578 "Match xinstances with LIMIT."
1581 (goto-char (point-min))
1583 (goto-char (point-max))
1585 (with-current-buffer (get-buffer-create "*Matcher*")
1586 (goto-char (point-max))
1587 (insert (format "Point min is %s\n" min
))
1588 (insert (format "Current point is %s\n" pt
))
1589 (insert (format "Limit is %s\n" limit
))
1590 (insert (format "Point max is %s\n" max
))))
1593 (defun spice-idle-font-lock (beg end
)
1594 "Run font-lock on a region between BEG and END."
1595 (message "rerunning font-lock on %s:%s=%s" beg end
(buffer-substring beg end
))
1596 (save-excursion (font-lock-fontify-region beg end
)))
1598 (defvar spice-previous-xinstance-match-result nil
)
1599 (make-variable-buffer-local 'spice-previous-xinstance-match-result
)
1601 (defun spice-match-in-xinstance (limit)
1602 "Check if in xinstance with LIMIT."
1604 (if (or (looking-at "^\\s-*[xX]")
1605 (re-search-backward "^[xX]" (point-min) t
))
1606 (if (and (looking-at spice-xinstance-regexp
)
1607 (or (> (match-end 5) pt
)
1608 (not spice-previous-xinstance-match-result
))
1612 (goto-char (match-end 5))
1613 (if (or (> pt
(match-beginning 1))
1614 (< limit
(match-end 5)))
1617 ;;(spice-idle-font-lock (match-beginning 1) (match-end 5))
1618 (run-with-idle-timer 1 nil
'spice-idle-font-lock
1619 (match-beginning 1) (match-end 5))
1621 ;; (if (> (match-end 5) limit)
1622 ;; (run-with-idle-timer 1 nil 'spice-idle-font-lock
1623 ;; (match-beginning 1) (match-end 5)))
1630 (defun spice-match-next-xinstance (limit)
1631 "Check if there is a next xinstance partly within LIMIT."
1632 (if (re-search-forward "^[xX]" limit
'end
)
1635 (if (looking-at spice-xinstance-regexp
)
1638 (goto-char (match-end 5))
1642 (spice-match-next-xinstance limit
))
1646 (defun spice-match-xinstance (limit)
1647 "Match xinstances with LIMIT."
1648 (if (spice-match-in-xinstance limit
)
1650 (spice-match-next-xinstance limit
)))
1652 (defun spice-match-xinstances-old (limit)
1653 "Match an xinstance with LIMIT."
1654 (setq spice-previous-xinstance-match-result
(spice-match-xinstance limit
))
1655 spice-previous-xinstance-match-result
)
1657 ;; this xinstances matcher is a complete parser !
1659 (defun spice-match-xinstances (limit)
1660 "Match xinstance with LIMIT subckt name, this one parses the lines.
1662 Should work for all cases, infinite number of comment lines,
1663 continuation lines. Could fail when modifying an xinstance line
1664 though, hard to tell."
1666 (let ((result nil
) match-start
)
1669 (re-search-forward "^\\(x\\S-*\\)" limit
'end
)) ;; should be checked ?
1670 (setq match-start
(match-data))
1671 ;;(message "match-start is %s" match-start)
1674 (and (looking-at "\\([ \t]+\\|\\s-*\n[+]\\s-*\\)\\(\\([a-z][^ :(=\t\n]*\\)\\|\\([^ *$!:(=\t\n][^ :(=\t\n]*\\)\\)\\(\\s-*\n\\|\\s-+[^=\n]\\)")
1676 (goto-char (match-end 2))
1680 (looking-at "\\(\\([ \t]+\\|\\s-*\n\\s-*\\)[$!*].*\\)")
1682 (goto-char (match-end 1))
1685 (when result
(set-match-data
1686 (append (list (car match-start
) (car (cdr (match-data))))
1687 (cdr (cdr match-start
)) (cdr (cdr (match-data))))))
1688 ;;(when result (message "Matched %s[%d]" (match-string 3) (match-end 3)))
1689 (when result
(when (< limit
(match-end 3)) (setq result nil
)))
1692 (defvar spice-font-lock-keywords nil
1693 "Regular expressions to highlight in spice mode.")
1695 (defun spice-font-lock-init ()
1696 "Initialize fontification."
1697 ;; makes spice-font-lock-keywords valid
1698 ;; highlight title & titles after .alter & .title (hspice only)
1699 (setq spice-font-lock-keywords-0
1700 (append (list ;; first line of spice deck
1701 (list "\\`.+$" 0 spice-title-face
)
1702 (list spice-section-headings-regexp
1703 '(1 font-lock-comment-face
)
1704 '(2 spice-title-face
)
1705 (list (regexp-opt-depth spice-section-headings-regexp
)
1706 spice-doc-face
'keep t
)))
1707 ;; hspice title in .alter or .title line
1708 (when (spice-standard-p 'hspice
)
1710 (list "^\\.\\(alter\\|title\\)\\s-+\\(.+\\)$"
1711 2 spice-title-face
)))))
1712 ;; highlight layla functions: .xx_yy_param(name,prop,val);
1713 (setq spice-font-lock-keywords-1
1715 (list spice-functions-regexp
1716 '(1 spice-layla-function-name-face
)
1717 (list (- (regexp-opt-depth spice-functions-regexp
) 1)
1718 font-lock-function-name-face
)
1719 (list (regexp-opt-depth spice-functions-regexp
)
1720 font-lock-variable-name-face
)
1722 ;; highlight spice keywords (mainly .<keyword> & .<analysis>)
1723 (setq spice-font-lock-keywords-2
1724 (list ;; .opt, .nodeset, ...
1725 (list spice-keywords-regexp
0 font-lock-keyword-face
)
1726 ;; '+' of continuation lines ? maybe over the top ...
1727 ;; (list (concat "^"
1728 ;; (when (spice-standard-p 'layla) "\\*?")
1729 ;; "\\+") 0 font-lock-keyword-face)
1730 ;; .op, .ac, .dc, .tran, ...
1731 (list spice-analyses-regexp
1732 '(1 font-lock-keyword-face
)
1733 '(2 spice-analysis-face
)
1734 (list spice-analysis-modifiers-regexp
1735 nil nil
'(0 font-lock-type-face
)))))
1737 (setq spice-font-lock-keywords-12
1738 ;; do dracula CDL stuff
1740 ;; add $ docs when they are followed by a space...
1741 (list (concat "\\<\\([$]\\)\\s-+\\(.*\\)$")
1742 (list 1 font-lock-comment-face
)
1743 (list 2 spice-doc-face
'keep
))
1744 ;; special models on element line
1745 (list (concat "\\([$]\\(?:ldd\\)?\\[\\)" spice-model-name
"\\(\\]\\)")
1746 '(1 font-lock-keyword-face
)
1747 '(2 spice-model-name-face
)
1748 '(3 font-lock-keyword-face
))
1749 ;; normal .model on element line
1750 (list (concat "\\([$]\\.model\\)\\s-*=\\s-*" spice-model-name
)
1751 '(1 font-lock-keyword-face
)
1752 '(2 spice-model-name-face
))
1753 ;; element options behind $ syntax
1754 (list (concat "\\([$]\\)\\(" (regexp-opt spice-draccdl-device-keywords
) "\\)")
1755 '(1 font-lock-keyword-face
)
1756 '(2 font-lock-keyword-face
))
1757 ;; element parameters behind $ syntax
1758 (list (concat "\\([$]\\)\\(" (regexp-opt spice-draccdl-device-parameters
) "\\)\\s-*=")
1759 '(1 font-lock-keyword-face
)
1760 '(2 font-lock-variable-name-face
))
1761 ;; general '.' keywords
1762 (list spice-draccdl-keywords-regexp
0 font-lock-keyword-face
)))
1764 ;; highlight layla specific keywords, also if *. syntax is used
1765 (setq spice-font-lock-keywords-3
1767 (list spice-layla-keywords-regexp
0 font-lock-keyword-face
)
1768 (list "^\\(\\*\\)\\+" 1 font-lock-keyword-face
))
1769 (when (spice-standard-p 'mondriaan
)
1771 (list spice-mondriaan-keywords-regexp
0 font-lock-keyword-face
)))))
1773 (setq spice-font-lock-keywords-13
1776 ;; * spectre: + syntax
1777 (list "^\\(\\*\\)\\s-+spectre:\\s-+" 1 font-lock-keyword-face
)
1779 (list "//.*$" 0 font-lock-comment-face
)
1780 ;; add simulator language=spice
1781 (list "^\\s-*\\(simulator\\)\\>"
1782 '(1 font-lock-keyword-face
))))
1784 ;; varia: .end, spice instances and '*' comment lines and output lines
1785 (setq spice-font-lock-keywords-4
1788 ;;'("^[a-z]\\S-*" . spice-instance-name-face)
1789 '("^[a-z][^ \t\n]+" . spice-instance-name-face
)
1790 ;(list (concat "^\\*\\([^"
1791 ; (when (spice-standard-p 'layla) "+")
1792 ; "\n].*\\|\n\\)") 0 font-lock-comment-face)
1793 (list (concat "^\\*[^\n"
1794 (when (or (spice-standard-p 'hspice
)
1795 (spice-standard-p 'draccdl
)
1796 (spice-standard-p 'layla
)) "$")
1797 (when (spice-standard-p 'eldo
) "!")
1798 "]*") 0 font-lock-comment-face
)
1799 (list (concat "^\\.\\(" (regexp-opt spice-output-keywords
)
1800 "\\)\\s-*" spice-line-break
"\\s-+\\("
1801 (regexp-opt spice-output-types
) "\\)\\>")
1802 '(0 font-lock-type-face keep
)) ;
1804 ;; highlight additional . unknowns (to detect stupid typing errors)
1805 (setq spice-font-lock-keywords-5
1806 (list '("^\\s-*\\.[^ \t\n]*" 0 font-lock-warning-face
)))
1808 ;; highlight additional $ and ! comments, only eldo, hspice, draccdl and layla
1809 (setq spice-font-lock-keywords-6
1811 (list (concat "\\<\\(["
1812 (when (or (spice-standard-p 'hspice
)
1813 (spice-standard-p 'draccdl
)
1814 (spice-standard-p 'layla
)) "$")
1815 (when (spice-standard-p 'eldo
) "!")
1817 (list 1 font-lock-comment-face
)
1818 (list 2 spice-doc-face
'append
) ;; needs at least 'append or 'keep
1820 (list (concat "\\<\\([*"
1821 (when (or (spice-standard-p 'hspice
)
1822 (spice-standard-p 'draccdl
)
1823 (spice-standard-p 'layla
)) "$")
1824 (when (spice-standard-p 'eldo
) "!")
1826 ;; elisp mode like quotes, for extra clarity
1827 (list "['\"]\\([^'\"]+\\)['\"]" nil nil
1828 (list 1 spice-constant-face
'prepend
)))))
1830 ;; subcircuit instance names of x instances and model names of mos,bip&diode
1831 (setq spice-font-lock-keywords-7
1833 (list spice-xinstance-regexp
5 spice-model-name-face
)
1834 ;; test xinstance function matcher
1835 ;;(list 'spice-match-xinstances
1836 ;; '(4 spice-model-name-face keep t)
1837 ;; '(5 font-lock-warning-face keep t))
1838 (list spice-model-name-regexp
4 spice-model-name-face
)
1841 ;; highlight poly's of inductors and caps
1842 (setq spice-font-lock-keywords-8
1844 '("^[cl]\\w*\\s-+\\w[^ \t\n]*\\s-+\\w[^ \t\n]*\\s-+\\(poly\\)"
1845 1 font-lock-type-face
)))
1847 ;; types, included files, libs and names of subcircuits, ports, libs, models
1848 (setq spice-font-lock-keywords-9
1850 ;; names and types of models/subckt, lib concept of eldo...
1851 (when (spice-standard-p 'eldo
)
1853 (list (concat "^\\s-*\\.\\(model\\|subckt\\|macro\\)\\s-+"
1854 "\\(\\(lib\\)\\s-+[^ \t\n]+\\s-+\\)"
1856 '(3 font-lock-keyword-face
)
1857 '(4 font-lock-function-name-face
))))
1860 (list "^[+vi.]" '(0 'default
) ;; find v & i's and continuation and . lines
1861 (list spice-types-regexp nil nil
'(1 font-lock-type-face
)))
1863 (list (concat spice-library-regexp-start
1864 spice-library-regexp-end
) 3 spice-include-file-face
)
1865 ;; names of (defined) entities
1867 (concat spice-entity-start-regexp
1868 "\\(\\s-+\\([a-z]\\w*\\)\\s-*"
1869 "\\|\\s-*[\n][+]\\s-*\\([a-z]\\w*\\)\\s-*\\)")
1870 (1+ (regexp-opt-depth spice-entity-start-regexp
))
1871 font-lock-function-name-face
)
1872 ;; names and types of models
1873 (list (concat "^\\s-*\\.model\\s-+"
1875 spice-line-break
"\\s-+\\("
1876 (regexp-opt spice-model-type-names
) "\\)\\>")
1877 '(1 font-lock-function-name-face
)
1878 '(3 font-lock-type-face
))
1881 ;; highlight additional eldo reserved words
1882 (setq spice-font-lock-keywords-10
1885 (list "\\<\\(label\\)\\s-*=\\s-*\\([^\"]\\w*\\)\\>"
1886 '(1 font-lock-type-face
)
1887 '(2 font-lock-variable-name-face
))
1889 (list "\\<\\(label\\)\\s-*=\\s-*\"\\([^\"]+\\)\""
1890 '(1 font-lock-type-face
)
1891 '(2 font-lock-variable-name-face
))
1892 ;; eldo's param,model&pin:
1893 ;;'("\\<\\(\\(param\\|pin\\|model\\):\\)" 0 font-lock-keyword-face)
1894 (list 'spice-match-eldo-colon-keywords
1895 (list 1 font-lock-keyword-face
)
1897 ;; eldo's builtin macro models
1898 (list (concat "^y\\w+\\s-+\\<\\("
1899 (regexp-opt spice-eldo-macromodel-keywords
) "\\)\\>")
1900 '(1 spice-builtin-face
))
1901 ;; eldo's y instances, type is second word on line
1902 (list (concat "^y\\w+\\s-+\\<" spice-model-name
"\\>")
1903 1 spice-model-name-face
)))
1904 ;; highlight property names property=value & strings (way at the end)
1905 (setq spice-font-lock-keywords-11
1907 ;; this is 1 second faster when loading 28 files, appx 10000 lines
1908 ;; .options keywords & parameters
1909 (list (concat "^\\s-*" ;; was "^"
1910 (when (spice-standard-p 'layla
) "\\*?")
1912 (when (or (spice-standard-p 'hspice
)
1913 (spice-standard-p 'layla
))
1916 '(0 font-lock-keyword-face
) ;; not used, already colored
1917 (list (concat "\\<\\(\\("
1918 (regexp-opt spice-options-keywords
)
1920 (regexp-opt spice-options-parameters
)
1921 "\\)\\s-*=\\)") nil nil
1922 (list 1 spice-constant-face
)))
1924 ;; '("\\<\\([a-z]\\w*\\)\\s-*=" 1 font-lock-variable-name-face)
1925 ;; this function matcher is much faster, it searches for '=' and then
1926 ;; returns the word in front of the '=', doesn't work in xemacs though
1927 ;;(if (string-match "XEmacs" emacs-version)
1928 ;; (list "\\<\\([a-z]\\w*\\)\\s-*=" 1 font-lock-variable-name-face)
1929 (list 'spice-match-variable-name
1930 (list 1 font-lock-variable-name-face
'append
)
1931 ;;(list 1 font-lock-variable-name-face)
1932 '(2 'default
'append
)) ;; default is required for XEmacs
1933 ;; 'append is required for Xemacs 21.4.11 on Windows. Otherwise
1934 ;; the matcher overrules the previous highlighting (for instance when
1935 ;; this 'var=value' is after a doc starter...
1938 ;; changelog entries
1942 (when (or (spice-standard-p 'hspice
)
1943 (spice-standard-p 'layla
)) "$")
1944 (when (spice-standard-p 'eldo
) "!")
1945 "]+\\s-+\\([A-Z].*[0-9]\\)\\s-+\\([a-zA-Z].*\\)<\\(.*@.*\\)>$")
1946 '(1 font-lock-string-face t
)
1947 '(2 font-lock-type-face t
)
1948 '(3 font-lock-variable-name-face t
))
1951 '("\"[^\"]*\"" 0 font-lock-string-face
)
1953 ;; scale factors and powers or is this overkill ?
1955 "\\<[-+]?[0-9.]+\\(\\("
1956 (regexp-opt '("T" "G" "Meg" "K" "mil" "m" "u" "M" "n" "p" "f"))
1957 "\\)[a-zA-Z]*\\)\\>")
1958 (list 2 spice-constant-face
'append
))
1960 "[0-9.]\\(e\\)[-+]?[0-9]+\\>")
1961 (list 1 spice-constant-face
'append
))
1963 ;; set font-lock-keywords, all of 'em
1964 (setq spice-font-lock-keywords
1965 (append spice-font-lock-keywords-0
;; title first
1966 (when (spice-standard-p 'layla
)
1967 spice-font-lock-keywords-1
)
1968 (when spice-highlight-keywords
1969 spice-font-lock-keywords-2
)
1971 spice-highlight-keywords
1972 (spice-standard-p 'layla
))
1973 spice-font-lock-keywords-3
)
1974 (when (spice-standard-p 'spectre
)
1975 spice-font-lock-keywords-13
)
1976 (when (spice-standard-p 'draccdl
)
1977 spice-font-lock-keywords-12
)
1978 spice-font-lock-keywords-4
1979 (when spice-highlight-keywords
1980 spice-font-lock-keywords-5
)
1981 (when (or (spice-standard-p 'layla
)
1982 (spice-standard-p 'hspice
)
1983 (spice-standard-p 'draccdl
)
1984 (spice-standard-p 'eldo
))
1985 spice-font-lock-keywords-6
)
1986 spice-font-lock-keywords-7
1987 (when spice-highlight-keywords
1988 spice-font-lock-keywords-8
)
1989 spice-font-lock-keywords-9
1990 (when (spice-standard-p 'eldo
)
1991 spice-font-lock-keywords-10
)
1992 (when spice-highlight-keywords
1993 spice-font-lock-keywords-11
)
1997 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1998 ;;; Comments (taken from eldo-mode.el)
1999 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2001 ;; uncomment function, should work for any case now:
2002 (defun spice-uncomment-region (beg end
)
2003 "Uncomment selected region - comment symbol is '*'.
2004 Doc comments (starting with '!') are unaffected."
2006 (comment-region beg end
'(2))) ; 2 is arbitrary, can be any value
2009 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2011 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2013 ;; (require 'tempo) ; ? is this necessary
2015 (defvar spice-mode-map
()
2016 "Keymap used in spice-mode.")
2020 (let ((map (make-sparse-keymap)))
2022 ;; key binding for template completion
2023 (define-key map
"\t" 'tempo-complete-tag
)
2024 ;; (define-key map "\S-\t" 'indent-for-tab-command)
2025 (define-key map
[(shift tab
)] 'indent-for-tab-command
)
2026 (define-key map
[(shift iso-lefttab
)] 'indent-for-tab-command
)
2028 ;; key bindings for compile
2029 (define-key map
"\C-c\C-r" 'spice-compile
) ;; r for run
2030 (define-key map
"\C-c\C-k" 'kill-compilation
)
2032 ;; replace global binding
2033 (define-key map
"\C-x`" 'spice-next-error
)
2035 ;; key bindings for waveform viewer
2036 (define-key map
"\C-c\C-v" 'spice-run-waveform-viewer
)
2038 ;; key bindings for output file loading
2039 (define-key map
"\C-c\C-o" 'spice-load-output-file
)
2041 ;; key bindings for include file loading
2042 (define-key map
"\C-c\C-l" 'spice-load-include-files
)
2044 ;; comment region, use auctex-mode bindings...
2045 (define-key map
"\C-c\C-c" 'comment-region
)
2046 ;;(define-key map "\C-c:" 'spice-uncomment-region) ;; \C-u\C-c\C-c
2049 (define-key map
"\C-c\C-s" 'spice-search-subckt
)
2052 (define-key map
"\M-^" 'spice-delete-indentation
)
2054 ;; key bindings for hiding/unhidding comments
2055 (define-key map
"\C-c;" 'spice-hide-all-comments
)
2056 (define-key map
"\C-c:" 'spice-unhide-all-comments
)
2058 ;; changelog addition
2059 (define-key map
"\C-c\C-ac" 'spice-add-changelog-entry
)
2061 (setq spice-mode-map map
)))
2064 (defvar spice-output-mode-map
()
2065 "Keymap used in Spice-output mode.")
2067 (if spice-output-mode-map
2069 (let ((map (make-sparse-keymap)))
2070 ;; nothing for now ...
2072 (setq spice-output-mode-map map
)))
2075 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2076 ;;; libraries & include files (taken & adapted from eldo-mode.el, E. Rouat)
2077 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2079 ;;------------------------------------------------------------
2080 ;; Mouse bindings (only used by 'spice-load-file-at-mouse')
2081 ;; I separate this from spice-mode-map so that this particular
2082 ;; mouse binding doesn't interfere with other bindings
2084 (defvar spice-mode-mouse-map nil
2085 "Map containing mouse bindings for spice-mode.")
2087 (if spice-mode-mouse-map
2089 (let ((map (make-sparse-keymap)))
2090 (set-keymap-parent map spice-mode-map
)
2091 ;; mouse button bindings
2092 ;;(define-key map "\r" 'ffap)
2093 (define-key map
"\r" 'spice-load-file-at-point
)
2094 (define-key map
[mouse-2
] 'spice-load-file-at-mouse
)
2095 (define-key map
[S-mouse-2
] 'mouse-yank-at-click
)
2096 (setq spice-mode-mouse-map map
)))
2099 ;; overlays and extents are a mess. Depending on emacs/xemacs versions the
2100 ;; following code might actually work. What is known now is that this
2101 ;; works in: emacs 20.7, 21.1 and 21.2 (Linux versions have been tested),
2102 ;; xemacs 21.1 (Windows) and xemacs 21.5 (Linux). You need
2103 ;; fsf-compat package for xemacs 21.4.5 (Linux). Anyone still following this ?
2106 (defun spice-colorize-libraries (beg end old-len
)
2107 "Colorize libraries and included files when the mouse passes over them.
2109 Clicking on the middle-mouse button loads them in a buffer.
2110 BEWARE, this feature was hard to implement, and
2111 contains (non-fatal) bugs, primarily because Emacs 20 does not
2112 have the same support for this as XEmacs has."
2118 (setq end-point
(point))
2120 (beginning-of-line) ; scan entire line !
2121 ;; delete overlays existing on this line
2122 (let ((overlays (overlays-in (point) end-point
)))
2124 (if (and (overlay-get (car overlays
) 'detachable
)
2125 (overlay-get (car overlays
) 'spice-library
))
2126 (delete-overlay (car overlays
))
2128 (setq overlays
(cdr overlays
)))) ; let
2129 ; make new ones, could reuse deleted one ?
2130 (while (search-forward-regexp spice-library-regexp-start end-point t
)
2131 (let (start-lib extent
)
2132 (setq start-lib
(point))
2133 (search-forward-regexp spice-library-regexp-end end-point
) ; (let ((end-lib (point)))
2137 (defun spice-colorize-libraries-buffer ()
2138 "Colorize spice libraries in buffer."
2140 ;; (message "running colorize libraries buffer")
2142 (let ((overlays (overlays-in (point-min) (point-max))))
2145 (overlay-get (car overlays
) 'detachable
)
2146 (overlay-get (car overlays
) 'spice-library
))
2147 (delete-overlay (car overlays
)))
2148 (setq overlays
(cdr overlays
)))) ; let
2150 (spice-colorize-libraries (point-min) (point-max) nil
))
2153 ;; ffap needs wrapper to detect end of buffer condition
2154 (defun spice-load-file-at-point ()
2155 "Wrapper for ffap. But if at end of buffer inserts a newline instead."
2157 (if (looking-at "\\'")
2158 (newline) ;; assumes \r is bound to load file...
2162 ;; ffap-at-mouse isn't available in xemacs < 21
2163 ;; so define this function to do more or less the same (primarily
2164 ;; wraps ffap-at-mouse, except for xemacs 20)...
2165 (defun spice-load-file-at-mouse (event)
2166 "Loads file under button 2 click EVENT. Checks if file is readable."
2168 (if (fboundp 'ffap-at-mouse
)
2169 (ffap-at-mouse event
) ;; use ffap-at-mouse if available
2170 (save-excursion ;; implement a spice specific ffap-at-mouse
2171 (mouse-set-point event
)
2173 (if (looking-at (concat spice-library-regexp-start
2174 spice-library-regexp-end
))
2175 (if (file-readable-p (substitute-in-file-name (match-string 3)))
2176 (find-file (substitute-in-file-name (match-string 3)))
2178 (message "File '%s' isn't readable, use shift-mouse2 to paste in this field" (match-string 3))))
2182 ;;------------------------------------------------------------
2183 ;; Changelog and sections support (taken from eldo-mode, trying
2184 ;; to be compatible :)
2185 ;;------------------------------------------------------------
2187 (defun spice-doc-char ()
2188 "Return doc char that's valid in the selected spice submode."
2190 ((and (spice-standard-p 'eldo
)
2191 (spice-standard-p 'hspice
))
2192 "*") ; if both eldo and hspice is turned on
2193 ((spice-standard-p 'eldo
)
2195 ((spice-standard-p 'hspice
)
2198 "*"))) ; everything else
2201 (defun spice-find-changelog-point ()
2202 "Find adequate position to place Changelog entries.
2203 Just before .end or if not found at end of buffer."
2205 (goto-char (point-min))
2206 (let ((pos (re-search-forward
2207 "^\\.end\\b" nil t
)))
2208 (if pos
(progn (forward-line 1)
2213 (defun spice-add-changelog-entry (changelog-entry)
2214 "Find changelog section (create it if not found) and add an entry for today."
2215 (interactive "sChangelog entry: ")
2216 (goto-char (point-min))
2217 (if (not (re-search-forward
2218 (concat spice-section-regexp-start
"Changelog") nil t
))
2219 (spice-add-section "Changelog" (spice-find-changelog-point)))
2221 (spice-goto-section "Changelog")
2223 (let ((string (concat (spice-doc-char)
2224 (if (equal (spice-doc-char) "*") "* " " ")
2225 (substring (current-time-string) 0 11)
2226 (substring (current-time-string) -
4) " "
2227 (user-full-name) " <" user-mail-address
">")))
2228 (if (not (search-forward string nil t
))
2229 (insert "\n" string
"\n\n")
2231 (insert (spice-doc-char)
2232 (if (equal (spice-doc-char) "*") "*" "")
2233 " - " changelog-entry
"\n")))
2236 (defun spice-goto-section (section)
2237 "Move point to the beginning of the specified section; If the section is not found, leave point at previous location."
2238 (interactive "ssection: ")
2239 (let ((pos (point)))
2240 (goto-char (point-min))
2241 (if (not (re-search-forward
2242 (concat spice-section-regexp-start section
"\\b") nil t
))
2243 (progn (message "Couldn't find section %s" section
)
2247 (recenter))))) ;; added recenter
2250 (defun spice-comment-bar (&optional aligned
)
2251 "Insert solid comment bar from column zero to end of line.
2252 If optional argument is provided, bar will be added from current
2255 (if (not aligned
) (beginning-of-line) )
2257 (insert-char ?-
(- (1- fill-column
) (current-column)))
2261 (defun spice-add-section (section &optional arg
)
2262 "Add a SECTION in buffer at (optional) point ARG."
2263 (interactive "ssection: ")
2268 (concat (spice-doc-char) "\t" section
" \n"))
2270 ;; (unless (assoc section spice-section-alist)
2272 ;; (custom-set-variables
2273 ;; (quote (spice-section-alist
2274 ;; (append spice-section-alist
2275 ;; (list (list section (upcase section) nil))))))
2280 (defvar spice-cache-section-alist nil
)
2282 (defun spice-cache-section-p (section)
2283 "Check for all sections in file and remembers if they were present or not."
2285 (setq spice-cache-section-alist nil
)
2286 (goto-char (point-min))
2287 (while (re-search-forward spice-section-headings-regexp nil t
)
2288 (setq spice-cache-section-alist
2289 (cons (cons (downcase (match-string-no-properties 2)) t
)
2290 spice-cache-section-alist
)))
2291 (spice-section-p section
)))
2294 (defun spice-section-p (section)
2295 "Check if named section is in file.
2297 Returns t if found, nil otherwise, uses cache generated with the
2298 `spice-cache-section-p' function."
2299 (assoc section spice-cache-section-alist
))
2302 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2303 ;;; Templates (extensive, long code...)
2304 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2308 ;;; element templates
2311 (tempo-define-template
2312 "spice-spice2g6-resistor"
2314 (p "[name]: ") '(just-one-space)
2315 (p "[pos node]: ") '(just-one-space)
2316 (p "[neg node]: ") '(just-one-space)
2318 ;; "spice2g6 resistor"
2320 "tempo template for spice2g6 resistor"
2324 (tempo-define-template
2325 "spice-spice3-semiconductor-resistor"
2327 (p "[name]: ") '(just-one-space)
2328 (p "[pos node]: ") '(just-one-space)
2329 (p "[neg node]: ") '(just-one-space)
2330 (p "<value>: " value
) '(just-one-space)
2331 (p "<mname>: " mname
) '(just-one-space)
2332 (p "<length>: " l
'noinsert
)
2333 (if (string-equal (tempo-lookup-named 'l
) "")
2334 () (list 'l
"L=" '(s l
)))
2336 (p "<width>: " w
'noinsert
)
2337 (if (string-equal (tempo-lookup-named 'w
) "")
2338 () (list 'l
"W=" '(s w
)))
2340 (p "<temp>: " temp
'noinsert
)
2341 (if (string-equal (tempo-lookup-named 'temp
) "")
2342 () (list 'l
"TEMP=" '(s temp
)))
2345 ;; "spice3 semiconductor resistor"
2347 "tempo template for spice3 semiconductor resistor"
2351 (tempo-define-template
2352 "spice-eldo-resistor"
2354 (p "[name]: ") '(just-one-space)
2355 (p "[pos node]: ") '(just-one-space)
2356 (p "[neg node]: ") '(just-one-space)
2357 (p "<mname>: " mname
) '(just-one-space)
2358 (if (string-equal (tempo-lookup-named 'mname
) "")
2359 (list 'l
"r=" '(p "[val]: "))
2360 (list 'l
'(p "[val]: "))) '(just-one-space)
2361 (p "<temp coef 1>: " tc1
'noinsert
)
2362 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
2363 (list 'l
"TC1=" '(s tc1
) '(p "<temp coef 2>: " tc2
'noinsert
)))
2365 (if (and (tempo-lookup-named 'tc2
)
2366 (not (string-equal (tempo-lookup-named 'tc2
) "")))
2367 (list 'l
"TC2=" '(s tc2
)))
2369 (p "<ac resistance>: " ac
'noinsert
)
2370 (if (string-equal (tempo-lookup-named 'ac
) "")
2371 () (list 'l
"AC=" '(s ac
)))
2373 (p "<temp>: " temp
'noinsert
)
2374 (if (string-equal (tempo-lookup-named 'temp
) "")
2375 () (list 'l
"T=" '(s temp
)))
2377 (p "<m>: " m
'noinsert
)
2378 (if (string-equal (tempo-lookup-named 'm
) "")
2379 () (list 'l
"M=" '(s m
)))
2381 (p "<nonoise in transient [y/n]?>: " nonoise
'noinsert
)
2382 (if (string-equal (tempo-lookup-named 'nonoise
) "y")
2383 (list 'l
"NONOISE"))
2385 (p "<kf>: " kf
'noinsert
)
2386 (if (string-equal (tempo-lookup-named 'kf
) "")
2387 () (list 'l
'(s kf
) '(p "<af>: " af
'noinsert
)))
2389 (if (and (tempo-lookup-named 'af
)
2390 (not (string-equal (tempo-lookup-named 'af
) "")))
2396 "tempo template for eldo resistor"
2400 (tempo-define-template
2401 "spice-eldo-expression-resistor"
2403 (p "[name]: ") '(just-one-space)
2404 (p "[pos node]: ") '(just-one-space)
2405 (p "[neg node]: ") '(just-one-space)
2406 (p "[VALUE | TABLE]: " type
'noinsert
) '(just-one-space)
2407 (if (string-equal (tempo-lookup-named 'type
) "VALUE")
2408 (list 'l
"VALUE={" '(p "[val, enter expression without {}]: ") "}")
2409 (list 'l
"TABLE={" '(p "[table of values, enter table without {}]: ") "}"))
2411 (if (string-equal (tempo-lookup-named 'type
) "VALUE")
2412 (list 'l
'(p "<nonoise in transient [y/n]?>: " nonoise
'noinsert
)))
2413 (if (and (tempo-lookup-named 'nonoise
)
2414 (string-equal (tempo-lookup-named 'nonoise
) "y"))
2415 (list 'l
"NONOISE"))
2417 (p "<kf>: " kf
'noinsert
)
2418 (if (string-equal (tempo-lookup-named 'kf
) "")
2419 () (list 'l
'(s kf
) '(p "<af>: " af
'noinsert
)))
2421 (if (and (tempo-lookup-named 'af
)
2422 (not (string-equal (tempo-lookup-named 'af
) "")))
2425 ;; "eldo expression resistor"
2427 "tempo template for eldo expression resistor"
2431 (tempo-define-template
2432 "spice-eldo-semiconductor-resistor"
2434 (p "[name]: ") '(just-one-space)
2435 (p "[pos node]: ") '(just-one-space)
2436 (p "[neg node]: ") '(just-one-space)
2437 (p "[mname]: " mname
) '(just-one-space)
2438 (p "<res>: " r
'noinsert
)
2439 (if (string-equal (tempo-lookup-named 'r
) "")
2440 () (list 'l
"R=" '(s r
)))
2442 (p "<length>: " l
'noinsert
)
2443 (if (string-equal (tempo-lookup-named 'l
) "")
2444 () (list 'l
"L=" '(s l
)))
2446 (p "<contact offset length>: " cl
'noinsert
)
2447 (if (string-equal (tempo-lookup-named 'cl
) "")
2448 () (list 'l
"CL=" '(s cl
)))
2450 (p "<width>: " w
'noinsert
)
2451 (if (string-equal (tempo-lookup-named 'w
) "")
2452 () (list 'l
"W=" '(s w
)))
2454 (p "<contact offset width>: " cw
'noinsert
)
2455 (if (string-equal (tempo-lookup-named 'cw
) "")
2456 () (list 'l
"CW=" '(s cw
)))
2458 (p "<area>: " area
'noinsert
)
2459 (if (string-equal (tempo-lookup-named 'area
) "")
2460 () (list 'l
"AREA=" '(s area
)))
2462 (p "<init cond (voltage, voltage)>: " ic
'noinsert
)
2463 (if (string-equal (tempo-lookup-named 'ic
) "")
2464 () (list 'l
"IC=" '(s ic
)))
2467 ;; "eldo semiconductor resistor"
2469 "tempo template for eldo semiconductor resistor"
2473 (tempo-define-template
2474 "spice-hspice-resistor"
2476 (p "[name]: ") '(just-one-space)
2477 (p "[pos node]: ") '(just-one-space)
2478 (p "[neg node]: ") '(just-one-space)
2479 (p "<mname>: " mname
) '(just-one-space)
2480 (if (string-equal (tempo-lookup-named 'mname
) "")
2481 (list 'l
"R=" '(p "[val]: "))
2482 (list 'l
'(p "<val>: " val
'noinsert
)
2483 '(if (not (string-equal (tempo-lookup-named 'val
) ""))
2484 (list 'l
"R=" '(s val
))))) '(just-one-space)
2485 (p "<temp coef 1>: " tc1
'noinsert
)
2486 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
2487 (list 'l
"TC1=" '(s tc1
) '(p "<temp coef 2>: " tc2
'noinsert
)))
2489 (if (and (tempo-lookup-named 'tc2
)
2490 (not (string-equal (tempo-lookup-named 'tc2
) "")))
2491 (list 'l
"TC2=" '(s tc2
)))
2493 (p "<scale>: " scale
'noinsert
)
2494 (if (string-equal (tempo-lookup-named 'scale
) "")
2495 () (list 'l
"SCALE=" '(s scale
)))
2497 (p "<m>: " m
'noinsert
)
2498 (if (string-equal (tempo-lookup-named 'm
) "")
2499 () (list 'l
"M=" '(s m
)))
2501 (p "<ac resistance>: " ac
'noinsert
)
2502 (if (string-equal (tempo-lookup-named 'ac
) "")
2503 () (list 'l
"AC=" '(s ac
)))
2505 (p "<diff temp>: " dtemp
'noinsert
)
2506 (if (string-equal (tempo-lookup-named 'dtemp
) "")
2507 () (list 'l
"DTEMP=" '(s dtemp
)))
2509 (p "<length>: " l
'noinsert
)
2510 (if (string-equal (tempo-lookup-named 'l
) "")
2511 () (list 'l
"L=" '(s l
)))
2513 (p "<width>: " w
'noinsert
)
2514 (if (string-equal (tempo-lookup-named 'w
) "")
2515 () (list 'l
"W=" '(s w
)))
2517 (p "<cap>: " c
'noinsert
)
2518 (if (string-equal (tempo-lookup-named 'c
) "")
2519 () (list 'l
"C=" '(s c
)))
2522 ;; "hspice resistor"
2524 "template for hspice resistor tempo templates"
2528 (tempo-define-template
2529 "spice-layla-resistor"
2531 (p "[name]: ") '(just-one-space)
2532 (p "[pos node]: ") '(just-one-space)
2533 (p "[neg node]: ") '(just-one-space)
2534 ; (p "<mname>: ") '(just-one-space)
2535 (p "[value]: ") '(just-one-space)
2536 (p "<width>: " w
'noinsert
)
2537 (if (string-equal (tempo-lookup-named 'w
) "")
2538 () (list 'l
"width=" '(s w
)))
2541 (p "[type (no quotes)]: ") "\""
2543 (p "<symmetry (no quotes)>: " symmetry
'noinsert
)
2544 (if (string-equal (tempo-lookup-named 'symmetry
) "")
2545 () (list 'l
"symmetry=\"" '(s symmetry
) "\""))
2547 (p "<matching (no quotes)>: " matching
'noinsert
)
2548 (if (string-equal (tempo-lookup-named 'matching
) "")
2549 () (list 'l
"matching=\"" '(s matching
) "\""))
2551 (p "<couple>: " couple
'noinsert
)
2552 (if (string-equal (tempo-lookup-named 'couple
) "")
2553 () (list 'l
"couple=" '(s couple
)))
2555 (p "<array (no quotes)>: " array
'noinsert
)
2556 (if (string-equal (tempo-lookup-named 'array
) "")
2557 () (list 'l
"array=\"" '(s array
) "\""))
2559 (p "<orientations (no quotes)>: " orientations
'noinsert
)
2560 (if (string-equal (tempo-lookup-named 'orientations
) "")
2561 () (list 'l
"orientations=\"" '(s orientations
) "\""))
2563 (p "<unit_value>: " unit_value
'noinsert
)
2564 (if (string-equal (tempo-lookup-named 'unit_value
) "")
2565 () (list 'l
"unit_value=" '(s unit_value
)))
2567 (p "<current>: " current
'noinsert
)
2568 (if (string-equal (tempo-lookup-named 'current
) "")
2569 () (list 'l
"current=" '(s current
)))
2571 (p "<power>: " power
'noinsert
)
2572 (if (string-equal (tempo-lookup-named 'power
) "")
2573 () (list 'l
"power=" '(s power
)))
2575 (p "<min_ar>: " min_ar
'noinsert
)
2576 (if (string-equal (tempo-lookup-named 'min_ar
) "")
2577 () (list 'l
"min_ar=" '(s min_ar
)))
2579 (p "<max_ar>: " max_ar
'noinsert
)
2580 (if (string-equal (tempo-lookup-named 'max_ar
) "")
2581 () (list 'l
"max_ar=" '(s max_ar
)))
2583 (p "<routing_space>: " routing_space
'noinsert
)
2584 (if (string-equal (tempo-lookup-named 'routing_space
) "")
2585 () (list 'l
"routing_space=" '(s routing_space
)))
2590 "tempo template for layla resistor"
2595 (tempo-define-template
2596 "spice-spice2g6-capacitor"
2598 (p "[name]: ") '(just-one-space)
2599 (p "[pos node]: ") '(just-one-space)
2600 (p "[neg node]: ") '(just-one-space)
2601 (p "[val]: ") '(just-one-space)
2602 (p "<initial cond (voltage)>: " ic
'noinsert
)
2603 (if (string-equal (tempo-lookup-named 'ic
) "")
2604 () (list 'l
"ic=" '(s ic
)))
2606 ;; "spice2g6 capacitor"
2608 "tempo template for spice2g6 capacitor"
2612 (tempo-define-template
2613 "spice-spice3-semiconductor-capacitor"
2615 (p "[name]: ") '(just-one-space)
2616 (p "[pos node]: ") '(just-one-space)
2617 (p "[neg node]: ") '(just-one-space)
2618 (p "<value>: " value
) '(just-one-space)
2619 (p "<mname>: " mname
) '(just-one-space)
2620 (p "<length>: " l
'noinsert
)
2621 (if (string-equal (tempo-lookup-named 'l
) "")
2622 () (list 'l
"L=" '(s l
)))
2624 (p "<width>: " w
'noinsert
)
2625 (if (string-equal (tempo-lookup-named 'w
) "")
2626 () (list 'l
"W=" '(s w
)))
2628 (p "<initial conditions (Voltage)>: " ic
'noinsert
)
2629 (if (string-equal (tempo-lookup-named 'ic
) "")
2630 () (list 'l
"IC=" '(s ic
)))
2633 ;; "spice3 semiconductor capacitor"
2635 "tempo template for spice3 semiconductor capacitor"
2639 (tempo-define-template
2640 "spice-eldo-capacitor"
2642 (p "[name]: ") '(just-one-space)
2643 (p "[pos node]: ") '(just-one-space)
2644 (p "[neg node]: ") '(just-one-space)
2645 (p "<mname | POLY>: " mname
) '(just-one-space)
2646 (if (string-equal (tempo-lookup-named 'mname
) "POLY")
2647 (list 'l
'(p "[val and poly coefficients]: "))
2648 (list 'l
'(p "[val]: ")))
2650 (p "<m>: " m
'noinsert
)
2651 (if (string-equal (tempo-lookup-named 'm
) "")
2652 () (list 'l
"M=" '(s m
)))
2654 (p "<length>: " l
'noinsert
)
2655 (if (string-equal (tempo-lookup-named 'l
) "")
2656 () (list 'l
"L=" '(s l
)))
2658 (p "<width>: " w
'noinsert
)
2659 (if (string-equal (tempo-lookup-named 'w
) "")
2660 () (list 'l
"W=" '(s w
)))
2662 (p "<diff temp>: " dtemp
'noinsert
)
2663 (if (string-equal (tempo-lookup-named 'dtemp
) "")
2664 () (list 'l
"DTEMP=" '(s dtemp
)))
2666 (p "<temp coef 1>: " tc1
'noinsert
)
2667 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
2668 (list 'l
"TC1=" '(s tc1
) '(p "<temp coef 2>: " tc2
'noinsert
)))
2670 (if (and (tempo-lookup-named 'tc2
)
2671 (not (string-equal (tempo-lookup-named 'tc2
) "")))
2672 (list 'l
"TC2=" '(s tc2
)))
2674 (p "<initial cond (voltage)>: " ic
'noinsert
)
2675 (if (string-equal (tempo-lookup-named 'ic
) "")
2676 () (list 'l
"IC=" '(s ic
)))
2680 "tempo template for eldo capacitor"
2684 (tempo-define-template
2685 "spice-eldo-expression-capacitor"
2687 (p "[name]: ") '(just-one-space)
2688 (p "[pos node]: ") '(just-one-space)
2689 (p "[neg node]: ") '(just-one-space)
2690 (p "<temp coef 1>: " tc1
'noinsert
)
2691 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
2692 (list 'l
"TC1=" '(s tc1
)))
2694 (p "<temp coef 2>: " tc2
'noinsert
)
2695 (if (string-equal (tempo-lookup-named 'tc2
) "") ()
2696 (list 'l
"TC2=" '(s tc2
)))
2698 (p "<temp coef 3>: " tc3
'noinsert
)
2699 (if (string-equal (tempo-lookup-named 'tc3
) "") ()
2700 (list 'l
"TC3=" '(s tc3
)))
2703 (p "[val enter expression without {}]: ")
2706 ;; "eldo expression capacitor"
2708 "tempo template for eldo expression capacitor"
2712 (tempo-define-template
2713 "spice-hspice-capacitor"
2715 (p "[name]: ") '(just-one-space)
2716 (p "[pos node]: ") '(just-one-space)
2717 (p "[neg node]: ") '(just-one-space)
2718 (p "<mname | POLY>: " mname
) '(just-one-space)
2719 (if (string-equal (tempo-lookup-named 'mname
) "POLY")
2720 (list 'l
'(p "[val and poly coefficients]: " val
))
2721 (if (string-equal (tempo-lookup-named 'mname
) "")
2722 (list 'l
"C=" '(p "[val or expression]: " val
))
2723 (list 'l
"C=" '(p "[val]: " val
))))
2725 (if (and (not (string-equal (tempo-lookup-named 'mname
) "POLY"))
2726 (char-equal (string-to-char (tempo-lookup-named 'val
))
2727 (string-to-char "'")))
2728 (list 'l
'(p "<ctype>: " ctype
'noinsert
)))
2729 (if (and (tempo-lookup-named 'ctype
)
2730 (not (string-equal (tempo-lookup-named 'ctype
) "")))
2731 (list 'l
"CTYPE=" '(s ctype
)))
2733 (p "<temp coef 1>: " tc1
'noinsert
)
2734 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
2735 (list 'l
"TC1=" '(s tc1
) '(p "<temp coef 2>: " tc2
'noinsert
)))
2737 (if (and (tempo-lookup-named 'tc2
)
2738 (not (string-equal (tempo-lookup-named 'tc2
) "")))
2739 (list 'l
"TC2=" '(s tc2
)))
2741 (p "<scale>: " scale
'noinsert
)
2742 (if (string-equal (tempo-lookup-named 'scale
) "")
2743 () (list 'l
"SCALE=" '(s scale
)))
2745 (p "<initial cond (voltage)>: " ic
'noinsert
)
2746 (if (string-equal (tempo-lookup-named 'ic
) "")
2747 () (list 'l
"IC=" '(s ic
)))
2749 (p "<m>: " m
'noinsert
)
2750 (if (string-equal (tempo-lookup-named 'm
) "")
2751 () (list 'l
"M=" '(s m
)))
2753 (p "<width>: " w
'noinsert
)
2754 (if (string-equal (tempo-lookup-named 'w
) "")
2755 () (list 'l
"W=" '(s w
)))
2757 (p "<length>: " l
'noinsert
)
2758 (if (string-equal (tempo-lookup-named 'l
) "")
2759 () (list 'l
"L=" '(s l
)))
2761 (p "<diff temp>: " dtemp
'noinsert
)
2762 (if (string-equal (tempo-lookup-named 'dtemp
) "")
2763 () (list 'l
"DTEMP=" '(s dtemp
)))
2766 ;; "hspice capacitor"
2768 "tempo template for hspice capacitor"
2772 (tempo-define-template
2773 "spice-layla-capacitor"
2775 (p "[name]: ") '(just-one-space)
2776 (p "[pos node]: ") '(just-one-space)
2777 (p "[neg node]: ") '(just-one-space)
2778 (p "[value]: ") '(just-one-space)
2779 (p "<units_ver>: " units_ver
'noinsert
)
2780 (if (string-equal (tempo-lookup-named 'units_ver
) "")
2781 () (list 'l
"units_ver=" '(s units_ver
)))
2783 (p "<units_hor>: " units_hor
'noinsert
)
2784 (if (string-equal (tempo-lookup-named 'units_hor
) "")
2785 () (list 'l
"units_hor=" '(s units_hor
)))
2788 (p "[type (no quotes)]: ") "\""
2790 (p "<symmetry (no quotes)>: " symmetry
'noinsert
)
2791 (if (string-equal (tempo-lookup-named 'symmetry
) "")
2792 () (list 'l
"symmetry=\"" '(s symmetry
) "\""))
2794 (p "<matching (no quotes)>: " matching
'noinsert
)
2795 (if (string-equal (tempo-lookup-named 'matching
) "")
2796 () (list 'l
"matching=\"" '(s matching
) "\""))
2798 (p "<couple>: " couple
'noinsert
)
2799 (if (string-equal (tempo-lookup-named 'couple
) "")
2800 () (list 'l
"couple=" '(s couple
)))
2802 (p "<array (no quotes)>: " array
'noinsert
)
2803 (if (string-equal (tempo-lookup-named 'array
) "")
2804 () (list 'l
"array=\"" '(s array
) "\""))
2806 (p "<orientations (no quotes)>: " orientations
'noinsert
)
2807 (if (string-equal (tempo-lookup-named 'orientations
) "")
2808 () (list 'l
"orientations=\"" '(s orientations
) "\""))
2810 (p "<unit_value>: " unit_value
'noinsert
)
2811 (if (string-equal (tempo-lookup-named 'unit_value
) "")
2812 () (list 'l
"unit_value=" '(s unit_value
)))
2814 (p "<power>: " power
'noinsert
)
2815 (if (string-equal (tempo-lookup-named 'power
) "")
2816 () (list 'l
"power=" '(s power
)))
2818 (p "<min_ar>: " min_ar
'noinsert
)
2819 (if (string-equal (tempo-lookup-named 'min_ar
) "")
2820 () (list 'l
"min_ar=" '(s min_ar
)))
2822 (p "<max_ar>: " max_ar
'noinsert
)
2823 (if (string-equal (tempo-lookup-named 'max_ar
) "")
2824 () (list 'l
"max_ar=" '(s max_ar
)))
2826 (p "<routing_space>: " routing_space
'noinsert
)
2827 (if (string-equal (tempo-lookup-named 'routing_space
) "")
2828 () (list 'l
"routing_space=" '(s routing_space
)))
2831 ;; "layla capacitor"
2833 "tempo template for layla capacitor"
2838 (tempo-define-template
2839 "spice-spice2g6-inductor"
2841 (p "[name]: ") '(just-one-space)
2842 (p "[pos node]: ") '(just-one-space)
2843 (p "[neg node]: ") '(just-one-space)
2844 (p "[val]: ") '(just-one-space)
2845 (p "<initial cond (current)>: " ic
'noinsert
)
2846 (if (string-equal (tempo-lookup-named 'ic
) "")
2847 () (list 'l
"ic=" '(s ic
)))
2849 ;; "spice2g6 inductor"
2851 "tempo template for spice2g6 inductor"
2855 (tempo-define-template
2856 "spice-eldo-inductor"
2858 (p "[name]: ") '(just-one-space)
2859 (p "[pos node]: ") '(just-one-space)
2860 (p "[neg node]: ") '(just-one-space)
2861 (p "<mname | POLY>: " mname
) '(just-one-space)
2862 (if (string-equal (tempo-lookup-named 'mname
) "POLY")
2863 (list 'l
'(p "[val and poly coefficients]: "))
2864 (list 'l
'(p "[val]: ")))
2866 (p "<initial cond (current)>: " ic
'noinsert
)
2867 (if (string-equal (tempo-lookup-named 'ic
) "")
2868 () (list 'l
"ic=" '(s ic
)))
2872 "tempo template for eldo inductor"
2876 (tempo-define-template
2877 "spice-eldo-expression-inductor"
2879 (p "[name]: ") '(just-one-space)
2880 (p "[pos node]: ") '(just-one-space)
2881 (p "[neg node]: ") '(just-one-space)
2883 (p "[val enter expression without {}]: ")
2886 ;; "eldo expression inductor"
2888 "tempo template for eldo expression inductor"
2892 (tempo-define-template
2893 "spice-hspice-inductor"
2895 (p "[name]: ") '(just-one-space)
2896 (p "[pos node]: ") '(just-one-space)
2897 (p "[neg node]: ") '(just-one-space)
2898 (p "<POLY | NT>: " poly
'noinsert
) '(just-one-space)
2899 (cond ((string-equal (tempo-lookup-named 'poly
) "POLY")
2900 (list 'l
"POLY " '(p "[value and coefficients]: ")))
2901 ((string-equal (tempo-lookup-named 'poly
) "NT")
2902 (list 'l
"NT=" '(p "[number of turns]: " nt
)))
2904 (list 'l
"L=" '(p "[value or expression]: " val
)))
2907 (if (and (tempo-lookup-named 'val
)
2908 (char-equal (string-to-char (tempo-lookup-named 'val
))
2909 (string-to-char "'")))
2910 (list 'l
'(p "<ltype>: " ltype
'noinsert
)))
2911 (if (and (tempo-lookup-named 'ltype
)
2912 (not (string-equal (tempo-lookup-named 'ltype
) "")))
2913 (list 'l
"LTYPE=" '(s ltype
)))
2915 (p "<temp coef 1>: " tc1
'noinsert
)
2916 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
2917 (list 'l
"TC1=" '(s tc1
) '(p "<temp coef 2>: " tc2
'noinsert
)))
2919 (if (and (tempo-lookup-named 'tc2
)
2920 (not (string-equal (tempo-lookup-named 'tc2
) "")))
2921 (list 'l
"TC2=" '(s tc2
)))
2923 (p "<scale>: " scale
'noinsert
)
2924 (if (string-equal (tempo-lookup-named 'scale
) "")
2925 () (list 'l
"SCALE=" '(s scale
)))
2927 (p "<initial cond (current)>: " ic
'noinsert
)
2928 (if (string-equal (tempo-lookup-named 'ic
) "")
2929 () (list 'l
"IC=" '(s ic
)))
2931 (p "<m>: " m
'noinsert
)
2932 (if (string-equal (tempo-lookup-named 'm
) "")
2933 () (list 'l
"M=" '(s m
)))
2935 (p "<diff temp>: " dtemp
'noinsert
)
2936 (if (string-equal (tempo-lookup-named 'dtemp
) "")
2937 () (list 'l
"DTEMP=" '(s dtemp
)))
2939 (p "<res>: " r
'noinsert
)
2940 (if (string-equal (tempo-lookup-named 'r
) "")
2941 () (list 'l
"R=" '(s r
)))
2944 ;; "hspice inductor"
2946 "tempo template for hspice inductor"
2950 (tempo-define-template
2951 "spice-layla-inductor"
2953 (p "[name]: ") '(just-one-space)
2954 (p "[pos node]: ") '(just-one-space)
2955 (p "[neg node]: ") '(just-one-space)
2956 (p "<value>: ") '(just-one-space)
2957 (p "<outer radius>: " radius
'noinsert
)
2958 (if (string-equal (tempo-lookup-named 'radius
) "")
2959 () (list 'l
"radius=" '(s radius
)))
2961 (p "<width>: " w
'noinsert
)
2962 (if (string-equal (tempo-lookup-named 'w
) "")
2963 () (list 'l
"w=" '(s w
)))
2965 (p "<number of turns>: " n
'noinsert
)
2966 (if (string-equal (tempo-lookup-named 'n
) "")
2967 () (list 'l
"n=" '(s n
)))
2969 (p "<space>: " space
'noinsert
)
2970 (if (string-equal (tempo-lookup-named 'space
) "")
2971 () (list 'l
"space=" '(s space
)))
2973 (p "<end_fraction [0-1]>: " end_fraction
'noinsert
)
2974 (if (string-equal (tempo-lookup-named 'end_fraction
) "")
2975 () (list 'l
"end_fraction=" '(s end_fraction
)))
2978 (p "[type (no quotes)]: ") "\""
2980 (p "<symmetry (no quotes)>: " symmetry
'noinsert
)
2981 (if (string-equal (tempo-lookup-named 'symmetry
) "")
2982 () (list 'l
"symmetry=\"" '(s symmetry
) "\""))
2984 (p "<matching (no quotes)>: " matching
'noinsert
)
2985 (if (string-equal (tempo-lookup-named 'matching
) "")
2986 () (list 'l
"matching=\"" '(s matching
) "\""))
2988 (p "<couple>: " couple
'noinsert
)
2989 (if (string-equal (tempo-lookup-named 'couple
) "")
2990 () (list 'l
"couple=" '(s couple
)))
2992 (p "<array (no quotes)>: " array
'noinsert
)
2993 (if (string-equal (tempo-lookup-named 'array
) "")
2994 () (list 'l
"array=\"" '(s array
) "\""))
2996 (p "<orientations (no quotes)>: " orientations
'noinsert
)
2997 (if (string-equal (tempo-lookup-named 'orientations
) "")
2998 () (list 'l
"orientations=\"" '(s orientations
) "\""))
3000 (p "<power>: " power
'noinsert
)
3001 (if (string-equal (tempo-lookup-named 'power
) "")
3002 () (list 'l
"power=" '(s power
)))
3004 (p "<min_ar>: " min_ar
'noinsert
)
3005 (if (string-equal (tempo-lookup-named 'min_ar
) "")
3006 () (list 'l
"min_ar=" '(s min_ar
)))
3008 (p "<max_ar>: " max_ar
'noinsert
)
3009 (if (string-equal (tempo-lookup-named 'max_ar
) "")
3010 () (list 'l
"max_ar=" '(s max_ar
)))
3012 (p "<routing_space>: " routing_space
'noinsert
)
3013 (if (string-equal (tempo-lookup-named 'routing_space
) "")
3014 () (list 'l
"routing_space=" '(s routing_space
)))
3019 "tempo template for layla inductor"
3023 ;; coupled inductors
3024 (tempo-define-template
3025 "spice-spice2g6-coupled-inductors"
3027 (p "[name]: ") '(just-one-space)
3028 (p "[first inductor]: ") '(just-one-space)
3029 (p "[second inductor]: ") '(just-one-space)
3030 (p "[coupling coefficient]: ")
3032 ;; "spice2g6 inductor coupling"
3034 "tempo template for spice2g6 coupled inductors"
3038 ;; lossless transmission lines
3039 (tempo-define-template
3040 "spice-spice2g6-lossless-transmission"
3042 (p "[name]: ") '(just-one-space)
3043 (p "[out port1]: ") '(just-one-space)
3044 (p "[ref port1]: ") '(just-one-space)
3045 (p "[out port2]: ") '(just-one-space)
3046 (p "[ref port2]: ") '(just-one-space)
3047 "Z0=" (p "[char impedance]: ") '(just-one-space)
3048 (p "<time delay in seconds>: " td
'noinsert
)
3049 (if (string-equal (tempo-lookup-named 'td
) "")
3050 (list 'l
'(p "<freq>: " freq
'noinsert
)) (list 'l
"td=" '(s td
)))
3052 (if (and (tempo-lookup-named 'freq
)
3053 (not (string-equal (tempo-lookup-named 'freq
) "")))
3054 (list 'l
"f=" '(s freq
) '(p "<normalized length [0.25]>: " nrmlen
'noinsert
)))
3056 (if (and (tempo-lookup-named 'nrmlen
)
3057 (not (string-equal (tempo-lookup-named 'nrmlen
) "")))
3058 (list 'l
"nl=" '(s nrmlen
)))
3060 (p "<initial cond (voltage port1, current port1, voltage port2, current port2)>: " ic
'noinsert
)
3061 (if (string-equal (tempo-lookup-named 'ic
) "")
3062 () (list 'l
"ic=" '(s ic
)))
3064 ;;"spice2g6 lossless transmission line"
3066 "tempo template for spice2g6 lossless transmission line"
3070 (tempo-define-template
3071 "spice-hspice-lossless-transmission"
3073 (p "[name]: ") '(just-one-space)
3074 (p "[out port1]: ") '(just-one-space)
3075 (p "[ref port1]: ") '(just-one-space)
3076 (p "[out port2]: ") '(just-one-space)
3077 (p "[ref port2]: ") '(just-one-space)
3078 "Z0=" (p "[char impedance]: ") '(just-one-space)
3079 (p "<time delay in seconds per meter>: " td
'noinsert
)
3080 (if (string-equal (tempo-lookup-named 'td
) "")
3081 (list 'l
'(p "<freq>: " freq
'noinsert
))
3082 (list 'l
"td=" '(s td
) '(p "<length [1m]>: " l
'noinsert
)))
3084 (if (and (tempo-lookup-named 'l
)
3085 (not (string-equal (tempo-lookup-named 'l
) "")))
3086 (list 'l
"l=" '(s l
)))
3088 (if (and (tempo-lookup-named 'freq
)
3089 (not (string-equal (tempo-lookup-named 'freq
) "")))
3090 (list 'l
"f=" '(s freq
) '(p "<normalized length [0.25]>: " nrmlen
'noinsert
)))
3092 (if (and (tempo-lookup-named 'nrmlen
)
3093 (not (string-equal (tempo-lookup-named 'nrmlen
) "")))
3094 (list 'l
"nl=" '(s nrmlen
)))
3096 (p "<initial cond (voltage port1, current port1, voltage port2, current port2)>: " ic
'noinsert
)
3097 (if (string-equal (tempo-lookup-named 'ic
) "")
3098 () (list 'l
"ic=" '(s ic
)))
3100 ;;"hspice lossless transmission line"
3102 "tempo template for hspice lossless transmission line"
3106 ;; lossy transmission lines
3107 (tempo-define-template
3108 "spice-spice2g6-lossy-transmission"
3110 (p "[name]: ") '(just-one-space)
3111 (p "[out port1]: ") '(just-one-space)
3112 (p "[ref port1]: ") '(just-one-space)
3113 (p "[out port2]: ") '(just-one-space)
3114 (p "[ref port2]: ") '(just-one-space)
3115 (p "[mname]: ") '(just-one-space)
3117 ;;"spice2g6 lossy transmission line"
3119 "tempo template for spice2g6 lossy transmission line"
3123 (tempo-define-template
3124 "spice-spice3-rcline"
3126 (p "[name]: ") '(just-one-space)
3127 (p "[in port]: ") '(just-one-space)
3128 (p "[out port]: ") '(just-one-space)
3129 (p "[ref port]: ") '(just-one-space)
3130 (p "[mname]: ") '(just-one-space)
3132 (p "[length (m)]: ") '(just-one-space)
3133 (p "<lumps>: " lumps
'noinsert
)
3134 (if (string-equal (tempo-lookup-named 'lumps
) "")
3135 () (list 'l
"N=" '(s lumps
)))
3138 ;;"spice3 lossy transmission line"
3140 "tempo template for spice2g6 lossy transmission line"
3144 (tempo-define-template
3147 (p "[name]: ") '(just-one-space)
3148 (p "[pos node]: ") '(just-one-space)
3149 (p "[neg node]: ") '(just-one-space)
3150 (p "[mname]: " mname
) '(just-one-space)
3151 (p "<res>: " r
'noinsert
)
3152 (if (string-equal (tempo-lookup-named 'r
) "")
3153 () (list 'l
"R=" '(s r
)))
3155 (p "<temp coef 1>: " tc1
'noinsert
)
3156 (if (string-equal (tempo-lookup-named 'tc1
) "") ()
3157 (list 'l
"TC1=" '(s tc1
) '(p "<temp coef 2>: " tc2
'noinsert
)))
3159 (if (and (tempo-lookup-named 'tc2
)
3160 (not (string-equal (tempo-lookup-named 'tc2
) "")))
3161 (list 'l
"TC2=" '(s tc2
)))
3163 (p "<cap>: " c
'noinsert
)
3164 (if (string-equal (tempo-lookup-named 'c
) "")
3165 () (list 'l
"C=" '(s c
)))
3167 (p "<length>: " l
'noinsert
)
3168 (if (string-equal (tempo-lookup-named 'l
) "")
3169 () (list 'l
"L=" '(s l
)))
3171 (p "<width>: " w
'noinsert
)
3172 (if (string-equal (tempo-lookup-named 'w
) "")
3173 () (list 'l
"W=" '(s w
)))
3175 (p "<m>: " m
'noinsert
)
3176 (if (string-equal (tempo-lookup-named 'm
) "")
3177 () (list 'l
"M=" '(s m
)))
3179 (p "<diff temp>: " dtemp
'noinsert
)
3180 (if (string-equal (tempo-lookup-named 'dtemp
) "")
3181 () (list 'l
"DTEMP=" '(s dtemp
)))
3183 (p "<scale>: " scale
'noinsert
)
3184 (if (string-equal (tempo-lookup-named 'scale
) "")
3185 () (list 'l
"SCALE=" '(s scale
)))
3190 "tempo template for eldo rcline"
3197 (tempo-define-template
3198 "spice-spice2g6-diode"
3200 (p "[name]: ") '(just-one-space)
3201 (p "[positive node]: ") '(just-one-space)
3202 (p "[negative node]: ") '(just-one-space)
3203 (p "[mname]: ") '(just-one-space)
3204 (p "<area>: ") '(just-one-space)
3205 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3206 (if (and (tempo-lookup-named 'off
)
3207 (string-equal (tempo-lookup-named 'off
) "y"))
3210 (p "<initial cond (diode voltage)>: " ic
'noinsert
)
3211 (if (string-equal (tempo-lookup-named 'ic
) "")
3212 () (list 'l
"IC=" '(s ic
)))
3214 (p "<temp>: " temp
'noinsert
)
3215 (if (string-equal (tempo-lookup-named 'temp
) "")
3216 () (list 'l
"TEMP=" '(s temp
)))
3221 "tempo template for spice2g6 diode"
3225 (tempo-define-template
3228 (p "[name]: ") '(just-one-space)
3229 (p "[positive node]: ") '(just-one-space)
3230 (p "[negative node]: ") '(just-one-space)
3231 (p "[mname]: ") '(just-one-space)
3232 (p "<area>: " area
'noinsert
) '(just-one-space)
3233 (if (string-equal (tempo-lookup-named 'area
) "")
3234 () (list 'l
"AREA=" '(s area
)))
3236 (p "<perimeter>: " peri
'noinsert
)
3237 (if (string-equal (tempo-lookup-named 'peri
) "")
3238 () (list 'l
"PERI=" '(s peri
)))
3240 (p "<temp>: " temp
'noinsert
)
3241 (if (string-equal (tempo-lookup-named 'temp
) "")
3242 () (list 'l
"TEMP=" '(s temp
)))
3244 (p "<off [y/n]>: " off
'noinsert
)
3245 (if (and (tempo-lookup-named 'off
)
3246 (string-equal (tempo-lookup-named 'off
) "y"))
3249 (p "<nonoise [y/n]>: " nonoise
'noinsert
)
3250 (if (and (tempo-lookup-named 'nonoise
)
3251 (string-equal (tempo-lookup-named 'nonoise
) "y"))
3252 (list 'l
"NONOISE"))
3257 "tempo template for eldo diode"
3261 (tempo-define-template
3262 "spice-hspice-diode"
3264 (p "[name]: ") '(just-one-space)
3265 (p "[positive node]: ") '(just-one-space)
3266 (p "[negative node]: ") '(just-one-space)
3267 (p "[mname]: ") '(just-one-space)
3268 (p "<area>: " area
'noinsert
) '(just-one-space)
3269 (if (string-equal (tempo-lookup-named 'area
) "")
3270 (list 'l
'(p "<width>: " w
'noinsert
))
3271 (list 'l
"AREA=" '(s area
) '(p "<perimeter>: " peri
'noinsert
)))
3273 (if (and (tempo-lookup-named 'peri
)
3274 (not (string-equal (tempo-lookup-named 'peri
) "")))
3275 (list 'l
"PJ=" '(s peri
)))
3277 (if (string-equal (tempo-lookup-named 'area
) "")
3278 (list 'l
'(p "<length>: " l
'noinsert
)))
3280 (if (and (tempo-lookup-named 'l
)
3281 (not (string-equal (tempo-lookup-named 'l
) "")))
3282 () (list 'l
"L=" '(s l
)))
3284 (p "<width poly cap>: " wp
'noinsert
)
3285 (if (string-equal (tempo-lookup-named 'wp
) "")
3286 () (list 'l
"WP=" '(s wp
)))
3288 (p "<length poly cap>: " lp
'noinsert
)
3289 (if (string-equal (tempo-lookup-named 'lp
) "")
3290 () (list 'l
"LP=" '(s lp
)))
3292 (p "<width metal cap>: " wm
'noinsert
)
3293 (if (string-equal (tempo-lookup-named 'wm
) "")
3294 () (list 'l
"WM=" '(s wm
)))
3296 (p "<length metal cap>: " lm
'noinsert
)
3297 (if (string-equal (tempo-lookup-named 'lm
) "")
3298 () (list 'l
"LM=" '(s lm
)))
3300 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3301 (if (and (tempo-lookup-named 'off
)
3302 (string-equal (tempo-lookup-named 'off
) "y"))
3305 (p "<initial cond (voltage)>: " ic
'noinsert
)
3306 (if (string-equal (tempo-lookup-named 'ic
) "")
3307 () (list 'l
"IC=" '(s ic
)))
3309 (p "<m>: " m
'noinsert
)
3310 (if (string-equal (tempo-lookup-named 'm
) "")
3311 () (list 'l
"M=" '(s m
)))
3313 (p "<diff temp>: " dtemp
'noinsert
)
3314 (if (string-equal (tempo-lookup-named 'dtemp
) "")
3315 () (list 'l
"DTEMP=" '(s dtemp
)))
3320 "tempo template for hspice diode"
3324 (tempo-define-template
3327 (p "[name]: ") '(just-one-space)
3328 (p "[positive node]: ") '(just-one-space)
3329 (p "[negative node]: ") '(just-one-space)
3330 ; (p "<mname>: ") '(just-one-space)
3331 (p "[area]: ") '(just-one-space)
3332 (p "<units_ver>: " units_ver
'noinsert
)
3333 (if (string-equal (tempo-lookup-named 'units_ver
) "")
3334 () (list 'l
"units_ver=" '(s units_ver
)))
3336 (p "<units_hor>: " units_hor
'noinsert
)
3337 (if (string-equal (tempo-lookup-named 'units_hor
) "")
3338 () (list 'l
"units_hor=" '(s units_hor
)))
3341 (p "[type (no quotes)]: ") "\""
3343 (p "<symmetry (no quotes)>: " symmetry
'noinsert
)
3344 (if (string-equal (tempo-lookup-named 'symmetry
) "")
3345 () (list 'l
"symmetry=\"" '(s symmetry
) "\""))
3347 (p "<matching (no quotes)>: " matching
'noinsert
)
3348 (if (string-equal (tempo-lookup-named 'matching
) "")
3349 () (list 'l
"matching=\"" '(s matching
) "\""))
3351 (p "<couple>: " couple
'noinsert
)
3352 (if (string-equal (tempo-lookup-named 'couple
) "")
3353 () (list 'l
"couple=" '(s couple
)))
3355 (p "<array (no quotes)>: " array
'noinsert
)
3356 (if (string-equal (tempo-lookup-named 'array
) "")
3357 () (list 'l
"array=\"" '(s array
) "\""))
3359 (p "<orientations (no quotes)>: " orientations
'noinsert
)
3360 (if (string-equal (tempo-lookup-named 'orientations
) "")
3361 () (list 'l
"orientations=\"" '(s orientations
) "\""))
3363 (p "<unit_value>: " unit_value
'noinsert
)
3364 (if (string-equal (tempo-lookup-named 'unit_value
) "")
3365 () (list 'l
"unit_value=" '(s unit_value
)))
3367 (p "<current>: " current
'noinsert
)
3368 (if (string-equal (tempo-lookup-named 'current
) "")
3369 () (list 'l
"current=" '(s current
)))
3371 (p "<power>: " power
'noinsert
)
3372 (if (string-equal (tempo-lookup-named 'power
) "")
3373 () (list 'l
"power=" '(s power
)))
3375 (p "<min_ar>: " min_ar
'noinsert
)
3376 (if (string-equal (tempo-lookup-named 'min_ar
) "")
3377 () (list 'l
"min_ar=" '(s min_ar
)))
3379 (p "<max_ar>: " max_ar
'noinsert
)
3380 (if (string-equal (tempo-lookup-named 'max_ar
) "")
3381 () (list 'l
"max_ar=" '(s max_ar
)))
3383 (p "<routing_space>: " routing_space
'noinsert
)
3384 (if (string-equal (tempo-lookup-named 'routing_space
) "")
3385 () (list 'l
"routing_space=" '(s routing_space
)))
3390 "tempo template for layla diode"
3395 (tempo-define-template
3396 "spice-spice2g6-bipolar"
3398 (p "[name]: ") '(just-one-space)
3399 (p "[collector node]: ") '(just-one-space)
3400 (p "[base node]: ") '(just-one-space)
3401 (p "[emitter node]: ") '(just-one-space)
3402 (p "<substrate node>: ") '(just-one-space)
3403 (p "[mname]: ") '(just-one-space)
3404 (p "<area>: ") '(just-one-space)
3405 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3406 (if (and (tempo-lookup-named 'off
)
3407 (string-equal (tempo-lookup-named 'off
) "y"))
3410 (p "<initial cond (vbe, vce)>: " ic
'noinsert
)
3411 (if (string-equal (tempo-lookup-named 'ic
) "")
3412 () (list 'l
"IC=" '(s ic
)))
3414 (p "<temp>: " temp
'noinsert
)
3415 (if (string-equal (tempo-lookup-named 'temp
) "")
3416 () (list 'l
"TEMP=" '(s temp
)))
3419 ;;"spice2g6 bipolar"
3421 "tempo template for spice2g6 bipolar"
3425 (tempo-define-template
3426 "spice-eldo-bipolar"
3428 (p "[name]: ") '(just-one-space)
3429 (p "[collector node]: ") '(just-one-space)
3430 (p "[base node]: ") '(just-one-space)
3431 (p "[emitter node]: ") '(just-one-space)
3432 (p "<substrate node>: ") '(just-one-space)
3433 (p "[mname]: ") '(just-one-space)
3434 (p "<area>: " area
'noinsert
) '(just-one-space)
3435 (if (string-equal (tempo-lookup-named 'area
) "")
3436 () (list 'l
"AREA=" '(s area
)))
3438 (p "<rel base area>: " areab
'noinsert
)
3439 (if (string-equal (tempo-lookup-named 'areab
) "")
3440 () (list 'l
"AREAB=" '(s areab
)))
3442 (p "<rel collector area>: " areac
'noinsert
)
3443 (if (string-equal (tempo-lookup-named 'areac
) "")
3444 () (list 'l
"AREAC=" '(s areac
)))
3446 (p "<temp>: " temp
'noinsert
)
3447 (if (string-equal (tempo-lookup-named 'temp
) "")
3448 () (list 'l
"T=" '(s temp
)))
3450 (p "<m>: " m
'noinsert
)
3451 (if (string-equal (tempo-lookup-named 'm
) "")
3452 () (list 'l
"M=" '(s m
)))
3454 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3455 (if (and (tempo-lookup-named 'off
)
3456 (string-equal (tempo-lookup-named 'off
) "y"))
3459 (p "<nonoise [y/n]>: " nonoise
'noinsert
)
3460 (if (and (tempo-lookup-named 'nonoise
)
3461 (string-equal (tempo-lookup-named 'nonoise
) "y"))
3462 (list 'l
"NONOISE"))
3467 "tempo template for eldo bipolar"
3471 (tempo-define-template
3472 "spice-hspice-bipolar"
3474 (p "[name]: ") '(just-one-space)
3475 (p "[collector node]: ") '(just-one-space)
3476 (p "[base node]: ") '(just-one-space)
3477 (p "[emitter node]: ") '(just-one-space)
3478 (p "<substrate node>: ") '(just-one-space)
3479 (p "[mname]: ") '(just-one-space)
3480 (p "<area>: " area
'noinsert
) '(just-one-space)
3481 (if (string-equal (tempo-lookup-named 'area
) "")
3482 () (list 'l
"AREA=" '(s area
)))
3484 (p "<rel base area>: " areab
'noinsert
)
3485 (if (string-equal (tempo-lookup-named 'areab
) "")
3486 () (list 'l
"AREAB=" '(s areab
)))
3488 (p "<rel collector area>: " areac
'noinsert
)
3489 (if (string-equal (tempo-lookup-named 'areac
) "")
3490 () (list 'l
"AREAC=" '(s areac
)))
3492 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3493 (if (and (tempo-lookup-named 'off
)
3494 (string-equal (tempo-lookup-named 'off
) "y"))
3497 (p "<init vbe>: " vbe
'noinsert
)
3498 (if (string-equal (tempo-lookup-named 'vbe
) "")
3499 () (list 'l
"VBE=" '(s vbe
)))
3501 (p "<init vce>: " vce
'noinsert
)
3502 (if (string-equal (tempo-lookup-named 'vce
) "")
3503 () (list 'l
"VCE=" '(s vce
)))
3505 (p "<m>: " m
'noinsert
)
3506 (if (string-equal (tempo-lookup-named 'm
) "")
3507 () (list 'l
"M=" '(s m
)))
3509 (p "<diff temp>: " dtemp
'noinsert
)
3510 (if (string-equal (tempo-lookup-named 'dtemp
) "")
3511 () (list 'l
"DTEMP=" '(s dtemp
)))
3516 "tempo template for hspice bipolar"
3521 (tempo-define-template
3522 "spice-spice2g6-jfet"
3524 (p "[name]: ") '(just-one-space)
3525 (p "[drain node]: ") '(just-one-space)
3526 (p "[gate node]: ") '(just-one-space)
3527 (p "[source node]: ") '(just-one-space)
3528 (p "[mname]: ") '(just-one-space)
3529 (p "<area>: ") '(just-one-space)
3530 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3531 (if (and (tempo-lookup-named 'off
)
3532 (string-equal (tempo-lookup-named 'off
) "y"))
3535 (p "<initial cond (vds, vgs)>: " ic
'noinsert
)
3536 (if (string-equal (tempo-lookup-named 'ic
) "")
3537 () (list 'l
"IC=" '(s ic
)))
3539 (p "<temp>: " temp
'noinsert
)
3540 (if (string-equal (tempo-lookup-named 'temp
) "")
3541 () (list 'l
"TEMP=" '(s temp
)))
3546 "tempo template for spice2g6 jfet"
3550 (tempo-define-template
3553 (p "[name]: ") '(just-one-space)
3554 (p "[drain node]: ") '(just-one-space)
3555 (p "[gate node]: ") '(just-one-space)
3556 (p "[source node]: ") '(just-one-space)
3557 (p "[mname]: ") '(just-one-space)
3558 (p "<area>: " area
'noinsert
) '(just-one-space)
3559 (if (string-equal (tempo-lookup-named 'area
) "")
3560 () (list 'l
"AREA=" '(s area
)))
3562 (p "<length>: " l
'noinsert
)
3563 (if (string-equal (tempo-lookup-named 'l
) "")
3564 () (list 'l
"L=" '(s l
)))
3566 (p "<width>: " w
'noinsert
)
3567 (if (string-equal (tempo-lookup-named 'w
) "")
3568 () (list 'l
"W=" '(s w
)))
3570 (p "<temp>: " temp
'noinsert
)
3571 (if (string-equal (tempo-lookup-named 'temp
) "")
3572 () (list 'l
"T=" '(s temp
)))
3574 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3575 (if (and (tempo-lookup-named 'off
)
3576 (string-equal (tempo-lookup-named 'off
) "y"))
3579 (p "<nonoise [y/n]>: " nonoise
'noinsert
)
3580 (if (and (tempo-lookup-named 'nonoise
)
3581 (string-equal (tempo-lookup-named 'nonoise
) "y"))
3582 (list 'l
"NONOISE"))
3587 "tempo template for eldo jfet"
3591 (tempo-define-template
3594 (p "[name]: ") '(just-one-space)
3595 (p "[drain node]: ") '(just-one-space)
3596 (p "[gate node]: ") '(just-one-space)
3597 (p "[source node]: ") '(just-one-space)
3598 (p "[mname]: ") '(just-one-space)
3599 (p "<area>: " area
'noinsert
)
3600 (if (string-equal (tempo-lookup-named 'area
) "")
3601 (list 'l
'(p "<length>: " l
'noinsert
) '(p "<width>: " w
'noinsert
))
3602 (list 'l
"AREA=" '(s area
)))
3604 (if (and (tempo-lookup-named 'l
)
3605 (not (string-equal (tempo-lookup-named 'l
) "")))
3606 (list 'l
"L=" '(s l
)))
3608 (if (and (tempo-lookup-named 'w
)
3609 (not (string-equal (tempo-lookup-named 'w
) "")))
3610 (list 'l
"W=" '(s w
)))
3612 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3613 (if (and (tempo-lookup-named 'off
)
3614 (string-equal (tempo-lookup-named 'off
) "y"))
3617 (p "<initial cond (vds,vgs)>: " ic
'noinsert
)
3618 (if (string-equal (tempo-lookup-named 'ic
) "")
3619 () (list 'l
"IC=" '(s ic
)))
3621 (p "<m>: " m
'noinsert
)
3622 (if (string-equal (tempo-lookup-named 'm
) "")
3623 () (list 'l
"M=" '(s m
)))
3625 (p "<diff temp>: " dtemp
'noinsert
)
3626 (if (string-equal (tempo-lookup-named 'dtemp
) "")
3627 () (list 'l
"DTEMP=" '(s dtemp
)))
3632 "tempo template for hspice jfet"
3637 (tempo-define-template
3638 "spice-spice2g6-mosfet"
3640 (p "[name]: ") '(just-one-space)
3641 (p "[drain node]: ") '(just-one-space)
3642 (p "[gate node]: ") '(just-one-space)
3643 (p "[source node]: ") '(just-one-space)
3644 (p "[bulk node]: ") '(just-one-space)
3645 (p "[mname]: ") '(just-one-space)
3646 (p "<length>: " l
'noinsert
)
3647 (if (string-equal (tempo-lookup-named 'l
) "")
3648 () (list 'l
"L=" '(s l
)))
3650 (p "<width>: " w
'noinsert
)
3651 (if (string-equal (tempo-lookup-named 'w
) "")
3652 () (list 'l
"W=" '(s w
)))
3654 (p "<area drain>: " ad
'noinsert
)
3655 (if (string-equal (tempo-lookup-named 'ad
) "")
3656 () (list 'l
"AD=" '(s ad
)))
3658 (p "<area source>: " as
'noinsert
)
3659 (if (string-equal (tempo-lookup-named 'as
) "")
3660 () (list 'l
"AS=" '(s as
)))
3662 (p "<perimeter drain>: " pd
'noinsert
)
3663 (if (string-equal (tempo-lookup-named 'pd
) "")
3664 () (list 'l
"PD=" '(s pd
)))
3666 (p "<perimeter source>: " ps
'noinsert
)
3667 (if (string-equal (tempo-lookup-named 'ps
) "")
3668 () (list 'l
"PS=" '(s ps
)))
3670 (p "<number of drain contacts>: " nrd
'noinsert
)
3671 (if (string-equal (tempo-lookup-named 'nrd
) "")
3672 () (list 'l
"NRD=" '(s nrd
)))
3674 (p "<number of source contacts>: " nrs
'noinsert
)
3675 (if (string-equal (tempo-lookup-named 'nrs
) "")
3676 () (list 'l
"NRS=" '(s nrs
)))
3678 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3679 (if (and (tempo-lookup-named 'off
)
3680 (string-equal (tempo-lookup-named 'off
) "y"))
3683 (p "<initial cond (vds, vgs, vgs)>: " ic
'noinsert
)
3684 (if (string-equal (tempo-lookup-named 'ic
) "")
3685 () (list 'l
"IC=" '(s ic
)))
3690 "tempo template for spice2g6 mosfet"
3694 (tempo-define-template
3697 (p "[name]: ") '(just-one-space)
3698 (p "[drain node]: ") '(just-one-space)
3699 (p "[gate node]: ") '(just-one-space)
3700 (p "[source node]: ") '(just-one-space)
3701 (p "[bulk node]: ") '(just-one-space)
3702 (p "<optional nodes>: ") '(just-one-space)
3704 (p "[mname]: ") '(just-one-space)
3705 (p "<length>: " l
'noinsert
)
3706 (if (string-equal (tempo-lookup-named 'l
) "")
3707 () (list 'l
"L=" '(s l
)))
3709 (p "<width>: " w
'noinsert
)
3710 (if (string-equal (tempo-lookup-named 'w
) "")
3711 () (list 'l
"W=" '(s w
)))
3713 (p "<area drain>: " ad
'noinsert
)
3714 (if (string-equal (tempo-lookup-named 'ad
) "")
3715 () (list 'l
"AD=" '(s ad
)))
3717 (p "<area source>: " as
'noinsert
)
3718 (if (string-equal (tempo-lookup-named 'as
) "")
3719 () (list 'l
"AS=" '(s as
)))
3721 (p "<perimeter drain>: " pd
'noinsert
)
3722 (if (string-equal (tempo-lookup-named 'pd
) "")
3723 () (list 'l
"PD=" '(s pd
)))
3725 (p "<perimeter source>: " ps
'noinsert
)
3726 (if (string-equal (tempo-lookup-named 'ps
) "")
3727 () (list 'l
"PS=" '(s ps
)))
3729 (p "<geometry model>: " geo
'noinsert
)
3730 (if (string-equal (tempo-lookup-named 'geo
) "")
3731 () (list 'l
"GEO=" '(s geo
)))
3733 (p "<number of drain contacts>: " nrd
'noinsert
)
3734 (if (string-equal (tempo-lookup-named 'nrd
) "")
3735 () (list 'l
"NRD=" '(s nrd
)))
3737 (p "<number of source contacts>: " nrs
'noinsert
)
3738 (if (string-equal (tempo-lookup-named 'nrs
) "")
3739 () (list 'l
"NRS=" '(s nrs
)))
3741 (p "<m>: " m
'noinsert
)
3742 (if (string-equal (tempo-lookup-named 'm
) "")
3743 () (list 'l
"M=" '(s m
)))
3745 (p "<extra drain contact resistance>: " rdc
'noinsert
)
3746 (if (string-equal (tempo-lookup-named 'rdc
) "")
3747 () (list 'l
"RDC=" '(s rdc
)))
3749 (p "<extra source contact resistance>: " rsc
'noinsert
)
3750 (if (string-equal (tempo-lookup-named 'rsc
) "")
3751 () (list 'l
"RSC=" '(s rsc
)))
3753 (p "<temp>: " temp
'noinsert
)
3754 (if (string-equal (tempo-lookup-named 'temp
) "")
3755 () (list 'l
"T=" '(s temp
)))
3757 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3758 (if (and (tempo-lookup-named 'off
)
3759 (string-equal (tempo-lookup-named 'off
) "y"))
3762 (p "<nonoise [y/n]>: " nonoise
'noinsert
)
3763 (if (and (tempo-lookup-named 'nonoise
)
3764 (string-equal (tempo-lookup-named 'nonoise
) "y"))
3765 (list 'l
"NONOISE"))
3770 "tempo template for eldo mosfet"
3774 (tempo-define-template
3775 "spice-hspice-mosfet"
3777 (p "[name]: ") '(just-one-space)
3778 (p "[drain node]: ") '(just-one-space)
3779 (p "[gate node]: ") '(just-one-space)
3780 (p "[source node]: ") '(just-one-space)
3781 (p "[bulk node]: ") '(just-one-space)
3782 (p "[mname]: ") '(just-one-space)
3783 (p "<length>: " l
'noinsert
)
3784 (if (string-equal (tempo-lookup-named 'l
) "")
3785 () (list 'l
"L=" '(s l
)))
3787 (p "<width>: " w
'noinsert
)
3788 (if (string-equal (tempo-lookup-named 'w
) "")
3789 () (list 'l
"W=" '(s w
)))
3791 (p "<area drain>: " ad
'noinsert
)
3792 (if (string-equal (tempo-lookup-named 'ad
) "")
3793 () (list 'l
"AD=" '(s ad
)))
3795 (p "<area source>: " as
'noinsert
)
3796 (if (string-equal (tempo-lookup-named 'as
) "")
3797 () (list 'l
"AS=" '(s as
)))
3799 (p "<perimeter drain>: " pd
'noinsert
)
3800 (if (string-equal (tempo-lookup-named 'pd
) "")
3801 () (list 'l
"PD=" '(s pd
)))
3803 (p "<perimeter source>: " ps
'noinsert
)
3804 (if (string-equal (tempo-lookup-named 'ps
) "")
3805 () (list 'l
"PS=" '(s ps
)))
3807 (p "<number of drain contacts>: " nrd
'noinsert
)
3808 (if (string-equal (tempo-lookup-named 'nrd
) "")
3809 () (list 'l
"NRD=" '(s nrd
)))
3811 (p "<number of source contacts>: " nrs
'noinsert
)
3812 (if (string-equal (tempo-lookup-named 'nrs
) "")
3813 () (list 'l
"NRS=" '(s nrs
)))
3815 (p "<extra drain contact resistance>: " rdc
'noinsert
)
3816 (if (string-equal (tempo-lookup-named 'rdc
) "")
3817 () (list 'l
"RDC=" '(s rdc
)))
3819 (p "<extra source contact resistance>: " rsc
'noinsert
)
3820 (if (string-equal (tempo-lookup-named 'rsc
) "")
3821 () (list 'l
"RSC=" '(s rsc
)))
3823 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3824 (if (and (tempo-lookup-named 'off
)
3825 (string-equal (tempo-lookup-named 'off
) "y"))
3828 (p "<init cond (vds,vgs,vbs)>: " ic
'noinsert
)
3829 (if (string-equal (tempo-lookup-named 'ic
) "")
3830 () (list 'l
"IC=" '(s ic
)))
3832 (p "<diff temp>: " dtemp
'noinsert
)
3833 (if (string-equal (tempo-lookup-named 'dtemp
) "")
3834 () (list 'l
"DTEMP=" '(s dtemp
)))
3836 (p "<geometry model>: " geo
'noinsert
)
3837 (if (string-equal (tempo-lookup-named 'geo
) "")
3838 () (list 'l
"GEO=" '(s geo
)))
3840 (p "<m>: " m
'noinsert
)
3841 (if (string-equal (tempo-lookup-named 'm
) "")
3842 () (list 'l
"M=" '(s m
)))
3844 (p "<delvto>: " delvto
'noinsert
)
3845 (if (string-equal (tempo-lookup-named 'delvto
) "")
3846 () (list 'l
"DELVTO=" '(s delvto
)))
3851 "tempo template for hspice mosfet"
3855 (tempo-define-template
3856 "spice-layla-mosfet"
3858 (p "[name]: ") '(just-one-space)
3859 (p "[drain node]: ") '(just-one-space)
3860 (p "[gate node]: ") '(just-one-space)
3861 (p "[source node]: ") '(just-one-space)
3862 (p "[bulk node]: ") '(just-one-space)
3863 (p "[mname]: ") '(just-one-space)
3864 (p "<length>: " l
'noinsert
)
3865 (if (string-equal (tempo-lookup-named 'l
) "")
3866 () (list 'l
"L=" '(s l
)))
3868 (p "<width>: " w
'noinsert
)
3869 (if (string-equal (tempo-lookup-named 'w
) "")
3870 () (list 'l
"W=" '(s w
)))
3873 (p "[type (no quotes)]: ") "\""
3875 (p "<symmetry (no quotes)>: " symmetry
'noinsert
)
3876 (if (string-equal (tempo-lookup-named 'symmetry
) "")
3877 () (list 'l
"symmetry=\"" '(s symmetry
) "\""))
3879 (p "<matching (no quotes)>: " matching
'noinsert
)
3880 (if (string-equal (tempo-lookup-named 'matching
) "")
3881 () (list 'l
"matching=\"" '(s matching
) "\""))
3883 (p "<couple>: " couple
'noinsert
)
3884 (if (string-equal (tempo-lookup-named 'couple
) "")
3885 () (list 'l
"couple=" '(s couple
)))
3887 (p "<array (no quotes)>: " array
'noinsert
)
3888 (if (string-equal (tempo-lookup-named 'array
) "")
3889 () (list 'l
"array=\"" '(s array
) "\""))
3891 (p "<orientations (no quotes)>: " orientations
'noinsert
)
3892 (if (string-equal (tempo-lookup-named 'orientations
) "")
3893 () (list 'l
"orientations=\"" '(s orientations
) "\""))
3895 (p "<unit_value>: " unit_value
'noinsert
)
3896 (if (string-equal (tempo-lookup-named 'unit_value
) "")
3897 () (list 'l
"unit_value=" '(s unit_value
)))
3899 (p "<current>: " current
'noinsert
)
3900 (if (string-equal (tempo-lookup-named 'current
) "")
3901 () (list 'l
"current=" '(s current
)))
3903 (p "<power>: " power
'noinsert
)
3904 (if (string-equal (tempo-lookup-named 'power
) "")
3905 () (list 'l
"power=" '(s power
)))
3907 (p "<min_ar>: " min_ar
'noinsert
)
3908 (if (string-equal (tempo-lookup-named 'min_ar
) "")
3909 () (list 'l
"min_ar=" '(s min_ar
)))
3911 (p "<max_ar>: " max_ar
'noinsert
)
3912 (if (string-equal (tempo-lookup-named 'max_ar
) "")
3913 () (list 'l
"max_ar=" '(s max_ar
)))
3915 (p "<routing_space>: " routing_space
'noinsert
)
3916 (if (string-equal (tempo-lookup-named 'routing_space
) "")
3917 () (list 'l
"routing_space=" '(s routing_space
)))
3922 "tempo template for layla mosfet"
3927 (tempo-define-template
3928 "spice-spice2g6-mesfet"
3930 (p "[name]: ") '(just-one-space)
3931 (p "[drain node]: ") '(just-one-space)
3932 (p "[gate node]: ") '(just-one-space)
3933 (p "[source node]: ") '(just-one-space)
3934 (p "[mname]: ") '(just-one-space)
3935 (p "<area>: ") '(just-one-space)
3936 (p "<off [y/n]>: " off
'noinsert
) '(just-one-space)
3937 (if (and (tempo-lookup-named 'off
)
3938 (string-equal (tempo-lookup-named 'off
) "y"))
3941 (p "<initial cond (vds, vgs)>: " ic
'noinsert
)
3942 (if (string-equal (tempo-lookup-named 'ic
) "")
3943 () (list 'l
"IC=" '(s ic
)))
3948 "tempo template for spice2g6 mesfet"
3953 (tempo-define-template
3954 "spice-spice2g6-subckt"
3956 (p "[subckt name]: " lname
) 'r
'n
'n
3957 ".ends " (s lname
) '>)
3959 "template for inserting a subckt definition"
3963 ;; Controlled sources
3967 (tempo-define-template
3968 "spice-spice2g6-vcvs"
3970 (p "[name]: ") '(just-one-space)
3971 (p "[positive node]: ") '(just-one-space)
3972 (p "[negative node]: ") '(just-one-space)
3973 (p "[positive controling node]: ") '(just-one-space)
3974 (p "[negative controling node]: ") '(just-one-space)
3975 (p "[gain]: ") '(just-one-space)
3978 "template for inserting a voltage controled voltage source"
3981 (tempo-define-template
3982 "spice-spice2g6-ccvs"
3984 (p "[name]: ") '(just-one-space)
3985 (p "[positive node]: ") '(just-one-space)
3986 (p "[negative node]: ") '(just-one-space)
3987 (p "[voltage source]: ") '(just-one-space)
3988 (p "[gain]: ") '(just-one-space)
3991 "template for inserting a current controled voltage source"
3997 (tempo-define-template
3998 "spice-spice2g6-vccs"
4000 (p "[name]: ") '(just-one-space)
4001 (p "[positive node]: ") '(just-one-space)
4002 (p "[negative node]: ") '(just-one-space)
4003 (p "[positive controling node]: ") '(just-one-space)
4004 (p "[negative controling node]: ") '(just-one-space)
4005 (p "[transadmitance]: ") '(just-one-space)
4008 "template for inserting a voltage controled current source"
4011 (tempo-define-template
4012 "spice-spice2g6-cccs"
4014 (p "[name]: ") '(just-one-space)
4015 (p "[positive node]: ") '(just-one-space)
4016 (p "[negative node]: ") '(just-one-space)
4017 (p "[voltage source]: ") '(just-one-space)
4018 (p "[gain]: ") '(just-one-space)
4021 "template for inserting a current controled current source"
4027 (tempo-define-template
4030 (p "[start value]: ") " "
4031 (p "[pulsed value]: ") " "
4033 (p "[rise time]: ") " "
4034 (p "[fall time]: ") " "
4035 (p "[pulse duration]: ") " "
4039 "template for inserting an Pulse waveform"
4042 (tempo-define-template
4045 (p "[Offset]: ") " "
4046 (p "[Amplitude]: ") " "
4047 (p "[Frequency]: ") " "
4049 (p "[Damping factor]: ")
4050 (p "[Phase delay]: ") '(just-one-space)
4053 "template for inserting a Sine function"
4056 (tempo-define-template
4059 (p "[start value]: ") " "
4060 (p "[target value]: ") " "
4061 (p "[rise delay]: ") " "
4063 (p "[fall delay]: ") " "
4067 "template for inserting an EXP waveform"
4070 ;;(tempo-define-template
4073 ;; (p "[start time]: ") " "
4074 ;; (p "[start value]: ") " "
4077 ;; "template for inserting an PWL waveform")
4080 (define-skeleton spice-pwl
4081 "Skeleton for Piece Wise Linear waveform"
4082 "Time/value doublet: "
4084 ( "Next doublet: (%s) "
4091 (tempo-define-template
4094 (p "[offset value]: ") " "
4095 (p "[amplitude value]: ") " "
4096 (p "[carrier frequency]: ") " "
4097 (p "[modulation index]: ") " "
4098 (p "[signal frequency]: ")
4101 "template for inserting an HSPICE SFFM waveform"
4104 (tempo-define-template
4107 (p "[signal amplitude]: ") " "
4108 (p "[offset constant]: ") " "
4109 (p "[modulation frequency]: ") " "
4110 (p "[carrier frequency]: ") " "
4111 (p "[delay time]: ")
4114 "template for inserting an HSPICE AM waveform"
4117 (tempo-define-template
4120 (p "[magnitude]: ") " "
4124 "template for inserting an AC waveform"
4127 (tempo-define-template
4128 "spice-eldo-pattern"
4133 (p "[rise time]: ") " "
4134 (p "[fall time]: ") " "
4135 (p "[Bit duration]: ") " "
4139 "template for inserting an ELDO Pattern function"
4142 (tempo-define-template
4145 (p "[White noise level]: ") " "
4146 (p "[Flicker noise level]: ") " "
4148 (p "[Cut-off freq]: ") " "
4149 (p "[Filter order]: ")
4152 "template for inserting an ELDO NOISE waveform"
4155 (tempo-define-template
4156 "spice-eldorf-fpulse"
4158 (p "[initial value]: ") " "
4159 (p "[pulse value]: ") " "
4160 (p "[delay time]: ") " "
4161 (p "[rise time]: ") " "
4162 (p "[fall time]: ") " "
4163 (p "[pulse duration]: ") " "
4164 (p "[FUND1|FUND2|FUND3 (of .sst)]: ")
4167 "template for inserting an Eldo-RF fpulse waveform"
4170 (tempo-define-template
4172 '("four" '(just-one-space)
4174 (p "<FUND2>: " fund2
'noinsert
)
4175 (if (string-equal (tempo-lookup-named 'fund2
) "")
4177 (list 'l
" " '(s fund2
) '(p "<FUND3>: " fund3
'noinsert
)))
4178 (if (string-equal (tempo-lookup-named 'fund3
) "")
4180 (list 'l
" " '(s fund3
)))
4182 (p "[MA|RI|DB|PMA|PDB|PDBM]: ") '(just-one-space)
4185 (p "<int_val2>: " int_val2
'noinsert
)
4186 (if (string-equal (tempo-lookup-named 'int_val2
) "")
4188 (list 'l
"," '(s int_val2
) '(p "<int_val3>: " int_val3
'noinsert
)))
4189 (if (string-equal (tempo-lookup-named 'int_val3
) "")
4191 (list 'l
"," '(s int_val3
)))
4192 ")" '(just-one-space)
4193 (p "[real_val1]: ") '(just-one-space)
4194 (p "[real_val2]: ") '(just-one-space)
4197 "template for inserting an Eldo-RF Fpulse waveform"
4202 (tempo-define-template
4204 '(".EXTRACT AC label=\"Phase margin\" xycond(vp("
4205 (p "[Node]: " lname
)
4206 "),vdb(" (s lname
) ")<0.0)+180 "
4209 "template for extracting the phase margin"
4212 (tempo-define-template
4214 '(".EXTRACT AC label=\"Gain margin\" -xycond(vdb("
4215 (p "[Node]: " lname
)
4216 "),vp(" (s lname
) ")<-180) "
4219 "template for extracting the gain margin"
4222 (tempo-define-template
4224 '(".EXTRACT AC label=\"Cut freq\" xdown(vdb("
4225 (p "[Node]: " lname
)
4226 "),yval(vdb(" (s lname
) "),1)-3) "
4229 "template for extracting the cut frequency"
4232 (tempo-define-template
4234 '(".EXTRACT AC label=\"Unity gain freq\" xdown(vdb("
4235 (p "[Node]: " lname
)
4239 "template for extracting the unity gain frequency"
4242 (tempo-define-template
4244 '(".EXTRACT TRAN xdown(v("
4245 (p "[Node]: " lname
)
4247 (p "[threshold]: " vth
)
4249 (p "[estimation time]: " t
)
4251 "-xdown(v(" (s lname
) "),"(s vth
) ","(s t
) ",start) !period"
4254 "template for extracting the period of a signal"
4257 (tempo-define-template
4258 "spice-eldo-period-macro"
4259 '(".DEFMAC period(a,th,time)=xdown(a,th,time,end)"
4260 "-xdown(a,th,time,start)"
4263 "macro for extracting the period of signal a"
4266 (tempo-define-template
4267 "spice-eldo-duty-macro"
4268 '(".DEFMAC duty_cycle(a,th,time)=(xdown(a,th,time,end)"
4269 "-xup(a,th,time,end))/(xdown(a,th,time,end)-xdown(a,th,time,start))*100"
4272 "macro for extracting the duty cycle of signal a"
4275 (tempo-define-template
4276 "spice-eldo-settling-macro"
4277 '(".DEFMAC settling(xaxis,a,ratio,Tstart,Tfinal)=xycond(xaxis,(a>(yval(a,Tfinal)*(1+ratio)))"
4278 " || (a<(yval(a,Tfinal)*(1-ratio))),Tfinal,Tstart) - Tstart"
4281 "macro for extracting the settling cycle of signal A, within ±ratio of value of A at time Tfinal"
4287 (tempo-define-template
4290 (p "[Instance name]: ") " "
4291 (p "[Positive input]: ") " "
4292 (p "[Negative input]: ") " "
4293 (p "[Output]: ") " "
4294 (p "[Model name]: ") " "
4295 (p "<Vhigh>: " vhi
'noinsert
)
4296 (if (string-equal (tempo-lookup-named 'vhi
) "")
4297 (list 'l
"VHI=5.0") ;; default value
4298 (list 'l
"VHI=" '(s vhi
)))
4300 (p "<Vlow>: " vlo
'noinsert
)
4301 (if (string-equal (tempo-lookup-named 'vlo
) "")
4302 (list 'l
"VLO=0.0") ;; default value
4303 (list 'l
"VLO=" '(s vlo
)))
4305 (p "<Input offset>: " voff
'noinsert
)
4306 (if (string-equal (tempo-lookup-named 'voff
) "")
4307 (list 'l
"VOFF=0.0") ;; default value
4308 (list 'l
"VOFF=" '(s voff
)))
4310 (p "<Hysteresis voltage>: " vdef
'noinsert
)
4311 (if (string-equal (tempo-lookup-named 'vdef
) "")
4312 (list 'l
"VDEF=0.0") ;; default value
4313 (list 'l
"VDEF=" '(s vdef
)))
4315 (p "<Commutation time>: " tcom
'noinsert
)
4316 (if (string-equal (tempo-lookup-named 'tcom
) "")
4317 (list 'l
"TCOM=1ns") ;; default value
4318 (list 'l
"TCOM=" '(s tcom
)))
4320 (p "<Transit time>: " tpd
'noinsert
)
4321 (if (string-equal (tempo-lookup-named 'tpd
) "")
4322 (list 'l
"TPD=0.0") ;; default value
4323 (list 'l
"TPD=" '(s tpd
)))
4327 "template for inserting an ELDO Single output comparator"
4330 (tempo-define-template
4333 (p "[Instance name]: ") " "
4334 (p "[Positive input]: ") " "
4335 (p "[Negative input]: ") " "
4336 (p "[Positive Output]: ") " "
4337 (p "[Negative Output]: ") " "
4338 (p "[Model name]: ") " "
4339 (p "<Vhigh>: " vhi
'noinsert
)
4340 (if (string-equal (tempo-lookup-named 'vhi
) "")
4341 (list 'l
"VHI=5.0") ;; default value
4342 (list 'l
"VHI=" '(s vhi
)))
4344 (p "<Vlow>: " vlo
'noinsert
)
4345 (if (string-equal (tempo-lookup-named 'vlo
) "")
4346 (list 'l
"VLO=0.0") ;; default value
4347 (list 'l
"VLO=" '(s vlo
)))
4349 (p "<Input offset>: " voff
'noinsert
)
4350 (if (string-equal (tempo-lookup-named 'voff
) "")
4351 (list 'l
"VOFF=0.0") ;; default value
4352 (list 'l
"VOFF=" '(s voff
)))
4354 (p "<Hysteresis voltage>: " vdef
'noinsert
)
4355 (if (string-equal (tempo-lookup-named 'vdef
) "")
4356 (list 'l
"VDEF=0.0") ;; default value
4357 (list 'l
"VDEF=" '(s vdef
)))
4359 (p "<Commutation time>: " tcom
'noinsert
)
4360 (if (string-equal (tempo-lookup-named 'tcom
) "")
4361 (list 'l
"TCOM=1ns") ;; default value
4362 (list 'l
"TCOM=" '(s tcom
)))
4364 (p "<Transit time>: " tpd
'noinsert
)
4365 (if (string-equal (tempo-lookup-named 'tpd
) "")
4366 (list 'l
"TPD=0.0") ;; default value
4367 (list 'l
"TPD=" '(s tpd
)))
4371 "template for inserting an ELDO Differential output comparator"
4374 (tempo-define-template
4375 "spice-eldo-linear-opa0"
4377 (p "[Instance name]: ") " OPAMP0 "
4378 (p "[Positive input]: ") " "
4379 (p "[Negative input]: ") " "
4380 (p "[Output]: ") " "
4381 (p "[Ground]: ") " param: "
4382 (p "<Gain>: " gain
'noinsert
)
4383 (if (string-equal (tempo-lookup-named 'gain
) "")
4384 (list 'l
"GAIN=1e5") ;; default value
4385 (list 'l
"GAIN=" '(s gain
)))
4387 (p "<Input impedance>: " rin
'noinsert
)
4388 (if (string-equal (tempo-lookup-named 'rin
) "")
4389 (list 'l
"RIN=1e7") ;; default value
4390 (list 'l
"RIN=" '(s rin
)))
4394 "template for inserting an ELDO single output linear opamp"
4397 (tempo-define-template
4398 "spice-eldo-linear-opa0d"
4400 (p "[Instance name]: ") " OPAMP0D "
4401 (p "[Positive input]: ") " "
4402 (p "[Negative input]: ") " "
4403 (p "[Positive Output]: ") " "
4404 (p "[Negative Output]: ") " "
4405 (p "[Ground]: ") " param: "
4406 (p "<Gain>: " gain
'noinsert
)
4407 (if (string-equal (tempo-lookup-named 'gain
) "")
4408 (list 'l
"GAIN=1e5") ;; default value
4409 (list 'l
"GAIN=" '(s gain
)))
4411 (p "<Input impedance>: " rin
'noinsert
)
4412 (if (string-equal (tempo-lookup-named 'rin
) "")
4413 (list 'l
"RIN=1e7") ;; default value
4414 (list 'l
"RIN=" '(s rin
)))
4418 "template for inserting an ELDO differential output linear opamp"
4422 (tempo-define-template
4423 "spice-eldo-linear-opa1"
4425 (p "[Instance name]: ") " OPAMP1 "
4426 (p "[Positive input]: ") " "
4427 (p "[Negative input]: ") " "
4428 (p "[Output]: ") " "
4429 (p "[Ground]: ") " param: "
4430 (p "<Gain>: " gain
'noinsert
)
4431 (if (string-equal (tempo-lookup-named 'gain
) "")
4432 (list 'l
"GAIN=1e5") ;; default value
4433 (list 'l
"GAIN=" '(s gain
)))
4435 (p "<Input offset>: " voff
'noinsert
)
4436 (if (string-equal (tempo-lookup-named 'voff
) "")
4437 (list 'l
"VOFF=0.0") ;; default value
4438 (list 'l
"VOFF=" '(s voff
)))
4440 (p "<Dominant pole>: " p1
'noinsert
)
4441 (if (string-equal (tempo-lookup-named 'p1
) "")
4442 (list 'l
"P1=100") ;; default value
4443 (list 'l
"P1=" '(s p1
)))
4445 (p "<Input impedance>: " rin
'noinsert
)
4446 (if (string-equal (tempo-lookup-named 'rin
) "")
4447 (list 'l
"RIN=1e7") ;; default value
4448 (list 'l
"RIN=" '(s rin
)))
4452 "template for inserting an ELDO single output 1-pole linear opamp"
4455 (tempo-define-template
4456 "spice-eldo-linear-opa1d"
4458 (p "[Instance name]: ") " OPAMP1D "
4459 (p "[Positive input]: ") " "
4460 (p "[Negative input]: ") " "
4461 (p "[Positive Output]: ") " "
4462 (p "[Negative Output]: ") " "
4463 (p "[Ground]: ") " param: "
4464 (p "<Gain>: " gain
'noinsert
)
4465 (if (string-equal (tempo-lookup-named 'gain
) "")
4466 (list 'l
"GAIN=1e5") ;; default value
4467 (list 'l
"GAIN=" '(s gain
)))
4469 (p "<Input offset>: " voff
'noinsert
)
4470 (if (string-equal (tempo-lookup-named 'voff
) "")
4471 (list 'l
"VOFF=0.0") ;; default value
4472 (list 'l
"VOFF=" '(s voff
)))
4474 (p "<Dominant pole>: " p1
'noinsert
)
4475 (if (string-equal (tempo-lookup-named 'p1
) "")
4476 (list 'l
"P1=100") ;; default value
4477 (list 'l
"P1=" '(s p1
)))
4479 (p "<Input impedance>: " rin
'noinsert
)
4480 (if (string-equal (tempo-lookup-named 'rin
) "")
4481 (list 'l
"RIN=1e7") ;; default value
4482 (list 'l
"RIN=" '(s rin
)))
4484 (p "<Common mode rejection ratio>: " cmrr
'noinsert
)
4485 (if (string-equal (tempo-lookup-named 'cmrr
) "")
4486 (list 'l
"CMRR=0.0") ;; default value
4487 (list 'l
"CMRR=" '(s cmrr
)))
4491 "template for inserting an ELDO differential output 1-pole linear opamp"
4494 (tempo-define-template
4495 "spice-eldo-linear-opa2"
4497 (p "[Instance name]: ") " OPAMP2 "
4498 (p "[Positive input]: ") " "
4499 (p "[Negative input]: ") " "
4500 (p "[Output]: ") " "
4501 (p "[Ground]: ") " param: "
4502 (p "<Gain>: " gain
'noinsert
)
4503 (if (string-equal (tempo-lookup-named 'gain
) "")
4504 (list 'l
"GAIN=1e5") ;; default value
4505 (list 'l
"GAIN=" '(s gain
)))
4507 (p "<Input offset>: " voff
'noinsert
)
4508 (if (string-equal (tempo-lookup-named 'voff
) "")
4509 (list 'l
"VOFF=0.0") ;; default value
4510 (list 'l
"VOFF=" '(s voff
)))
4512 (p "<Dominant pole>: " p1
'noinsert
)
4513 (if (string-equal (tempo-lookup-named 'p1
) "")
4514 (list 'l
"P1=100") ;; default value
4515 (list 'l
"P1=" '(s p1
)))
4517 (p "<Non-dominant pole>: " p2
'noinsert
)
4518 (if (string-equal (tempo-lookup-named 'p2
) "")
4519 (list 'l
"P2=1e6") ;; default value
4520 (list 'l
"P2=" '(s p2
)))
4522 (p "<Input impedance>: " rin
'noinsert
)
4523 (if (string-equal (tempo-lookup-named 'rin
) "")
4524 (list 'l
"RIN=1e7") ;; default value
4525 (list 'l
"RIN=" '(s rin
)))
4529 "template for inserting an ELDO single output 2-pole linear opamp"
4532 (tempo-define-template
4533 "spice-eldo-linear-opa2d"
4535 (p "[Instance name]: ") " OPAMP2D "
4536 (p "[Positive input]: ") " "
4537 (p "[Negative input]: ") " "
4538 (p "[Positive Output]: ") " "
4539 (p "[Negative Output]: ") " "
4540 (p "[Ground]: ") " param: "
4541 (p "<Gain>: " gain
'noinsert
)
4542 (if (string-equal (tempo-lookup-named 'gain
) "")
4543 (list 'l
"GAIN=1e5") ;; default value
4544 (list 'l
"GAIN=" '(s gain
)))
4546 (p "<Input offset>: " voff
'noinsert
)
4547 (if (string-equal (tempo-lookup-named 'voff
) "")
4548 (list 'l
"VOFF=0.0") ;; default value
4549 (list 'l
"VOFF=" '(s voff
)))
4551 (p "<Dominant pole>: " p1
'noinsert
)
4552 (if (string-equal (tempo-lookup-named 'p1
) "")
4553 (list 'l
"P1=100") ;; default value
4554 (list 'l
"P1=" '(s p1
)))
4556 (p "<Non-dominant pole>: " p2
'noinsert
)
4557 (if (string-equal (tempo-lookup-named 'p2
) "")
4558 (list 'l
"P2=1e6") ;; default value
4559 (list 'l
"P2=" '(s p2
)))
4561 (p "<Input impedance>: " rin
'noinsert
)
4562 (if (string-equal (tempo-lookup-named 'rin
) "")
4563 (list 'l
"RIN=1e7") ;; default value
4564 (list 'l
"RIN=" '(s rin
)))
4566 (p "<Common mode rejection ratio>: " cmrr
'noinsert
)
4567 (if (string-equal (tempo-lookup-named 'cmrr
) "")
4568 (list 'l
"CMRR=0.0") ;; default value
4569 (list 'l
"CMRR=" '(s cmrr
)))
4573 "template for inserting an ELDO differential output 2-pole linear opamp"
4577 (tempo-define-template
4580 (p "[Instance name]: ") " "
4582 (p "[Output]: ") " "
4583 (p "[Delay value]: ") " "
4586 "template for inserting an ELDO delay"
4589 (tempo-define-template
4592 (p "[Instance name]: ") " SATR "
4594 (p "[Output]: ") " param: "
4595 (p "<Value of resistance>: " r
'noinsert
)
4596 (if (string-equal (tempo-lookup-named 'r
) "")
4597 (list 'l
"R=1") ;; default value
4598 (list 'l
"R=" '(s r
)))
4600 (p "<Max current>: " imax
'noinsert
)
4601 (if (string-equal (tempo-lookup-named 'imax
) "")
4602 (list 'l
"IMAX=1") ;; default value
4603 (list 'l
"IMAX=" '(s imax
)))
4605 (p "<Slew rate(V/µs)>: " sr
'noinsert
)
4606 (if (string-equal (tempo-lookup-named 'sr
) "")
4607 (list 'l
"SR=0") ;; default value
4608 (list 'l
"SR=" '(s sr
)))
4610 (p "<Dominant pole>: " p1
'noinsert
)
4611 (if (string-equal (tempo-lookup-named 'p1
) "")
4612 (list 'l
"P1=1e6") ;; default value
4613 (list 'l
"P1=" '(s p1
)))
4615 (p "<resistance of low-pass filter>: " r1
'noinsert
)
4616 (if (string-equal (tempo-lookup-named 'r1
) "")
4617 (list 'l
"R1=30") ;; default value
4618 (list 'l
"R1=" '(s r1
)))
4621 "template for inserting an ELDO saturating resistor"
4624 (tempo-define-template
4627 (p "[Instance name]: ") " SATV "
4628 (p "[Positive input]: ") " "
4629 (p "[Negative input]: ") " "
4630 (p "[Positive Output]: ") " "
4631 (p "[Negative Output]: ") " param: "
4632 (p "<VMax>: " vmax
'noinsert
)
4633 (if (string-equal (tempo-lookup-named 'vmax
) "")
4634 (list 'l
"VMAX=5.0") ;; default value
4635 (list 'l
"VMAX=" '(s vmax
)))
4637 (p "<VMin>: " vmin
'noinsert
)
4638 (if (string-equal (tempo-lookup-named 'vmin
) "")
4639 (list 'l
"VMIN=-5.0") ;; default value
4640 (list 'l
"VMIN=" '(s vmin
)))
4642 (p "<Positive saturation voltage>: " vsatp
'noinsert
)
4643 (if (string-equal (tempo-lookup-named 'vsatp
) "")
4644 (list 'l
"VSATP=4.75") ;; default value
4645 (list 'l
"VSATP=" '(s vsatp
)))
4647 (p "<Negative saturation voltage>: " vsatn
'noinsert
)
4648 (if (string-equal (tempo-lookup-named 'vsatn
) "")
4649 (list 'l
"VSATN=-4.75") ;; default value
4650 (list 'l
"VSATN=" '(s vsatn
)))
4652 (p "<Slope at VSATP>: " pslope
'noinsert
)
4653 (if (string-equal (tempo-lookup-named 'pslope
) "")
4654 (list 'l
"PSLOPE=0.25") ;; default value
4655 (list 'l
"PSLOPE=" '(s pslope
)))
4657 (p "<Slope at VSATN>: " nslope
'noinsert
)
4658 (if (string-equal (tempo-lookup-named 'nslope
) "")
4659 (list 'l
"NSLOPE=0.25") ;; default value
4660 (list 'l
"NSLOPE=" '(s nslope
)))
4663 "template for inserting an ELDO voltage limitor"
4666 (tempo-define-template
4667 "spice-eldo-vswitch"
4669 (p "[Instance name]: ") " VSWITCH "
4671 (p "[Output]: ") " "
4672 (p "[Positive controlling node]: ") " "
4673 (p "[Negative controlling node]: ") " param: "
4674 (p "<Level (1/2)>: " level
'noinsert
)
4675 (if (string-equal (tempo-lookup-named 'level
) "")
4676 (list 'l
"LEVEL=1") ;; default value
4677 (list 'l
"LEVEL=2" ))
4679 (p "<Voltage for 'ON' state>: " von
'noinsert
)
4680 (if (string-equal (tempo-lookup-named 'von
) "")
4681 (list 'l
"VON=0.95") ;; default value
4682 (list 'l
"VON=" '(s von
)))
4684 (p "<Voltage for 'OFF' state>: " voff
'noinsert
)
4685 (if (string-equal (tempo-lookup-named 'voff
) "")
4686 (list 'l
"VOFF=0.05") ;; default value
4687 (list 'l
"VOFF=" '(s voff
)))
4689 (p "<RON resistance>: " ron
'noinsert
)
4690 (if (string-equal (tempo-lookup-named 'ron
) "")
4691 (list 'l
"RON=1e-2") ;; default value
4692 (list 'l
"RON=" '(s ron
)))
4694 (p "<ROFF resistance>: " roff
'noinsert
)
4695 (if (string-equal (tempo-lookup-named 'roff
) "")
4696 (list 'l
"ROFF=1e10") ;; default value
4697 (list 'l
"ROFF=" '(s roff
)))
4700 "template for inserting an ELDO voltage controled switch"
4703 (tempo-define-template
4704 "spice-eldo-cswitch"
4706 (p "[Instance name]: ") " CSWITCH "
4708 (p "[Output]: ") " IC: "
4709 (p "[Controlling current]: ") " param: "
4710 (p "<Level (1/2)>: " level
'noinsert
)
4711 (if (string-equal (tempo-lookup-named 'level
) "")
4712 (list 'l
"LEVEL=1") ;; default value
4713 (list 'l
"LEVEL=2" ))
4715 (p "<Current for 'ON' state>: " ion
'noinsert
)
4716 (if (string-equal (tempo-lookup-named 'ion
) "")
4717 (list 'l
"ION=0.95") ;; default value
4718 (list 'l
"ION=" '(s ion
)))
4720 (p "<Current for 'OFF' state>: " ioff
'noinsert
)
4721 (if (string-equal (tempo-lookup-named 'ioff
) "")
4722 (list 'l
"IOFF=0.05") ;; default value
4723 (list 'l
"IOFF=" '(s ioff
)))
4725 (p "<RON resistance>: " ron
'noinsert
)
4726 (if (string-equal (tempo-lookup-named 'ron
) "")
4727 (list 'l
"RON=1e-2") ;; default value
4728 (list 'l
"RON=" '(s ron
)))
4730 (p "<ROFF resistance>: " roff
'noinsert
)
4731 (if (string-equal (tempo-lookup-named 'roff
) "")
4732 (list 'l
"ROFF=1e10") ;; default value
4733 (list 'l
"ROFF=" '(s roff
)))
4736 "template for inserting an ELDO current controled switch"
4739 (tempo-define-template
4740 "spice-eldo-tri2sin"
4742 (p "[Instance name]: ") " TRI2SIN "
4743 (p "[Positive input]: ") " "
4744 (p "[Negative input]: ") " "
4745 (p "[Positive output]: ") " "
4746 (p "[Negative output]: ") " param: "
4747 (p "<Level (1/2)>: " level
'noinsert
)
4748 (if (string-equal (tempo-lookup-named 'level
) "")
4749 (list 'l
"LEVEL=1") ;; default value
4750 (list 'l
"LEVEL=" '(s level
)))
4752 (p "<Gain>: " gain
'noinsert
)
4753 (if (string-equal (tempo-lookup-named 'gain
) "")
4754 (list 'l
"GAIN=1e5") ;; default value
4755 (list 'l
"GAIN=" '(s gain
)))
4757 (p "<Input offset>: " voff
'noinsert
)
4758 (if (string-equal (tempo-lookup-named 'voff
) "")
4759 (list 'l
"VOFF=0.0") ;; default value
4760 (list 'l
"VOFF=" '(s voff
)))
4762 (p "<Upper input voltage limit >: " vu
'noinsert
)
4763 (if (string-equal (tempo-lookup-named 'vu
) "")
4764 (list 'l
"VU=1") ;; default value
4765 (list 'l
"VU=" '(s vu
)))
4767 (p "<Lower input voltage limit >: " vl
'noinsert
)
4768 (if (string-equal (tempo-lookup-named 'vl
) "")
4769 (list 'l
"VL=1") ;; default value
4770 (list 'l
"VL=" '(s vl
)))
4773 "template for inserting an ELDO triangular to sine wave converter"
4776 (tempo-define-template
4777 "spice-eldo-stairgen"
4779 (p "[Instance name]: ") " STAIRGEN "
4780 (p "[Positive input]: ") " "
4781 (p "[Negative input]: ") " param: "
4782 (p "<Start voltage>: " vstart
'noinsert
)
4783 (if (string-equal (tempo-lookup-named 'vstart
) "")
4784 (list 'l
"VSTART=0.0") ;; default value
4785 (list 'l
"VSTART=" '(s vstart
)))
4787 (p "<Step voltage>: " vdelta
'noinsert
)
4788 (if (string-equal (tempo-lookup-named 'vdelta
) "")
4789 (list 'l
"VDELTA=0.1") ;; default value
4790 (list 'l
"VDELTA=" '(s vdelta
)))
4792 (p "<Number of steps>: " nstep
'noinsert
)
4793 (if (string-equal (tempo-lookup-named 'nstep
) "")
4794 (list 'l
"NSTEP=10") ;; default value
4795 (list 'l
"NSTEP=" '(s nstep
)))
4797 (p "<Period>: " tdu
'noinsert
)
4798 (if (string-equal (tempo-lookup-named 'tdu
) "")
4799 (list 'l
"TDU=1e-4") ;; default value
4800 (list 'l
"TDU=" '(s tdu
)))
4802 (p "<Slew rate (V/µs)>: " slr
'noinsert
)
4803 (if (string-equal (tempo-lookup-named 'slr
) "")
4804 (list 'l
"SLR=1") ;; default value
4805 (list 'l
"SLR=" '(s slr
)))
4808 "template for inserting an ELDO staircase waveform generator"
4811 (tempo-define-template
4814 (p "[Instance name]: ") " SAWGEN "
4815 (p "[Positive input]: ") " "
4816 (p "[Negative input]: ") " param: "
4817 (p "<Start voltage>: " v0
'noinsert
)
4818 (if (string-equal (tempo-lookup-named 'v0
) "")
4819 (list 'l
"V0=0.0") ;; default value
4820 (list 'l
"V0=" '(s v0
)))
4822 (p "<Voltage magnitude>: " v1
'noinsert
)
4823 (if (string-equal (tempo-lookup-named 'v1
) "")
4824 (list 'l
"V1=5.0") ;; default value
4825 (list 'l
"V1=" '(s v1
)))
4827 (p "<Period>: " tdu
'noinsert
)
4828 (if (string-equal (tempo-lookup-named 'tdu
) "")
4829 (list 'l
"TDU=1e-4") ;; default value
4830 (list 'l
"TDU=" '(s tdu
)))
4832 (p "<Delay>: " tdel
'noinsert
)
4833 (if (string-equal (tempo-lookup-named 'tdel
) "")
4834 (list 'l
"TDEL=0.0") ;; default value
4835 (list 'l
"TDEL=" '(s tdel
)))
4838 "template for inserting an ELDO sawtooth waveform generator"
4841 (tempo-define-template
4844 (p "[Instance name]: ") " TRIGEN "
4845 (p "[Positive input]: ") " "
4846 (p "[Negative input]: ") " param: "
4847 (p "<Start voltage>: " v0
'noinsert
)
4848 (if (string-equal (tempo-lookup-named 'v0
) "")
4849 (list 'l
"V0=0.0") ;; default value
4850 (list 'l
"V0=" '(s v0
)))
4852 (p "<Voltage magnitude>: " v1
'noinsert
)
4853 (if (string-equal (tempo-lookup-named 'v1
) "")
4854 (list 'l
"V1=5.0") ;; default value
4855 (list 'l
"V1=" '(s v1
)))
4857 (p "<First edge duration>: " rdu
'noinsert
)
4858 (if (string-equal (tempo-lookup-named 'rdu
) "")
4859 (list 'l
"RDU=1e-4") ;; default value
4860 (list 'l
"RDU=" '(s rdu
)))
4862 (p "<Second edge duration>: " fdu
'noinsert
)
4863 (if (string-equal (tempo-lookup-named 'fdu
) "")
4864 (list 'l
"FDU=1e-4") ;; default value
4865 (list 'l
"FDU=" '(s fdu
)))
4867 (p "<Delay>: " tdel
'noinsert
)
4868 (if (string-equal (tempo-lookup-named 'tdel
) "")
4869 (list 'l
"TDEL=0.0") ;; default value
4870 (list 'l
"TDEL=" '(s tdel
)))
4873 "template for inserting an ELDO triangular waveform generator"
4876 (tempo-define-template
4879 (p "[Instance name]: ") " AMM "
4880 (p "[Positive input]: ") " "
4881 (p "[Negative input]: ") " "
4882 (p "[Positive Output]: ") " "
4883 (p "[Negative Output]: ") " param: "
4884 (p "<Level (1/2)>: " level
'noinsert
)
4885 (if (string-equal (tempo-lookup-named 'level
) "")
4886 (list 'l
"LEVEL=1") ;; default value
4887 (list 'l
"LEVEL=" '(s level
)))
4889 (p "<Slewrate (V/µs)>: " slr
'noinsert
)
4890 (if (string-equal (tempo-lookup-named 'slr
) "")
4891 (list 'l
"SLR=10") ;; default value
4892 (list 'l
"SLR=" '(s slr
)))
4894 (p "<Offset voltage>: " voff
'noinsert
)
4895 (if (string-equal (tempo-lookup-named 'voff
) "")
4896 (list 'l
"VOFF=0.0") ;; default value
4897 (list 'l
"VOFF=" '(s voff
)))
4899 (p "<Carrier frequency>: " fc
'noinsert
)
4900 (if (string-equal (tempo-lookup-named 'fc
) "")
4901 (list 'l
"FC=1e6") ;; default value
4902 (list 'l
"FC=" '(s fc
)))
4904 (p "<Minimal number of sampling points per period>: " nsam
'noinsert
)
4905 (if (string-equal (tempo-lookup-named 'nsam
) "")
4906 (list 'l
"NSAM=10") ;; default value
4907 (list 'l
"NSAM=" '(s nsam
)))
4910 "template for inserting an ELDO amplitude modulator"
4913 (tempo-define-template
4916 (p "[Instance name]: ") " PAM "
4917 (p "[Positive input]: ") " "
4918 (p "[Negative input]: ") " "
4919 (p "[Positive Output]: ") " "
4920 (p "[Negative Output]: ") " param: "
4921 (p "<Level (1/2)>: " level
'noinsert
)
4922 (if (string-equal (tempo-lookup-named 'level
) "")
4923 (list 'l
"LEVEL=1") ;; default value
4924 (list 'l
"LEVEL=" '(s level
)))
4926 (p "<Slewrate (V/µs)>: " slr
'noinsert
)
4927 (if (string-equal (tempo-lookup-named 'slr
) "")
4928 (list 'l
"SLR=10") ;; default value
4929 (list 'l
"SLR=" '(s slr
)))
4931 (p "<Offset voltage>: " voff
'noinsert
)
4932 (if (string-equal (tempo-lookup-named 'voff
) "")
4933 (list 'l
"VOFF=0.0") ;; default value
4934 (list 'l
"VOFF=" '(s voff
)))
4936 (p "<Carrier frequency>: " fc
'noinsert
)
4937 (if (string-equal (tempo-lookup-named 'fc
) "")
4938 (list 'l
"FC=1e6") ;; default value
4939 (list 'l
"FC=" '(s fc
)))
4941 (p "<Minimal number of sampling points per period>: " nsam
'noinsert
)
4942 (if (string-equal (tempo-lookup-named 'nsam
) "")
4943 (list 'l
"NSAM=10") ;; default value
4944 (list 'l
"NSAM=" '(s nsam
)))
4947 "template for inserting an ELDO pulse amplitude modulator"
4951 (tempo-define-template
4954 (p "[Instance name]: ") " SA_HO "
4955 (p "[Positive input]: ") " "
4956 (p "[Negative input]: ") " "
4957 (p "[Positive Output]: ") " "
4958 (p "[Negative Output]: ") " param: "
4959 (p "<Sampling frequency>: " fs
'noinsert
)
4960 (if (string-equal (tempo-lookup-named 'fs
) "")
4961 (list 'l
"FS=1e6") ;; default value
4962 (list 'l
"FS=" '(s fs
)))
4964 (p "<Acquisition time>: " tacq
'noinsert
)
4965 (if (string-equal (tempo-lookup-named 'tacq
) "")
4966 (list 'l
"TACQ=1e-9") ;; default value
4967 (list 'l
"TACQ=" '(s tacq
)))
4969 (p "<Droop voltage>: " dv
'noinsert
)
4970 (if (string-equal (tempo-lookup-named 'dv
) "")
4971 (list 'l
"DV=20mv") ;; default value
4972 (list 'l
"DV=" '(s dv
)))
4976 "template for inserting an ELDO sample&hold"
4979 (tempo-define-template
4982 (p "[Instance name]: ") " TR_HO "
4983 (p "[Positive input]: ") " "
4984 (p "[Negative input]: ") " "
4985 (p "[Positive Output]: ") " "
4986 (p "[Negative Output]: ") " "
4987 (p "[Controlling node]: ") " param: "
4988 (p "<Threshold voltage for CRT>: " vth
'noinsert
)
4989 (if (string-equal (tempo-lookup-named 'vth
) "")
4990 (list 'l
"VTH=0.5") ;; default value
4991 (list 'l
"VTH=" '(s vth
)))
4993 (p "<Acquisition time>: " tacq
'noinsert
)
4994 (if (string-equal (tempo-lookup-named 'tacq
) "")
4995 (list 'l
"TACQ=1e-9") ;; default value
4996 (list 'l
"TACQ=" '(s tacq
)))
4999 "template for inserting an ELDO track&hold"
5003 (tempo-define-template
5006 (p "[Instance name]: ") " PEAK_D "
5007 (p "[Positive input]: ") " "
5008 (p "[Negative input]: ") " "
5009 (p "[Positive Output]: ") " "
5010 (p "[Negative Output]: ") " "
5011 (p "[Controlling node]: ") " param: "
5012 (p "<Level (1/2)>: " level
'noinsert
)
5013 (if (string-equal (tempo-lookup-named 'level
) "")
5014 (list 'l
"LEVEL=1") ;; default value
5015 (list 'l
"LEVEL=2" ))
5017 (p "<Threshold voltage for CRT>: " vth
'noinsert
)
5018 (if (string-equal (tempo-lookup-named 'vth
) "")
5019 (list 'l
"VTH=0.5") ;; default value
5020 (list 'l
"VTH=" '(s vth
)))
5022 (p "<Threshold voltage for reset on output>: " res
'noinsert
)
5023 (if (string-equal (tempo-lookup-named 'res
) "")
5024 (list 'l
"RES=0.5") ;; default value
5025 (list 'l
"RES=" '(s res
)))
5027 (p "<Output slewrate (V/µs)>: " slr
'noinsert
)
5028 (if (string-equal (tempo-lookup-named 'slr
) "")
5029 (list 'l
"SLR=1.0") ;; default value
5030 (list 'l
"SLR=" '(s slr
)))
5032 (p "<Output slewrate on reset>: " rslr
'noinsert
)
5033 (if (string-equal (tempo-lookup-named 'rslr
) "")
5034 (list 'l
"RSLR=1.0") ;; default value
5035 (list 'l
"RSLR=" '(s rslr
)))
5038 "template for inserting an ELDO peak detector"
5042 (tempo-define-template
5045 (p "[Instance name]: ") " LEV_D "
5046 (p "[Positive input]: ") " "
5047 (p "[Negative input]: ") " "
5048 (p "[Positive Output]: ") " "
5049 (p "[Negative Output]: ") " param: "
5050 (p "<Rise time (µs)>: " tr
'noinsert
)
5051 (if (string-equal (tempo-lookup-named 'tr
) "")
5052 (list 'l
"TR=1.0") ;; default value
5053 (list 'l
"TR=" '(s tr
)))
5055 (p "<Fall time (µs)>: " tf
'noinsert
)
5056 (if (string-equal (tempo-lookup-named 'tf
) "")
5057 (list 'l
"TF=1.0") ;; default value
5058 (list 'l
"TF=" '(s tf
)))
5060 (p "<Transit time (s)>: " tpd
'noinsert
)
5061 (if (string-equal (tempo-lookup-named 'tpd
) "")
5062 (list 'l
"TPD=0.0") ;; default value
5063 (list 'l
"TPD=" '(s tpd
)))
5065 (p "<Lower voltage level>: " v0
'noinsert
)
5066 (if (string-equal (tempo-lookup-named 'v0
) "")
5067 (list 'l
"V0=0.0") ;; default value
5068 (list 'l
"V0=" '(s v0
)))
5070 (p "<Higher voltage level>: " v1
'noinsert
)
5071 (if (string-equal (tempo-lookup-named 'v1
) "")
5072 (list 'l
"V1=1.0") ;; default value
5073 (list 'l
"V1=" '(s v1
)))
5075 (p "<Input offset voltage>: " voff
'noinsert
)
5076 (if (string-equal (tempo-lookup-named 'voff
) "")
5077 (list 'l
"VOFF=0.0") ;; default value
5078 (list 'l
"VOFF=" '(s voff
)))
5080 (p "<Lower reference voltage>: " vrl
'noinsert
)
5081 (if (string-equal (tempo-lookup-named 'vrl
) "")
5082 (list 'l
"VRL=-0.1") ;; default value
5083 (list 'l
"VRL=" '(s vrl
)))
5085 (p "<Higher reference voltage>: " vru
'noinsert
)
5086 (if (string-equal (tempo-lookup-named 'vru
) "")
5087 (list 'l
"VRU=0.1") ;; default value
5088 (list 'l
"VRU=" '(s vru
)))
5091 "template for inserting an ELDO single-output level detector"
5095 (tempo-define-template
5098 (p "[Instance name]: ") " LEV_D "
5099 (p "[Positive input]: ") " "
5100 (p "[Negative input]: ") " "
5101 (p "[Positive Output]: ") " "
5102 (p "[Negative Output]: ") " "
5103 (p "[Reference node]: ") " param: "
5104 (p "<Rise time (µs)>: " tr
'noinsert
)
5105 (if (string-equal (tempo-lookup-named 'tr
) "")
5106 (list 'l
"TR=1.0") ;; default value
5107 (list 'l
"TR=" '(s tr
)))
5109 (p "<Fall time (µs)>: " tf
'noinsert
)
5110 (if (string-equal (tempo-lookup-named 'tf
) "")
5111 (list 'l
"TF=1.0") ;; default value
5112 (list 'l
"TF=" '(s tf
)))
5114 (p "<Transit time (s)>: " tpd
'noinsert
)
5115 (if (string-equal (tempo-lookup-named 'tpd
) "")
5116 (list 'l
"TPD=0.0") ;; default value
5117 (list 'l
"TPD=" '(s tpd
)))
5119 (p "<Lower voltage level>: " v0
'noinsert
)
5120 (if (string-equal (tempo-lookup-named 'v0
) "")
5121 (list 'l
"V0=0.0") ;; default value
5122 (list 'l
"V0=" '(s v0
)))
5124 (p "<Higher voltage level>: " v1
'noinsert
)
5125 (if (string-equal (tempo-lookup-named 'v1
) "")
5126 (list 'l
"V1=1.0") ;; default value
5127 (list 'l
"V1=" '(s v1
)))
5129 (p "<Input offset voltage>: " voff
'noinsert
)
5130 (if (string-equal (tempo-lookup-named 'voff
) "")
5131 (list 'l
"VOFF=0.0") ;; default value
5132 (list 'l
"VOFF=" '(s voff
)))
5134 (p "<Lower reference voltage>: " vrl
'noinsert
)
5135 (if (string-equal (tempo-lookup-named 'vrl
) "")
5136 (list 'l
"VRL=-0.1") ;; default value
5137 (list 'l
"VRL=" '(s vrl
)))
5139 (p "<Higher reference voltage>: " vru
'noinsert
)
5140 (if (string-equal (tempo-lookup-named 'vru
) "")
5141 (list 'l
"VRU=0.1") ;; default value
5142 (list 'l
"VRU=" '(s vru
)))
5145 "template for inserting an ELDO differential-output level detector"
5149 (tempo-define-template
5152 (p "[Instance name]: ") " LOGAMP "
5154 (p "[Output]: ") " param: "
5155 (p "<Gain>: " gain
'noinsert
)
5156 (if (string-equal (tempo-lookup-named 'gain
) "")
5157 (list 'l
"K=1.0") ;; default value
5158 (list 'l
"K=" '(s gain
)))
5160 (p "<Log function argument>: " e
'noinsert
)
5161 (if (string-equal (tempo-lookup-named 'e
) "")
5162 (list 'l
"E=1") ;; default value
5163 (list 'l
"E=" '(s vmin
)))
5165 (p "<Vmax>: " vmax
'noinsert
)
5166 (if (string-equal (tempo-lookup-named 'vmax
) "")
5167 (list 'l
"VMAX=5.0") ;; default value
5168 (list 'l
"VMAX=" '(s vmax
)))
5170 (p "<Vmin>: " vmin
'noinsert
)
5171 (if (string-equal (tempo-lookup-named 'vmin
) "")
5172 (list 'l
"VMIN=-5.0") ;; default value
5173 (list 'l
"VMIN=" '(s vmin
)))
5175 (p "<Positive saturation voltage>: " vsatp
'noinsert
)
5176 (if (string-equal (tempo-lookup-named 'vsatp
) "")
5177 (list 'l
"VSATP=4.75") ;; default value
5178 (list 'l
"VSATP=" '(s vsatp
)))
5180 (p "<Negative saturation voltage>: " vsatn
'noinsert
)
5181 (if (string-equal (tempo-lookup-named 'vsatn
) "")
5182 (list 'l
"VSATN=-4.75") ;; default value
5183 (list 'l
"VSATN=" '(s vsatn
)))
5185 (p "<Slope at VSATP>: " pslope
'noinsert
)
5186 (if (string-equal (tempo-lookup-named 'pslope
) "")
5187 (list 'l
"PSLOPE=0.25") ;; default value
5188 (list 'l
"PSLOPE=" '(s pslope
)))
5190 (p "<Slope at VSATN>: " nslope
'noinsert
)
5191 (if (string-equal (tempo-lookup-named 'nslope
) "")
5192 (list 'l
"NSLOPE=0.25") ;; default value
5193 (list 'l
"NSLOPE=" '(s nslope
)))
5196 "template for inserting an ELDO logarithmic amplifier"
5199 (tempo-define-template
5200 "spice-eldo-antilog"
5202 (p "[Instance name]: ") " EXPAMP "
5204 (p "[Output]: ") " param: "
5205 (p "<Gain>: " k
'noinsert
)
5206 (if (string-equal (tempo-lookup-named 'k
) "")
5207 (list 'l
"K=1.0") ;; default value
5208 (list 'l
"K=" '(s k
)))
5210 (p "<Exp function argument>: " e
'noinsert
)
5211 (if (string-equal (tempo-lookup-named 'e
) "")
5212 (list 'l
"E=1") ;; default value
5213 (list 'l
"E=" '(s vmin
)))
5215 (p "<Base of power function>: " base
'noinsert
)
5216 (if (string-equal (tempo-lookup-named 'base
) "")
5217 (list 'l
"BASE={EXP(1)}") ;; default value
5218 (list 'l
"BASE=" '(s base
)))
5220 (p "<Vmax>: " vmax
'noinsert
)
5221 (if (string-equal (tempo-lookup-named 'vmax
) "")
5222 (list 'l
"VMAX=5.0") ;; default value
5223 (list 'l
"VMAX=" '(s vmax
)))
5225 (p "<Vmin>: " vmin
'noinsert
)
5226 (if (string-equal (tempo-lookup-named 'vmin
) "")
5227 (list 'l
"VMIN=-5.0") ;; default value
5228 (list 'l
"VMIN=" '(s vmin
)))
5230 (p "<Positive saturation voltage>: " vsatp
'noinsert
)
5231 (if (string-equal (tempo-lookup-named 'vsatp
) "")
5232 (list 'l
"VSATP=4.75") ;; default value
5233 (list 'l
"VSATP=" '(s vsatp
)))
5235 (p "<Negative saturation voltage>: " vsatn
'noinsert
)
5236 (if (string-equal (tempo-lookup-named 'vsatn
) "")
5237 (list 'l
"VSATN=-4.75") ;; default value
5238 (list 'l
"VSATN=" '(s vsatn
)))
5240 (p "<Slope at VSATP>: " pslope
'noinsert
)
5241 (if (string-equal (tempo-lookup-named 'pslope
) "")
5242 (list 'l
"PSLOPE=0.25") ;; default value
5243 (list 'l
"PSLOPE=" '(s pslope
)))
5245 (p "<Slope at VSATN>: " nslope
'noinsert
)
5246 (if (string-equal (tempo-lookup-named 'nslope
) "")
5247 (list 'l
"NSLOPE=0.25") ;; default value
5248 (list 'l
"NSLOPE=" '(s nslope
)))
5251 "template for inserting an ELDO anti-logarithmic amplifier"
5254 (tempo-define-template
5257 (p "[Instance name]: ") " DIFF "
5259 (p "[Output]: ") " param: "
5260 (p "<Time constant>: " k
'noinsert
)
5261 (if (string-equal (tempo-lookup-named 'k
) "")
5262 (list 'l
"K=1") ;; default value
5263 (list 'l
"K=" '(s k
)))
5265 (p "<DC value>: " c0
'noinsert
)
5266 (if (string-equal (tempo-lookup-named 'c0
) "")
5267 (list 'l
"C0=1") ;; default value
5268 (list 'l
"C0=" '(s c0
)))
5270 (p "<Slewrate (V/s)>: " slr
'noinsert
)
5271 (if (string-equal (tempo-lookup-named 'slr
) "")
5272 (list 'l
"SLR=1e9") ;; default value
5273 (list 'l
"SLR=" '(s slr
)))
5276 "template for inserting an ELDO differentiator"
5279 (tempo-define-template
5282 (p "[Instance name]: ") " INTEG "
5284 (p "[Output]: ") " param: "
5285 (p "<Time constant>: " k
'noinsert
)
5286 (if (string-equal (tempo-lookup-named 'k
) "")
5287 (list 'l
"K=1") ;; default value
5288 (list 'l
"K=" '(s k
)))
5290 (p "<DC value>: " c0
'noinsert
)
5291 (if (string-equal (tempo-lookup-named 'c0
) "")
5292 (list 'l
"C0=1") ;; default value
5293 (list 'l
"C0=" '(s c0
)))
5296 "template for inserting an ELDO integrator"
5299 (tempo-define-template
5302 (p "[Instance name]: ") " "
5303 (p "<ADD/SUB/MULT/DIV>: ") " "
5304 (p "[Input 2]: ") " "
5305 (p "[Output]: ") " param: "
5306 (p "<Vmax>: " vmax
'noinsert
)
5307 (if (string-equal (tempo-lookup-named 'vmax
) "")
5308 (list 'l
"VMAX=5.0") ;; default value
5309 (list 'l
"VMAX=" '(s vmax
)))
5311 (p "<Vmin>: " vmin
'noinsert
)
5312 (if (string-equal (tempo-lookup-named 'vmin
) "")
5313 (list 'l
"VMIN=-5.0") ;; default value
5314 (list 'l
"VMIN=" '(s vmin
)))
5316 (p "<Positive saturation voltage>: " vsatp
'noinsert
)
5317 (if (string-equal (tempo-lookup-named 'vsatp
) "")
5318 (list 'l
"VSATP=4.75") ;; default value
5319 (list 'l
"VSATP=" '(s vsatp
)))
5321 (p "<Negative saturation voltage>: " vsatn
'noinsert
)
5322 (if (string-equal (tempo-lookup-named 'vsatn
) "")
5323 (list 'l
"VSATN=-4.75") ;; default value
5324 (list 'l
"VSATN=" '(s vsatn
)))
5326 (p "<Slope at VSATP>: " pslope
'noinsert
)
5327 (if (string-equal (tempo-lookup-named 'pslope
) "")
5328 (list 'l
"PSLOPE=0.25") ;; default value
5329 (list 'l
"PSLOPE=" '(s pslope
)))
5331 (p "<Slope at VSATN>: " nslope
'noinsert
)
5332 (if (string-equal (tempo-lookup-named 'nslope
) "")
5333 (list 'l
"NSLOPE=0.25") ;; default value
5334 (list 'l
"NSLOPE=" '(s nslope
)))
5337 "template for inserting an ELDO adder/subtrator/multiplier/divider"
5340 ;; -------------------
5341 ;; Digital Macromodels
5342 ;; -------------------
5344 (tempo-define-template
5347 (p "[Instance name]: ") " "
5348 (p "[First input]: ") " "
5349 (p "[Second input]: ") " "
5350 (p "[Output]: ") " "
5351 (p "[Model name]: ") " "
5352 (p "<Vhigh>: " vhi
'noinsert
)
5353 (if (string-equal (tempo-lookup-named 'vhi
) "")
5354 (list 'l
"VHI=5.0") ;; default value
5355 (list 'l
"VHI=" '(s vhi
)))
5357 (p "<Vlow>: " vlo
'noinsert
)
5358 (if (string-equal (tempo-lookup-named 'vlo
) "")
5359 (list 'l
"VLO=0.0") ;; default value
5360 (list 'l
"VLO=" '(s vlo
)))
5362 (p "<Threshold input voltage>: " vth
'noinsert
)
5363 (if (string-equal (tempo-lookup-named 'vth
) "")
5364 (list 'l
"VTH=2.5") ;; default value
5365 (list 'l
"VTH=" '(s vth
)))
5367 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5368 (if (string-equal (tempo-lookup-named 'vthi
) "")
5369 (list 'l
"") ;; default value
5370 (list 'l
"VTHI=" '(s vthi
)))
5372 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5373 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5374 (list 'l
"") ;; default value
5375 (list 'l
"VTLO=" '(s vtlo
)))
5377 (p "<Transit time>: " tpd
'noinsert
)
5378 (if (string-equal (tempo-lookup-named 'tpd
) "")
5379 (list 'l
"TPD=1.0ns") ;; default value
5380 (list 'l
"TPD=" '(s tpd
)))
5382 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5383 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5384 (list 'l
"") ;; default value
5385 (list 'l
"TPDUP=" '(s tpdup
)))
5387 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5388 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5389 (list 'l
"") ;; default value
5390 (list 'l
"TPDOWN=" '(s tpdown
)))
5392 (p "<Input capacitance>: " cin
'noinsert
)
5393 (if (string-equal (tempo-lookup-named 'cin
) "")
5394 (list 'l
"CIN=0.0") ;; default value
5395 (list 'l
"CIN=" '(s cin
)))
5399 "template for inserting an ELDO INVERTER gate macromodel"
5402 (tempo-define-template
5405 (p "[Instance name]: ") " "
5406 (p "[First input]: ") " "
5407 (p "[Second input]: ") " "
5408 (p "[Output]: ") " "
5409 (p "[Model name]: ") " "
5410 (p "<Vhigh>: " vhi
'noinsert
)
5411 (if (string-equal (tempo-lookup-named 'vhi
) "")
5412 (list 'l
"VHI=5.0") ;; default value
5413 (list 'l
"VHI=" '(s vhi
)))
5415 (p "<Vlow>: " vlo
'noinsert
)
5416 (if (string-equal (tempo-lookup-named 'vlo
) "")
5417 (list 'l
"VLO=0.0") ;; default value
5418 (list 'l
"VLO=" '(s vlo
)))
5420 (p "<Threshold input voltage>: " vth
'noinsert
)
5421 (if (string-equal (tempo-lookup-named 'vth
) "")
5422 (list 'l
"VTH=2.5") ;; default value
5423 (list 'l
"VTH=" '(s vth
)))
5425 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5426 (if (string-equal (tempo-lookup-named 'vthi
) "")
5427 (list 'l
"") ;; default value
5428 (list 'l
"VTHI=" '(s vthi
)))
5430 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5431 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5432 (list 'l
"") ;; default value
5433 (list 'l
"VTLO=" '(s vtlo
)))
5435 (p "<Transit time>: " tpd
'noinsert
)
5436 (if (string-equal (tempo-lookup-named 'tpd
) "")
5437 (list 'l
"TPD=1.0ns") ;; default value
5438 (list 'l
"TPD=" '(s tpd
)))
5440 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5441 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5442 (list 'l
"") ;; default value
5443 (list 'l
"TPDUP=" '(s tpdup
)))
5445 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5446 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5447 (list 'l
"") ;; default value
5448 (list 'l
"TPDOWN=" '(s tpdown
)))
5450 (p "<Input capacitance>: " cin
'noinsert
)
5451 (if (string-equal (tempo-lookup-named 'cin
) "")
5452 (list 'l
"CIN=0.0") ;; default value
5453 (list 'l
"CIN=" '(s cin
)))
5457 "template for inserting an ELDO Exclusive-OR gate macromodel"
5460 (tempo-define-template
5463 (p "[Instance name]: ") " "
5464 (p "[First input]: ") " "
5465 (p "[Second input]: ") " "
5466 (p "[Output]: ") " "
5467 (p "[Model name]: ") " "
5468 (p "<Vhigh>: " vhi
'noinsert
)
5469 (if (string-equal (tempo-lookup-named 'vhi
) "")
5470 (list 'l
"VHI=5.0") ;; default value
5471 (list 'l
"VHI=" '(s vhi
)))
5473 (p "<Vlow>: " vlo
'noinsert
)
5474 (if (string-equal (tempo-lookup-named 'vlo
) "")
5475 (list 'l
"VLO=0.0") ;; default value
5476 (list 'l
"VLO=" '(s vlo
)))
5478 (p "<Threshold input voltage>: " vth
'noinsert
)
5479 (if (string-equal (tempo-lookup-named 'vth
) "")
5480 (list 'l
"VTH=2.5") ;; default value
5481 (list 'l
"VTH=" '(s vth
)))
5483 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5484 (if (string-equal (tempo-lookup-named 'vthi
) "")
5485 (list 'l
"") ;; default value
5486 (list 'l
"VTHI=" '(s vthi
)))
5488 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5489 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5490 (list 'l
"") ;; default value
5491 (list 'l
"VTLO=" '(s vtlo
)))
5493 (p "<Transit time>: " tpd
'noinsert
)
5494 (if (string-equal (tempo-lookup-named 'tpd
) "")
5495 (list 'l
"TPD=1.0ns") ;; default value
5496 (list 'l
"TPD=" '(s tpd
)))
5498 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5499 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5500 (list 'l
"") ;; default value
5501 (list 'l
"TPDUP=" '(s tpdup
)))
5503 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5504 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5505 (list 'l
"") ;; default value
5506 (list 'l
"TPDOWN=" '(s tpdown
)))
5508 (p "<Input capacitance>: " cin
'noinsert
)
5509 (if (string-equal (tempo-lookup-named 'cin
) "")
5510 (list 'l
"CIN=0.0") ;; default value
5511 (list 'l
"CIN=" '(s cin
)))
5515 "template for inserting an ELDO 2 input AND gate macromodel"
5519 (tempo-define-template
5522 (p "[Instance name]: ") " "
5523 (p "[First input]: ") " "
5524 (p "[Second input]: ") " "
5525 (p "[Output]: ") " "
5526 (p "[Model name]: ") " "
5527 (p "<Vhigh>: " vhi
'noinsert
)
5528 (if (string-equal (tempo-lookup-named 'vhi
) "")
5529 (list 'l
"VHI=5.0") ;; default value
5530 (list 'l
"VHI=" '(s vhi
)))
5532 (p "<Vlow>: " vlo
'noinsert
)
5533 (if (string-equal (tempo-lookup-named 'vlo
) "")
5534 (list 'l
"VLO=0.0") ;; default value
5535 (list 'l
"VLO=" '(s vlo
)))
5537 (p "<Threshold input voltage>: " vth
'noinsert
)
5538 (if (string-equal (tempo-lookup-named 'vth
) "")
5539 (list 'l
"VTH=2.5") ;; default value
5540 (list 'l
"VTH=" '(s vth
)))
5542 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5543 (if (string-equal (tempo-lookup-named 'vthi
) "")
5544 (list 'l
"") ;; default value
5545 (list 'l
"VTHI=" '(s vthi
)))
5547 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5548 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5549 (list 'l
"") ;; default value
5550 (list 'l
"VTLO=" '(s vtlo
)))
5552 (p "<Transit time>: " tpd
'noinsert
)
5553 (if (string-equal (tempo-lookup-named 'tpd
) "")
5554 (list 'l
"TPD=1.0ns") ;; default value
5555 (list 'l
"TPD=" '(s tpd
)))
5557 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5558 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5559 (list 'l
"") ;; default value
5560 (list 'l
"TPDUP=" '(s tpdup
)))
5562 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5563 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5564 (list 'l
"") ;; default value
5565 (list 'l
"TPDOWN=" '(s tpdown
)))
5567 (p "<Input capacitance>: " cin
'noinsert
)
5568 (if (string-equal (tempo-lookup-named 'cin
) "")
5569 (list 'l
"CIN=0.0") ;; default value
5570 (list 'l
"CIN=" '(s cin
)))
5574 "template for inserting an ELDO 2 input NAND gate macromodel"
5577 (tempo-define-template
5580 (p "[Instance name]: ") " "
5581 (p "[First input]: ") " "
5582 (p "[Second input]: ") " "
5583 (p "[Output]: ") " "
5584 (p "[Model name]: ") " "
5585 (p "<Vhigh>: " vhi
'noinsert
)
5586 (if (string-equal (tempo-lookup-named 'vhi
) "")
5587 (list 'l
"VHI=5.0") ;; default value
5588 (list 'l
"VHI=" '(s vhi
)))
5590 (p "<Vlow>: " vlo
'noinsert
)
5591 (if (string-equal (tempo-lookup-named 'vlo
) "")
5592 (list 'l
"VLO=0.0") ;; default value
5593 (list 'l
"VLO=" '(s vlo
)))
5595 (p "<Threshold input voltage>: " vth
'noinsert
)
5596 (if (string-equal (tempo-lookup-named 'vth
) "")
5597 (list 'l
"VTH=2.5") ;; default value
5598 (list 'l
"VTH=" '(s vth
)))
5600 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5601 (if (string-equal (tempo-lookup-named 'vthi
) "")
5602 (list 'l
"") ;; default value
5603 (list 'l
"VTHI=" '(s vthi
)))
5605 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5606 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5607 (list 'l
"") ;; default value
5608 (list 'l
"VTLO=" '(s vtlo
)))
5610 (p "<Transit time>: " tpd
'noinsert
)
5611 (if (string-equal (tempo-lookup-named 'tpd
) "")
5612 (list 'l
"TPD=1.0ns") ;; default value
5613 (list 'l
"TPD=" '(s tpd
)))
5615 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5616 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5617 (list 'l
"") ;; default value
5618 (list 'l
"TPDUP=" '(s tpdup
)))
5620 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5621 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5622 (list 'l
"") ;; default value
5623 (list 'l
"TPDOWN=" '(s tpdown
)))
5625 (p "<Input capacitance>: " cin
'noinsert
)
5626 (if (string-equal (tempo-lookup-named 'cin
) "")
5627 (list 'l
"CIN=0.0") ;; default value
5628 (list 'l
"CIN=" '(s cin
)))
5632 "template for inserting an ELDO 2 input OR gate macromodel"
5635 (tempo-define-template
5638 (p "[Instance name]: ") " "
5639 (p "[First input]: ") " "
5640 (p "[Second input]: ") " "
5641 (p "[Output]: ") " "
5642 (p "[Model name]: ") " "
5643 (p "<Vhigh>: " vhi
'noinsert
)
5644 (if (string-equal (tempo-lookup-named 'vhi
) "")
5645 (list 'l
"VHI=5.0") ;; default value
5646 (list 'l
"VHI=" '(s vhi
)))
5648 (p "<Vlow>: " vlo
'noinsert
)
5649 (if (string-equal (tempo-lookup-named 'vlo
) "")
5650 (list 'l
"VLO=0.0") ;; default value
5651 (list 'l
"VLO=" '(s vlo
)))
5653 (p "<Threshold input voltage>: " vth
'noinsert
)
5654 (if (string-equal (tempo-lookup-named 'vth
) "")
5655 (list 'l
"VTH=2.5") ;; default value
5656 (list 'l
"VTH=" '(s vth
)))
5658 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5659 (if (string-equal (tempo-lookup-named 'vthi
) "")
5660 (list 'l
"") ;; default value
5661 (list 'l
"VTHI=" '(s vthi
)))
5663 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5664 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5665 (list 'l
"") ;; default value
5666 (list 'l
"VTLO=" '(s vtlo
)))
5668 (p "<Transit time>: " tpd
'noinsert
)
5669 (if (string-equal (tempo-lookup-named 'tpd
) "")
5670 (list 'l
"TPD=1.0ns") ;; default value
5671 (list 'l
"TPD=" '(s tpd
)))
5673 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5674 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5675 (list 'l
"") ;; default value
5676 (list 'l
"TPDUP=" '(s tpdup
)))
5678 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5679 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5680 (list 'l
"") ;; default value
5681 (list 'l
"TPDOWN=" '(s tpdown
)))
5683 (p "<Input capacitance>: " cin
'noinsert
)
5684 (if (string-equal (tempo-lookup-named 'cin
) "")
5685 (list 'l
"CIN=0.0") ;; default value
5686 (list 'l
"CIN=" '(s cin
)))
5690 "template for inserting an ELDO 2 input NOR gate macromodel"
5694 (tempo-define-template
5697 (p "[Instance name]: ") " "
5698 (p "[First input]: ") " "
5699 (p "[Second input]: ") " "
5700 (p "[Output]: ") " "
5701 (p "[Model name]: ") " "
5702 (p "<Vhigh>: " vhi
'noinsert
)
5703 (if (string-equal (tempo-lookup-named 'vhi
) "")
5704 (list 'l
"VHI=5.0") ;; default value
5705 (list 'l
"VHI=" '(s vhi
)))
5707 (p "<Vlow>: " vlo
'noinsert
)
5708 (if (string-equal (tempo-lookup-named 'vlo
) "")
5709 (list 'l
"VLO=0.0") ;; default value
5710 (list 'l
"VLO=" '(s vlo
)))
5712 (p "<Threshold input voltage>: " vth
'noinsert
)
5713 (if (string-equal (tempo-lookup-named 'vth
) "")
5714 (list 'l
"VTH=2.5") ;; default value
5715 (list 'l
"VTH=" '(s vth
)))
5717 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5718 (if (string-equal (tempo-lookup-named 'vthi
) "")
5719 (list 'l
"") ;; default value
5720 (list 'l
"VTHI=" '(s vthi
)))
5722 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5723 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5724 (list 'l
"") ;; default value
5725 (list 'l
"VTLO=" '(s vtlo
)))
5727 (p "<Transit time>: " tpd
'noinsert
)
5728 (if (string-equal (tempo-lookup-named 'tpd
) "")
5729 (list 'l
"TPD=1.0ns") ;; default value
5730 (list 'l
"TPD=" '(s tpd
)))
5732 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5733 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5734 (list 'l
"") ;; default value
5735 (list 'l
"TPDUP=" '(s tpdup
)))
5737 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5738 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5739 (list 'l
"") ;; default value
5740 (list 'l
"TPDOWN=" '(s tpdown
)))
5742 (p "<Input capacitance>: " cin
'noinsert
)
5743 (if (string-equal (tempo-lookup-named 'cin
) "")
5744 (list 'l
"CIN=0.0") ;; default value
5745 (list 'l
"CIN=" '(s cin
)))
5749 "template for inserting an ELDO 3 input AND gate macromodel"
5753 (tempo-define-template
5756 (p "[Instance name]: ") " "
5757 (p "[First input]: ") " "
5758 (p "[Second input]: ") " "
5759 (p "[Output]: ") " "
5760 (p "[Model name]: ") " "
5761 (p "<Vhigh>: " vhi
'noinsert
)
5762 (if (string-equal (tempo-lookup-named 'vhi
) "")
5763 (list 'l
"VHI=5.0") ;; default value
5764 (list 'l
"VHI=" '(s vhi
)))
5766 (p "<Vlow>: " vlo
'noinsert
)
5767 (if (string-equal (tempo-lookup-named 'vlo
) "")
5768 (list 'l
"VLO=0.0") ;; default value
5769 (list 'l
"VLO=" '(s vlo
)))
5771 (p "<Threshold input voltage>: " vth
'noinsert
)
5772 (if (string-equal (tempo-lookup-named 'vth
) "")
5773 (list 'l
"VTH=2.5") ;; default value
5774 (list 'l
"VTH=" '(s vth
)))
5776 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5777 (if (string-equal (tempo-lookup-named 'vthi
) "")
5778 (list 'l
"") ;; default value
5779 (list 'l
"VTHI=" '(s vthi
)))
5781 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5782 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5783 (list 'l
"") ;; default value
5784 (list 'l
"VTLO=" '(s vtlo
)))
5786 (p "<Transit time>: " tpd
'noinsert
)
5787 (if (string-equal (tempo-lookup-named 'tpd
) "")
5788 (list 'l
"TPD=1.0ns") ;; default value
5789 (list 'l
"TPD=" '(s tpd
)))
5791 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5792 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5793 (list 'l
"") ;; default value
5794 (list 'l
"TPDUP=" '(s tpdup
)))
5796 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5797 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5798 (list 'l
"") ;; default value
5799 (list 'l
"TPDOWN=" '(s tpdown
)))
5801 (p "<Input capacitance>: " cin
'noinsert
)
5802 (if (string-equal (tempo-lookup-named 'cin
) "")
5803 (list 'l
"CIN=0.0") ;; default value
5804 (list 'l
"CIN=" '(s cin
)))
5808 "template for inserting an ELDO 3 input NAND gate macromodel"
5811 (tempo-define-template
5814 (p "[Instance name]: ") " "
5815 (p "[First input]: ") " "
5816 (p "[Second input]: ") " "
5817 (p "[Output]: ") " "
5818 (p "[Model name]: ") " "
5819 (p "<Vhigh>: " vhi
'noinsert
)
5820 (if (string-equal (tempo-lookup-named 'vhi
) "")
5821 (list 'l
"VHI=5.0") ;; default value
5822 (list 'l
"VHI=" '(s vhi
)))
5824 (p "<Vlow>: " vlo
'noinsert
)
5825 (if (string-equal (tempo-lookup-named 'vlo
) "")
5826 (list 'l
"VLO=0.0") ;; default value
5827 (list 'l
"VLO=" '(s vlo
)))
5829 (p "<Threshold input voltage>: " vth
'noinsert
)
5830 (if (string-equal (tempo-lookup-named 'vth
) "")
5831 (list 'l
"VTH=2.5") ;; default value
5832 (list 'l
"VTH=" '(s vth
)))
5834 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5835 (if (string-equal (tempo-lookup-named 'vthi
) "")
5836 (list 'l
"") ;; default value
5837 (list 'l
"VTHI=" '(s vthi
)))
5839 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5840 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5841 (list 'l
"") ;; default value
5842 (list 'l
"VTLO=" '(s vtlo
)))
5844 (p "<Transit time>: " tpd
'noinsert
)
5845 (if (string-equal (tempo-lookup-named 'tpd
) "")
5846 (list 'l
"TPD=1.0ns") ;; default value
5847 (list 'l
"TPD=" '(s tpd
)))
5849 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5850 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5851 (list 'l
"") ;; default value
5852 (list 'l
"TPDUP=" '(s tpdup
)))
5854 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5855 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5856 (list 'l
"") ;; default value
5857 (list 'l
"TPDOWN=" '(s tpdown
)))
5859 (p "<Input capacitance>: " cin
'noinsert
)
5860 (if (string-equal (tempo-lookup-named 'cin
) "")
5861 (list 'l
"CIN=0.0") ;; default value
5862 (list 'l
"CIN=" '(s cin
)))
5866 "template for inserting an ELDO 3 input OR gate macromodel"
5869 (tempo-define-template
5872 (p "[Instance name]: ") " "
5873 (p "[First input]: ") " "
5874 (p "[Second input]: ") " "
5875 (p "[Output]: ") " "
5876 (p "[Model name]: ") " "
5877 (p "<Vhigh>: " vhi
'noinsert
)
5878 (if (string-equal (tempo-lookup-named 'vhi
) "")
5879 (list 'l
"VHI=5.0") ;; default value
5880 (list 'l
"VHI=" '(s vhi
)))
5882 (p "<Vlow>: " vlo
'noinsert
)
5883 (if (string-equal (tempo-lookup-named 'vlo
) "")
5884 (list 'l
"VLO=0.0") ;; default value
5885 (list 'l
"VLO=" '(s vlo
)))
5887 (p "<Threshold input voltage>: " vth
'noinsert
)
5888 (if (string-equal (tempo-lookup-named 'vth
) "")
5889 (list 'l
"VTH=2.5") ;; default value
5890 (list 'l
"VTH=" '(s vth
)))
5892 (p "<Threshold input voltage rising edge>: " vthi
'noinsert
)
5893 (if (string-equal (tempo-lookup-named 'vthi
) "")
5894 (list 'l
"") ;; default value
5895 (list 'l
"VTHI=" '(s vthi
)))
5897 (p "<Threshold input voltage falling edge>: " vtlo
'noinsert
)
5898 (if (string-equal (tempo-lookup-named 'vtlo
) "")
5899 (list 'l
"") ;; default value
5900 (list 'l
"VTLO=" '(s vtlo
)))
5902 (p "<Transit time>: " tpd
'noinsert
)
5903 (if (string-equal (tempo-lookup-named 'tpd
) "")
5904 (list 'l
"TPD=1.0ns") ;; default value
5905 (list 'l
"TPD=" '(s tpd
)))
5907 (p "<Transit time for output to reach VTHI>: " tpdup
'noinsert
)
5908 (if (string-equal (tempo-lookup-named 'tpdup
) "")
5909 (list 'l
"") ;; default value
5910 (list 'l
"TPDUP=" '(s tpdup
)))
5912 (p "<Transit time for output to reach VTLO>: " tpdown
'noinsert
)
5913 (if (string-equal (tempo-lookup-named 'tpdown
) "")
5914 (list 'l
"") ;; default value
5915 (list 'l
"TPDOWN=" '(s tpdown
)))
5917 (p "<Input capacitance>: " cin
'noinsert
)
5918 (if (string-equal (tempo-lookup-named 'cin
) "")
5919 (list 'l
"CIN=0.0") ;; default value
5920 (list 'l
"CIN=" '(s cin
)))
5924 "template for inserting an ELDO 3 input NOR gate macromodel"
5927 ;; -------------------------
5928 ;; Mixed signal Macromodels
5929 ;; -------------------------
5931 (tempo-define-template
5934 (p "[Instance name]: ") " "
5936 (p "[Analog input]: ") " "
5937 (p "[Digital Outputs from MSB to LSB]: ") " "
5938 (p "<Edge (1/-1)>: " edge
'noinsert
)
5939 (if (string-equal (tempo-lookup-named 'edge
) "")
5940 (list 'l
"EDGE=1") ;; default value
5941 (list 'l
"EDGE=-1"))
5943 (p "<Threshold clock voltage>: " vth
'noinsert
)
5944 (if (string-equal (tempo-lookup-named 'vth
) "")
5945 (list 'l
"VTH=2.5") ;; default value
5946 (list 'l
"VTH=" '(s vth
)))
5948 (p "<Vhigh>: " vhi
'noinsert
)
5949 (if (string-equal (tempo-lookup-named 'vhi
) "")
5950 (list 'l
"VHI=5.0") ;; default value
5951 (list 'l
"VHI=" '(s vhi
)))
5953 (p "<Vlow>: " vlo
'noinsert
)
5954 (if (string-equal (tempo-lookup-named 'vlo
) "")
5955 (list 'l
"VLO=0.0") ;; default value
5956 (list 'l
"VLO=" '(s vlo
)))
5958 (p "<Analog input lower voltage>: " vinf
'noinsert
)
5959 (if (string-equal (tempo-lookup-named 'vinf
) "")
5960 (list 'l
"VINF=0.0") ;; default value
5961 (list 'l
"VTHI=" '(s vinf
)))
5963 (p "<Analog input higher voltage>: " vsup
'noinsert
)
5964 (if (string-equal (tempo-lookup-named 'vsup
) "")
5965 (list 'l
"VSUP=5.0") ;; default value
5966 (list 'l
"VSUP=" '(s vsup
)))
5968 (p "<Output bits commutation time>: " tcom
'noinsert
)
5969 (if (string-equal (tempo-lookup-named 'tcom
) "")
5970 (list 'l
"TCOM=1.0ns") ;; default value
5971 (list 'l
"TCOM=" '(s tcom
)))
5973 (p "<Transit time>: " tpd
'noinsert
)
5974 (if (string-equal (tempo-lookup-named 'tpd
) "")
5975 (list 'l
"TPD=10ns") ;; default value
5976 (list 'l
"TPD=" '(s tpd
)))
5980 "template for inserting an ELDO Analog to Digital Converter macromodel"
5983 (tempo-define-template
5986 (p "[Instance name]: ") " "
5988 (p "[Digital inputs from MSB to LSB]: ") " "
5989 (p "[Analog output]: ") " "
5990 (p "<Edge (1/-1)>: " edge
'noinsert
)
5991 (if (string-equal (tempo-lookup-named 'edge
) "")
5992 (list 'l
"EDGE=1") ;; default value
5993 (list 'l
"EDGE=-1"))
5995 (p "<Threshold clock voltage>: " vth
'noinsert
)
5996 (if (string-equal (tempo-lookup-named 'vth
) "")
5997 (list 'l
"VTH=2.5") ;; default value
5998 (list 'l
"VTH=" '(s vth
)))
6000 (p "<Threshold input voltage>: " vtin
'noinsert
)
6001 (if (string-equal (tempo-lookup-named 'vtin
) "")
6002 (list 'l
"VTIN=2.5") ;; default value
6003 (list 'l
"VTIN=" '(s vtin
)))
6005 (p "<Analog Output Vhigh>: " vhi
'noinsert
)
6006 (if (string-equal (tempo-lookup-named 'vhi
) "")
6007 (list 'l
"VHI=5.0") ;; default value
6008 (list 'l
"VHI=" '(s vhi
)))
6010 (p "<Analog Output Vlow>: " vlo
'noinsert
)
6011 (if (string-equal (tempo-lookup-named 'vlo
) "")
6012 (list 'l
"VLO=0.0") ;; default value
6013 (list 'l
"VLO=" '(s vlo
)))
6015 (p "<Transit time>: " tpd
'noinsert
)
6016 (if (string-equal (tempo-lookup-named 'tpd
) "")
6017 (list 'l
"TPD=10ns") ;; default value
6018 (list 'l
"TPD=" '(s tpd
)))
6020 (p "<Output slope (V/s)>: " sl
'noinsert
)
6021 (if (string-equal (tempo-lookup-named 'sl
) "")
6022 (list 'l
"SL=10e8") ;; default value
6023 (list 'l
"SL=" '(s tcom
)))
6027 "template for inserting an ELDO Digital to Analog Converter macromodel"
6030 ;; -------------------------
6031 ;; Switched cap Macromodels
6032 ;; -------------------------
6034 (tempo-define-template
6035 "spice-eldo-switchcap-opa"
6037 (p "[Instance name]: ") " "
6038 (p "[Positive input]: ") " "
6039 (p "[Negative input]: ") " "
6040 (p "[Positive Output]: ") " "
6041 (p "[Negative Output]: ") " "
6042 (p "[Model name]: ") " "
6043 (p "<Input offset>: " voff
'noinsert
)
6044 (if (string-equal (tempo-lookup-named 'voff
) "")
6045 (list 'l
"VOFF=0.0") ;; default value
6046 (list 'l
"VOFF=" '(s voff
)))
6048 (p "<Slew rate (V/s)>: " sl
'noinsert
)
6049 (if (string-equal (tempo-lookup-named 'sl
) "")
6050 (list 'l
"SL=1e6") ;; default value
6051 (list 'l
"SL=" '(s voff
)))
6053 (p "<Gain>: " gain
'noinsert
)
6054 (if (string-equal (tempo-lookup-named 'gain
) "")
6055 (list 'l
"GAIN=1e5") ;; default value
6056 (list 'l
"GAIN=" '(s gain
)))
6058 (p "<Input capacitance>: " cin
'noinsert
)
6059 (if (string-equal (tempo-lookup-named 'cin
) "")
6060 (list 'l
"CIN=0") ;; default value
6061 (list 'l
"CIN=" '(s cin
)))
6063 (p "<Output resistance>: " rs
'noinsert
)
6064 (if (string-equal (tempo-lookup-named 'rs
) "")
6065 (list 'l
"RS=10e6") ;; default value
6066 (list 'l
"RS=" '(s rs
)))
6068 (p "<Symmetrical saturation voltage>: " vsat
'noinsert
)
6069 (if (string-equal (tempo-lookup-named 'vsat
) "")
6070 (list 'l
"VSAT=5.0") ;; default value
6071 (list 'l
"VSAT=" '(s vsat
)))
6073 (p "<Asymmetrical saturation voltage>: " vsatm
'noinsert
)
6074 (if (string-equal (tempo-lookup-named 'vsatm
) "")
6075 (list 'l
"VSATM=5.0") ;; default value
6076 (list 'l
"VSATM=" '(s vsatm
)))
6078 (p "<Cutoff frequency (double stage only)>: " fc
'noinsert
)
6079 (if (string-equal (tempo-lookup-named 'fc
) "")
6080 (list 'l
"FC=1k") ;; default value
6081 (list 'l
"FC=" '(s fc
)))
6083 (p "<Non-dominant pole (single stage only)>: " fndp
'noinsert
)
6084 (if (string-equal (tempo-lookup-named 'fndp
) "")
6085 (list 'l
"FNDP=1k") ;; default value
6086 (list 'l
"FNDP=" '(s fndp
)))
6088 (p "<Max current>: " imax
'noinsert
)
6089 (if (string-equal (tempo-lookup-named 'imax
) "")
6090 (list 'l
"IMAX=100mA") ;; default value
6091 (list 'l
"IMAX=" '(s imax
)))
6093 (p "<Common mode rejection ratio>: " cmrr
'noinsert
)
6094 (if (string-equal (tempo-lookup-named 'cmrr
) "")
6095 (list 'l
"CMRR=0.0") ;; default value
6096 (list 'l
"CMRR=" '(s cmrr
)))
6099 "template for inserting an ELDO differential single or double stage opamp"
6103 (tempo-define-template
6106 (p "[Instance name]: ") " "
6107 (p "[Controlling node]: ") " "
6108 (p "[Node 1]: ") " "
6109 (p "[Node 2]: ") " "
6110 (p "[Model name]: ") " "
6111 (p "<RON resistance>: " ron
'noinsert
)
6112 (if (string-equal (tempo-lookup-named 'ron
) "")
6113 (list 'l
"RON=1k") ;; default value
6114 (list 'l
"RON=" '(s ron
)))
6116 (p "<Overlap capacitance>: " crec
'noinsert
)
6117 (if (string-equal (tempo-lookup-named 'crec
) "")
6118 (list 'l
"CREC=0") ;; default value
6119 (list 'l
"CREC=" '(s crec
)))
6122 "template for inserting an ELDO switch macromodel"
6129 (tempo-define-template
6132 (p "[Name of port]: ") " "
6133 (p "[Name of net]: ") " "
6136 "template for inserting a Layla port"
6139 (tempo-define-template
6142 (p "[Name of performance]: ") " "
6143 (p "[Nominal value]: ") " \n+"
6144 (p "[Weight (alfa)]: ") " "
6145 ; (p "[Weight (alfa)]: ") " "
6148 "template for inserting a Layla performance"
6151 (tempo-define-template
6154 (p "[Name of net]: ") " "
6157 "template for inserting a Layla net"
6160 (tempo-define-template
6163 (p "[Name of bus]: ") " "
6166 "template for inserting a Layla bus"
6169 (defmacro spice-layla-function-template
(name type
)
6170 "Create a layla tempo define for NAME and TYPE."
6172 (setq p_prompt
(concat "[Name of " ,name
"]: "))
6173 (tempo-define-template
6174 (concat "layla-" ,name
"-" ,type
)
6175 (list (concat "." ,name
"_" ,type
"_param(")
6176 (list 'p p_prompt
) ", "
6177 '(p "[Name of parameter]: ") ", "
6178 '(p "[Value of parameter]: ") ")"
6180 (concat "layla-" ,name
"-" ,type
)
6181 (concat "template for inserting a " ,type
" parameter for a Layla " ,name
)
6182 'spice-tempo-tags
)))
6184 (spice-layla-function-template "bus" "double")
6185 (spice-layla-function-template "bus" "integer")
6186 (spice-layla-function-template "bus" "string")
6187 (spice-layla-function-template "device" "double")
6188 (spice-layla-function-template "device" "integer")
6189 (spice-layla-function-template "device" "string")
6190 (spice-layla-function-template "net" "double")
6191 (spice-layla-function-template "net" "integer")
6192 (spice-layla-function-template "net" "string")
6193 (spice-layla-function-template "placement" "double")
6194 (spice-layla-function-template "placement" "integer")
6195 (spice-layla-function-template "placement" "string")
6196 (spice-layla-function-template "port" "double")
6197 (spice-layla-function-template "port" "integer")
6198 (spice-layla-function-template "port" "string")
6199 (spice-layla-function-template "symmetry" "double")
6200 (spice-layla-function-template "symmetry" "integer")
6201 (spice-layla-function-template "symmetry" "string")
6204 ;;------------------------------------------------------------
6205 ;; Abbrev hook bindings (taken from eldo-mode)
6207 (defvar spice-mode-abbrev-table nil
6208 "Abbrev table to use in `spice-mode' buffers.")
6210 ;; the table, global init inline here:
6211 (if spice-mode-abbrev-table
6213 (let ((ac abbrevs-changed
))
6214 (define-abbrev-table 'spice-mode-abbrev-table
())
6215 ;; passive elements:
6218 (define-abbrev spice-mode-abbrev-table
"r" "" 'tempo-template-spice-spice2g6-resistor
)
6219 (define-abbrev spice-mode-abbrev-table
"rss" "" 'tempo-template-spice-spice3-semiconductor-resistor
)
6220 (define-abbrev spice-mode-abbrev-table
"re" "" 'tempo-template-spice-eldo-resistor
)
6221 (define-abbrev spice-mode-abbrev-table
"ree" "" 'tempo-template-spice-eldo-expression-resistor
)
6222 (define-abbrev spice-mode-abbrev-table
"res" "" 'tempo-template-spice-eldo-semiconductor-resistor
)
6223 (define-abbrev spice-mode-abbrev-table
"rh" "" 'tempo-template-spice-hspice-resistor
)
6224 (define-abbrev spice-mode-abbrev-table
"rl" "" 'tempo-template-spice-layla-resistor
)
6227 (define-abbrev spice-mode-abbrev-table
"c" "" 'tempo-template-spice-spice2g6-capacitor
)
6228 (define-abbrev spice-mode-abbrev-table
"css" "" 'tempo-template-spice-spice3-semiconductor-capacitor
)
6229 (define-abbrev spice-mode-abbrev-table
"ce" "" 'tempo-template-spice-eldo-capacitor
)
6230 (define-abbrev spice-mode-abbrev-table
"cee" "" 'tempo-template-spice-eldo-expression-capacitor
)
6231 (define-abbrev spice-mode-abbrev-table
"ch" "" 'tempo-template-spice-hspice-capacitor
)
6232 (define-abbrev spice-mode-abbrev-table
"cl" "" 'tempo-template-spice-layla-capacitor
)
6235 (define-abbrev spice-mode-abbrev-table
"l" "" 'tempo-template-spice-spice2g6-inductor
)
6236 (define-abbrev spice-mode-abbrev-table
"le" "" 'tempo-template-spice-eldo-inductor
)
6237 (define-abbrev spice-mode-abbrev-table
"lee" "" 'tempo-template-spice-eldo-expression-inductor
)
6238 (define-abbrev spice-mode-abbrev-table
"lh" "" 'tempo-template-spice-hspice-inductor
)
6239 (define-abbrev spice-mode-abbrev-table
"ll" "" 'tempo-template-spice-layla-inductor
)
6241 ;; coupled inductors
6242 (define-abbrev spice-mode-abbrev-table
"k" "" 'tempo-template-spice-spice2g6-coupled-inductors
)
6244 ;; lossless transmission lines
6245 (define-abbrev spice-mode-abbrev-table
"t" "" 'tempo-template-spice-spice2g6-lossless-transmission
)
6246 (define-abbrev spice-mode-abbrev-table
"te" "" 'tempo-template-spice-spice2g6-lossless-transmission
)
6247 (define-abbrev spice-mode-abbrev-table
"th" "" 'tempo-template-spice-hspice-lossless-transmission
)
6249 ;; lossy transmission lines
6250 (define-abbrev spice-mode-abbrev-table
"o" "" 'tempo-template-spice-spice2g6-lossy-transmission
)
6252 (define-abbrev spice-mode-abbrev-table
"rcls" "" 'tempo-template-spice-spice3-rcline
)
6254 (define-abbrev spice-mode-abbrev-table
"rcle" "" 'tempo-template-spice-eldo-rcline
)
6255 ; eldo lossy transmission line
6261 (define-abbrev spice-mode-abbrev-table
"d" "" 'tempo-template-spice-spice2g6-diode
)
6262 (define-abbrev spice-mode-abbrev-table
"de" "" 'tempo-template-spice-eldo-diode
)
6263 (define-abbrev spice-mode-abbrev-table
"dh" "" 'tempo-template-spice-hspice-diode
)
6264 (define-abbrev spice-mode-abbrev-table
"dl" "" 'tempo-template-spice-layla-diode
)
6267 (define-abbrev spice-mode-abbrev-table
"q" "" 'tempo-template-spice-spice2g6-bipolar
)
6268 (define-abbrev spice-mode-abbrev-table
"qe" "" 'tempo-template-spice-eldo-bipolar
)
6269 (define-abbrev spice-mode-abbrev-table
"qh" "" 'tempo-template-spice-hspice-bipolar
)
6273 (define-abbrev spice-mode-abbrev-table
"j" "" 'tempo-template-spice-spice2g6-jfet
)
6274 (define-abbrev spice-mode-abbrev-table
"je" "" 'tempo-template-spice-eldo-jfet
)
6275 (define-abbrev spice-mode-abbrev-table
"jh" "" 'tempo-template-spice-hspice-jfet
)
6279 (define-abbrev spice-mode-abbrev-table
"m" "" 'tempo-template-spice-spice2g6-mosfet
)
6280 (define-abbrev spice-mode-abbrev-table
"me" "" 'tempo-template-spice-eldo-mosfet
)
6281 (define-abbrev spice-mode-abbrev-table
"mh" "" 'tempo-template-spice-hspice-mosfet
)
6282 (define-abbrev spice-mode-abbrev-table
"ml" "" 'tempo-template-spice-layla-mosfet
)
6286 (define-abbrev spice-mode-abbrev-table
"z" "" 'tempo-template-spice-spice2g6-mesfet
)
6289 (define-abbrev spice-mode-abbrev-table
"sub" "" 'tempo-template-spice-spice2g6-subckt
)
6291 ;; controlled sources
6292 (define-abbrev spice-mode-abbrev-table
"vcvs" "" 'tempo-template-spice-spice2g6-vcvs
)
6293 (define-abbrev spice-mode-abbrev-table
"e" "" 'tempo-template-spice-spice2g6-vcvs
)
6294 (define-abbrev spice-mode-abbrev-table
"ccvs" "" 'tempo-template-spice-spice2g6-ccvs
)
6295 (define-abbrev spice-mode-abbrev-table
"h" "" 'tempo-template-spice-spice2g6-ccvs
)
6296 (define-abbrev spice-mode-abbrev-table
"vccs" "" 'tempo-template-spice-spice2g6-vccs
)
6297 (define-abbrev spice-mode-abbrev-table
"g" "" 'tempo-template-spice-spice2g6-vccs
)
6298 (define-abbrev spice-mode-abbrev-table
"cccs" "" 'tempo-template-spice-spice2g6-cccs
)
6299 (define-abbrev spice-mode-abbrev-table
"f" "" 'tempo-template-spice-spice2g6-cccs
)
6301 ;; transient signals
6302 (define-abbrev spice-mode-abbrev-table
"pwl" "" '(spice-pwl))
6303 (define-abbrev spice-mode-abbrev-table
"pu" "" 'tempo-template-spice-pulse
)
6304 ;(define-abbrev spice-mode-abbrev-table "'su" "" 'tempo-template-spice-subckt)
6305 ;(define-abbrev spice-mode-abbrev-table "'ac" "" 'tempo-template-spice-ac)
6306 (define-abbrev spice-mode-abbrev-table
"sin" "" 'tempo-template-spice-sine
)
6307 ;(define-abbrev spice-mode-abbrev-table "'sffm" "" 'tempo-template-spice-hspice-sffm)
6308 (define-abbrev spice-mode-abbrev-table
"exp" "" 'tempo-template-spice-exp
)
6309 (define-abbrev spice-mode-abbrev-table
"noi" "" 'tempo-template-spice-eldo-noise
)
6310 (define-abbrev spice-mode-abbrev-table
"pat" "" 'tempo-template-spice-eldo-pattern
)
6312 ;; behavioral models
6314 (define-abbrev spice-mode-abbrev-table
"comp" "" 'tempo-template-spice-eldo-comp
)
6315 (define-abbrev spice-mode-abbrev-table
"compd" "" 'tempo-template-spice-eldo-compd
)
6316 (define-abbrev spice-mode-abbrev-table
"opa0" "" 'tempo-template-spice-eldo-linear-opa0
)
6317 (define-abbrev spice-mode-abbrev-table
"opa0d" "" 'tempo-template-spice-eldo-linear-opa0d
)
6318 (define-abbrev spice-mode-abbrev-table
"opa1" "" 'tempo-template-spice-eldo-linear-opa0
)
6319 (define-abbrev spice-mode-abbrev-table
"opa1d" "" 'tempo-template-spice-eldo-linear-opa0d
)
6320 (define-abbrev spice-mode-abbrev-table
"opa2" "" 'tempo-template-spice-eldo-linear-opa0
)
6321 (define-abbrev spice-mode-abbrev-table
"opa2d" "" 'tempo-template-spice-eldo-linear-opa0d
)
6324 (define-abbrev spice-mode-abbrev-table
"phmag" "" 'tempo-template-spice-eldo-phmag
)
6325 (define-abbrev spice-mode-abbrev-table
"gmag" "" 'tempo-template-spice-eldo-gmag
)
6326 (define-abbrev spice-mode-abbrev-table
"fc" "" 'tempo-template-spice-eldo-fc
)
6327 (define-abbrev spice-mode-abbrev-table
"ugfc" "" 'tempo-template-spice-eldo-ugfc
)
6328 (define-abbrev spice-mode-abbrev-table
"tf" "" 'tempo-template-spice-eldo-period
)
6329 (define-abbrev spice-mode-abbrev-table
"tfm" "" 'tempo-template-spice-eldo-period-macro
)
6330 (define-abbrev spice-mode-abbrev-table
"dc" "" 'tempo-template-spice-eldo-duty-macro
)
6331 (define-abbrev spice-mode-abbrev-table
"he" "" 'tempo-template-spice-eldo-circuit-header
)
6332 (setq abbrevs-changed ac
)))
6335 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6337 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6339 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6340 ;; Spice menu (using `easy-menu.el')
6342 (defun spice-create-mode-menu ()
6343 "Create Spice Mode menu."
6348 ["Comment Region" comment-region
(and (mark) (not buffer-read-only
))]
6349 ["Uncomment Region" spice-uncomment-region
(and (mark) (not buffer-read-only
))]
6350 ["Comment bar" (spice-comment-bar 't
) (not buffer-read-only
)]
6351 ["Fill Paragraph (Break Line)" fill-paragraph
(not buffer-read-only
)]
6352 ["Join line" spice-delete-indentation
(not buffer-read-only
)]
6354 ["Fontify..." font-lock-flush t
]
6356 ["(Re)activate File links..." spice-colorize-libraries-buffer t
]
6357 ["Load include/lib files..." spice-load-include-files
(assoc spice-imenu-libraries-submenu-name imenu--index-alist
)]
6358 ["Load output file" spice-load-output-file
(spice-output-file-p)]
6359 ["Unload all other spice files" spice-unload-other-decks t
]
6361 ["Replace with .guess stats" spice-replace-with-guess-statements
(and (mark) (not buffer-read-only
))]
6362 ["Replace with .nodeset stats" spice-replace-with-nodeset-statements
(and (mark) (not buffer-read-only
))]
6364 ["Hide Comment Regions" spice-hide-all-comments
(spice-hide-all-comments-p)]
6365 ["Unhide Comment Regions" spice-unhide-all-comments spice-some-comment-regions-are-hidden
]
6367 ["Search .subckt def" spice-search-subckt t
]
6369 ["Add Changelog Entry" spice-add-changelog-entry
(not buffer-read-only
)]
6373 ;; ["Simulate" compile t]
6374 ["Simulate" spice-compile
(and buffer-file-name
(not (spice-output-p)))]
6375 ["Stop Simulation" kill-compilation
(condition-case ()
6377 (compilation-find-buffer))
6380 ["Next Error..." spice-next-error t
]
6381 ["Previous Error..." spice-previous-error t
]
6385 ;; example code taken literally from vhdl-mode.el !
6386 ;; add menu entries for defined simulators
6387 (let ((simu-alist spice-simulator-alist
) menu-alist name
)
6389 (setq name
(car (car simu-alist
)))
6390 (setq menu-alist
(cons (vector name
6391 (list 'spice-set-simulator name
)
6392 :style
'radio
:selected
6393 ; (list 'equal 'spice-simulator name)
6394 (list 'equal
'(spice-get-simulator) name
)
6397 (setq simu-alist
(cdr simu-alist
)))
6399 (cons '["Add Simulator..."
6400 (customize-variable 'spice-simulator-alist
) t
]
6401 (cons "--" menu-alist
)))
6402 (nreverse menu-alist
))))
6405 ["View" spice-run-waveform-viewer
6406 (and spice-waveform-viewer-alist-entry
6408 ["Kill Waveform Viewer" spice-kill-waveform-viewer
6411 (spice-waveform-buffer-name-function nil
))
6415 '("Waveform Viewer")
6416 ;; example code taken literally from vhdl-mode.el !
6417 ;; add menu entries for defined simulators
6418 (let ((wave-alist spice-waveform-viewer-alist
) menu-alist name
)
6420 (setq name
(car (car wave-alist
)))
6421 (setq menu-alist
(cons (vector name
6422 (list 'spice-set-waveform-viewer name
)
6423 :style
'radio
:selected
6424 ;(list 'equal 'spice-simulator name)
6426 '(spice-get-waveform-viewer)
6429 (setq wave-alist
(cdr wave-alist
)))
6431 (cons '["Add Waveform Viewer..."
6432 (customize-variable 'spice-waveform-viewer-alist
) t
]
6433 (cons "--" menu-alist
)))
6434 (nreverse menu-alist
))))
6436 '("Passive Elements"
6438 ["Spice2g6 Resistor" tempo-template-spice-spice2g6-resistor t
]
6439 ["Spice3 Silicon Resistor" tempo-template-spice-spice3-semiconductor-resistor t
]
6440 ["Eldo Resistor" tempo-template-spice-eldo-resistor
(spice-standard-p 'eldo
)]
6441 ["Eldo Expression Resistor" tempo-template-spice-eldo-expression-resistor
(spice-standard-p 'eldo
)]
6442 ["Eldo Silicon Resistor" tempo-template-spice-eldo-semiconductor-resistor
(spice-standard-p 'eldo
)]
6443 ["Hspice Resistor" tempo-template-spice-hspice-resistor
(spice-standard-p 'hspice
)]
6444 ["Layla Resistor" tempo-template-spice-layla-resistor
(spice-standard-p 'layla
)]
6447 ["Spice2g6 Capacitor" tempo-template-spice-spice2g6-capacitor t
]
6448 ["Spice3 Silicon Capacitor" tempo-template-spice-spice3-semiconductor-capacitor t
]
6449 ["Eldo Capacitor" tempo-template-spice-eldo-capacitor
(spice-standard-p 'eldo
)]
6450 ["Eldo Expression Capacitor" tempo-template-spice-eldo-expression-capacitor
(spice-standard-p 'eldo
)]
6451 ["Hspice Capacitor" tempo-template-spice-hspice-capacitor
(spice-standard-p 'hspice
)]
6452 ["Layla Capacitor" tempo-template-spice-layla-capacitor
(spice-standard-p 'layla
)]
6455 ["Spice2g6 Inductor" tempo-template-spice-spice2g6-inductor t
]
6456 ["Spice2g6 Coupled Inductors" tempo-template-spice-spice2g6-coupled-inductors t
]
6457 ["Eldo Inductor" tempo-template-spice-eldo-inductor
(spice-standard-p 'eldo
)]
6458 ["Eldo Expression Inductor" tempo-template-spice-eldo-expression-inductor
(spice-standard-p 'eldo
)]
6459 ["Hspice Inductor" tempo-template-spice-hspice-inductor
(spice-standard-p 'hspice
)]
6460 ["Layla Inductor" tempo-template-spice-layla-inductor
(spice-standard-p 'layla
)]
6462 ("Transmission lines"
6463 ["Spice2g6 Lossless" tempo-template-spice-spice2g6-lossless-transmission t
]
6464 ["Eldo Lossless" tempo-template-spice-eldo-lossless-transmission
(spice-standard-p 'eldo
)]
6465 ["Hspice Lossless" tempo-template-spice-hspice-lossless-transmission
(spice-standard-p 'hspice
)]
6466 ["Spice2g6 Lossy" tempo-template-spice-spice2g6-lossy-transmission t
]
6467 ["Spice3 RC line" tempo-template-spice-spice3-rcline t
]
6468 ["Eldo RC line" tempo-template-spice-eldo-rcline
(spice-standard-p 'eldo
)]
6473 ["Spice2g6 Diode" tempo-template-spice-spice2g6-diode t
]
6474 ["Eldo Diode" tempo-template-spice-eldo-diode
(spice-standard-p 'eldo
)]
6475 ["Hspice Diode" tempo-template-spice-hspice-diode
(spice-standard-p 'hspice
)]
6476 ["Layla Diode" tempo-template-spice-layla-diode
(spice-standard-p 'layla
)]
6479 ["Spice2g6 Bipolar" tempo-template-spice-spice2g6-bipolar t
]
6480 ["Eldo Bipolar" tempo-template-spice-eldo-bipolar
(spice-standard-p 'eldo
)]
6481 ["Hspice Bipolar" tempo-template-spice-hspice-bipolar
(spice-standard-p 'hspice
)]
6484 ["Spice2g6 Jfet" tempo-template-spice-spice2g6-jfet t
]
6485 ["Spice2g6 Mesfet" tempo-template-spice-spice2g6-mesfet t
]
6486 ["Eldo Jfet" tempo-template-spice-eldo-jfet
(spice-standard-p 'eldo
)]
6487 ["Hspice Jfet" tempo-template-spice-hspice-jfet
(spice-standard-p 'hspice
)]
6490 ["Spice2g6 Mosfet" tempo-template-spice-spice2g6-mosfet t
]
6491 ["Eldo Mosfet" tempo-template-spice-eldo-mosfet
(spice-standard-p 'eldo
)]
6492 ["Hspice Mosfet" tempo-template-spice-hspice-mosfet
(spice-standard-p 'hspice
)]
6493 ["Layla Mosfet" tempo-template-spice-hspice-mosfet
(spice-standard-p 'layla
)]
6496 '("Controlled Sources"
6497 ["Spice2g6 VCVS" tempo-template-spice-spice2g6-vcvs t
]
6498 ["Spice2g6 CCVS" tempo-template-spice-spice2g6-ccvs t
]
6499 ["Spice2g6 VCCS" tempo-template-spice-spice2g6-vccs t
]
6500 ["Spice2g6 CCCS" tempo-template-spice-spice2g6-ccvs t
]
6503 ["PWL" (spice-pwl) t
]
6504 ["pulse" tempo-template-spice-pulse t
]
6505 ; ["ac" tempo-template-eldo-ac t]
6506 ["sine" tempo-template-spice-sine t
]
6507 ["exp" tempo-template-spice-exp t
]
6508 ["hspice sffm" tempo-template-spice-hspice-sffm
(spice-standard-p 'hspice
)]
6509 ["hspice am" tempo-template-spice-hspice-am
(spice-standard-p 'hspice
)]
6510 ["eldo pattern" tempo-template-spice-eldo-pattern
(spice-standard-p 'eldo
)]
6511 ["eldo noise" tempo-template-spice-eldo-noise
(spice-standard-p 'eldo
)]
6512 ["eldoRF four" tempo-template-spice-eldorf-four
(spice-standard-p 'eldorf
)]
6513 ["eldoRF fpulse" tempo-template-spice-eldorf-fpulse
(spice-standard-p 'eldorf
)]
6516 '("Eldo Macromodels"
6518 ["SO Comparator" tempo-template-spice-eldo-comp
(spice-standard-p 'eldo
)]
6519 ["DO Comparator" tempo-template-spice-eldo-compd
(spice-standard-p 'eldo
)]
6520 ["SO Linear Opamp" tempo-template-spice-eldo-linear-opa0
(spice-standard-p 'eldo
)]
6521 ["DO Linear Opamp" tempo-template-spice-eldo-linear-opa0d
(spice-standard-p 'eldo
)]
6522 ["SO Linear 1-pole Opamp" tempo-template-spice-eldo-linear-opa1
(spice-standard-p 'eldo
)]
6523 ["DO Linear 1-pole Opamp" tempo-template-spice-eldo-linear-opa1d
(spice-standard-p 'eldo
)]
6524 ["SO Linear 2-pole Opamp" tempo-template-spice-eldo-linear-opa2
(spice-standard-p 'eldo
)]
6525 ["DO Linear 2-pole Opamp" tempo-template-spice-eldo-linear-opa2d
(spice-standard-p 'eldo
)]
6526 ["Delay" tempo-template-spice-eldo-delay
(spice-standard-p 'eldo
)]
6527 ["Saturating Resistor" tempo-template-spice-eldo-satr
(spice-standard-p 'eldo
)]
6528 ["Voltage Limiter" tempo-template-spice-eldo-satv
(spice-standard-p 'eldo
)]
6529 ["Voltage cont. switch" tempo-template-spice-eldo-vswitch
(spice-standard-p 'eldo
)]
6530 ["Current cont. switch" tempo-template-spice-eldo-cswitch
(spice-standard-p 'eldo
)]
6531 ["Triangular to sine converter" tempo-template-spice-eldo-tri2sin
(spice-standard-p 'eldo
)]
6532 ["Staircase generator" tempo-template-spice-eldo-stairgen
(spice-standard-p 'eldo
)]
6533 ["Sawtooth generator" tempo-template-spice-eldo-sawgen
(spice-standard-p 'eldo
)]
6534 ["Triangle generator" tempo-template-spice-eldo-trigen
(spice-standard-p 'eldo
)]
6535 ["Amplitude modulator" tempo-template-spice-eldo-amm
(spice-standard-p 'eldo
)]
6536 ["Pulse amplitude modulator" tempo-template-spice-eldo-pam
(spice-standard-p 'eldo
)]
6537 ["Sample&Hold" tempo-template-spice-eldo-saho
(spice-standard-p 'eldo
)]
6538 ["Track&Hold" tempo-template-spice-eldo-trho
(spice-standard-p 'eldo
)]
6539 ["Peak Detector" tempo-template-spice-eldo-peakd
(spice-standard-p 'eldo
)]
6540 ["SO Level Detector" tempo-template-spice-eldo-levdso
(spice-standard-p 'eldo
)]
6541 ["DO Level Detector" tempo-template-spice-eldo-levddo
(spice-standard-p 'eldo
)]
6542 ["Log Amplifier" tempo-template-spice-eldo-logamp
(spice-standard-p 'eldo
)]
6543 ["Antilog Amplifier" tempo-template-spice-eldo-antilog
(spice-standard-p 'eldo
)]
6544 ["Differentiator" tempo-template-spice-eldo-diff
(spice-standard-p 'eldo
)]
6545 ["Integrator" tempo-template-spice-eldo-integ
(spice-standard-p 'eldo
)]
6546 ["Add/Sub/Mult/Div" tempo-template-spice-eldo-adder
(spice-standard-p 'eldo
)]
6549 ["Delay" tempo-template-spice-eldo-delay
(spice-standard-p 'eldo
)]
6550 ["Inverter" tempo-template-spice-eldo-inv
(spice-standard-p 'eldo
)]
6551 ["XOR gate" tempo-template-spice-eldo-xor
(spice-standard-p 'eldo
)]
6552 ["2 input AND gate" tempo-template-spice-eldo-and2
(spice-standard-p 'eldo
)]
6553 ["2 input NAND gate" tempo-template-spice-eldo-nand2
(spice-standard-p 'eldo
)]
6554 ["2 input OR gate" tempo-template-spice-eldo-or2
(spice-standard-p 'eldo
)]
6555 ["2 input NOR gate" tempo-template-spice-eldo-nor2
(spice-standard-p 'eldo
)]
6556 ["3 input AND gate" tempo-template-spice-eldo-and3
(spice-standard-p 'eldo
)]
6557 ["3 input NAND gate" tempo-template-spice-eldo-nand3
(spice-standard-p 'eldo
)]
6558 ["3 input OR gate" tempo-template-spice-eldo-or3
(spice-standard-p 'eldo
)]
6559 ["3 input NOR gate" tempo-template-spice-eldo-nor3
(spice-standard-p 'eldo
)]
6562 ["AD Converter" tempo-template-spice-eldo-adc
(spice-standard-p 'eldo
)]
6563 ["DA Converter" tempo-template-spice-eldo-dac
(spice-standard-p 'eldo
)]
6566 ["Opamp" tempo-template-spice-eldo-switchcap-opa
(spice-standard-p 'eldo
)]
6567 ["Switch" tempo-template-spice-eldo-switch
(spice-standard-p 'eldo
)]
6572 ["Port" tempo-template-layla-port
(spice-standard-p 'layla
)]
6573 ["Performance" tempo-template-layla-performance
(spice-standard-p 'layla
)]
6574 ["Net" tempo-template-layla-net
(spice-standard-p 'layla
)]
6575 ["Bus" tempo-template-layla-bus
(spice-standard-p 'layla
)]
6576 ; ["ac" tempo-template-eldo-ac t]
6578 '("Layla Properties"
6580 ["Port double" tempo-template-layla-port-double
(spice-standard-p 'layla
)]
6581 ["Port integer" tempo-template-layla-port-integer
(spice-standard-p 'layla
)]
6582 ["Port string" tempo-template-layla-port-string
(spice-standard-p 'layla
)]
6585 ["Placement double" tempo-template-layla-placement-double
(spice-standard-p 'layla
)]
6586 ["Placement integer" tempo-template-layla-placement-integer
(spice-standard-p 'layla
)]
6587 ["Placement string" tempo-template-layla-placement-string
(spice-standard-p 'layla
)]
6590 ["Symmetry double" tempo-template-layla-symmetry-double
(spice-standard-p 'layla
)]
6591 ["Symmetry integer" tempo-template-layla-symmetry-integer
(spice-standard-p 'layla
)]
6592 ["Symmetry string" tempo-template-layla-symmetry-string
(spice-standard-p 'layla
)]
6595 ["Net double" tempo-template-layla-net-double
(spice-standard-p 'layla
)]
6596 ["Net integer" tempo-template-layla-net-integer
(spice-standard-p 'layla
)]
6597 ["Net string" tempo-template-layla-net-string
(spice-standard-p 'layla
)]
6600 ["Device double" tempo-template-layla-device-double
(spice-standard-p 'layla
)]
6601 ["Device integer" tempo-template-layla-device-integer
(spice-standard-p 'layla
)]
6602 ["Device string" tempo-template-layla-device-string
(spice-standard-p 'layla
)]
6605 ["Bus double" tempo-template-layla-bus-double
(spice-standard-p 'layla
)]
6606 ["Bus integer" tempo-template-layla-bus-integer
(spice-standard-p 'layla
)]
6607 ["Bus string" tempo-template-layla-bus-string
(spice-standard-p 'layla
)]
6613 (let ((section-alist spice-section-alist
) menu-alist name str
)
6617 (spice-goto-section "changelog")
6618 ; (setq menu-sec (current-time))
6619 (spice-cache-section-p "changelog")
6621 (while section-alist
6622 (setq name
(car (car section-alist
)))
6623 (setq str
(downcase (car (cdr (car section-alist
)))))
6624 (setq menu-alist
(cons (vector name
6625 (list 'spice-goto-section str
)
6626 (list 'spice-section-p str
)
6629 (setq section-alist
(cdr section-alist
)))
6631 (cons '["Specify..."
6632 spice-goto-section t
]
6633 (cons "--" menu-alist
)))
6634 (nreverse menu-alist
))
6637 '("Add Section Header")
6638 (let ((section-alist spice-section-alist
) menu-alist name str
)
6642 (spice-add-section "Changelog")
6643 (not (spice-section-p "changelog"))] menu-alist
)))
6644 (while section-alist
6645 (setq name
(car (car section-alist
)))
6646 (setq str
(car (cdr (car section-alist
))))
6647 (setq menu-alist
(cons (vector name
6648 (list 'spice-add-section str
)
6649 (list 'not
(list 'spice-section-p
(downcase str
)))
6652 (setq section-alist
(cdr section-alist
)))
6654 (cons '["Specify..."
6655 spice-add-section t
]
6656 (cons "--" menu-alist
)))
6657 (nreverse menu-alist
))
6660 (spice-common-menu-tail-entries))
6664 (defun spice-create-output-mode-menu ()
6665 "Create Spice-output Mode menu."
6670 ["Fontify..." font-lock-flush t
]
6672 ["Unload all other spice files" spice-unload-other-decks t
]
6674 ["Create <name>_guess.cir file" (spice-create-guess-nodeset-file "guess") (spice-output-p)]
6675 ["Create <name>_nodeset.cir file" (spice-create-guess-nodeset-file "nodeset") (spice-output-p)]
6678 (spice-common-menu-tail-entries))
6682 (defun spice-common-menu-tail-entries ()
6683 "Creat Common Spice and Spice-output Mode menu entries."
6686 ;; customize sub menu
6688 ["Browse Spice Group" (customize-browse 'spice
) t
]
6689 ["Spice Standard" (customize-variable 'spice-standard
) t
]
6690 ["Spice Faces" (customize-group 'spice-faces
) t
]
6691 ["Section Header list" (customize-variable 'spice-section-alist
) t
]
6693 ;; ["Activate Customizations in Buffer" spice-activate-customizations t]
6694 ;; (not (equal spice-standard-local spice-standard))]
6696 ;; settings sub menu
6697 (append '("Settings")
6698 (when (fboundp 'speedbar
)
6699 (list '["Speedbar" speedbar-frame-mode
6701 :selected
(and (boundp 'speedbar-frame
)
6702 (frame-live-p speedbar-frame
)
6703 (frame-visible-p speedbar-frame
))]))
6705 '["Abbrevs" abbrev-mode
:style toggle
:selected abbrev-mode
]
6706 '["List abbrevs" list-abbrevs abbrev-mode
]
6707 '["Auto fill" auto-fill-mode
:style toggle
6708 :selected auto-fill-function
]))
6710 ["About Spice-Mode" spice-about t
]
6715 (defvar spice-menu-list nil
6716 "Spice Mode menu.") ; global variable
6718 (defvar spice-output-menu-list nil
6719 "Spice-output Mode menu.") ; global variable
6723 (defun spice-menu-init ()
6724 "Initialize global vars for Spice menu's."
6725 (setq spice-menu-list
(spice-create-mode-menu))
6726 (setq spice-output-menu-list
(spice-create-output-mode-menu))
6729 (defun spice-update-mode-menu ()
6730 "Update Spice mode menu for current buffer. assumes globals have been updated."
6732 (if (spice-output-p)
6733 (easy-menu-define spice-output-menu spice-output-mode-map
6734 "Menu keymap for Spice-output Mode." spice-output-menu-list
)
6735 (easy-menu-define spice-menu spice-mode-map
6736 "Menu keymap for Spice Mode." spice-menu-list
)))
6739 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6740 ;; spice mode syntax table
6742 (defvar spice-mode-syntax-table nil
6743 "Syntax table used in spice-mode buffers.")
6745 (defun spice-mode-syntax-table-init ()
6746 "Initialize syntax table from scratch."
6747 (setq spice-mode-syntax-table
(make-syntax-table))
6748 (modify-syntax-entry ?$
"w" spice-mode-syntax-table
)
6749 (modify-syntax-entry ?
! "w" spice-mode-syntax-table
)
6750 (modify-syntax-entry ?
* "w" spice-mode-syntax-table
) ; not < !!!!
6751 (if (spice-standard-p 'eldo
)
6752 (progn (modify-syntax-entry ?
# "w 13" spice-mode-syntax-table
)
6753 (modify-syntax-entry ?c
"w 2" spice-mode-syntax-table
)
6754 (modify-syntax-entry ?e
"w 4" spice-mode-syntax-table
)))
6755 ;; (modify-syntax-entry ?\n "> b" spice-mode-syntax-table) ;; no no, comments are handled by spice-mode, not by syntax-table !!!
6756 (modify-syntax-entry ?
\n "." spice-mode-syntax-table
) ;; make it punctuation ?
6757 (modify-syntax-entry ?
\" "\"" spice-mode-syntax-table
) ;; font-lock prob
6758 ;; (modify-syntax-entry ?\" "w" spice-mode-syntax-table)
6759 (modify-syntax-entry ?.
"w" spice-mode-syntax-table
)
6760 (modify-syntax-entry ?
, "w" spice-mode-syntax-table
)
6761 (modify-syntax-entry ?_
"w" spice-mode-syntax-table
)
6762 (modify-syntax-entry ?
@ "w" spice-mode-syntax-table
)
6763 (modify-syntax-entry ?
/ "w" spice-mode-syntax-table
)
6764 ;; (modify-syntax-entry ?< "(>" spice-mode-syntax-table) ; can be in symbols
6765 ;; (modify-syntax-entry ?> ")<" spice-mode-syntax-table) ; can be in symbols
6766 ;; (modify-syntax-entry ?+ "w" spice-mode-syntax-table) ; can be in expr
6767 ;; (modify-syntax-entry ?- "w" spice-mode-syntax-table) ; can be in expr
6768 ;; (modify-syntax-entry ?= "." spice-mode-syntax-table) ; can be in expr
6777 (when (fboundp 'speedbar
)
6781 (defun spice-speedbar-init ()
6782 "Initialize speedbar."
6783 ;; general settings, depends on auto-mode-alist, so should be
6784 ;; called every time auto-mode-alist is modified (set
6785 ;; (make-local-variable 'speedbar-tag-hierarchy-method) nil)
6786 ;; SPICE file extensions (extracted from `auto-mode-alist')
6787 (let ((mode-alist auto-mode-alist
))
6789 (when (eq (cdr (car mode-alist
)) 'spice-mode
)
6790 (speedbar-add-supported-extension (car (car mode-alist
))))
6791 (setq mode-alist
(cdr mode-alist
)))))
6794 (defun spice-speedbar (&optional arg
)
6795 "Open/close speedbar."
6797 (if (not (fboundp 'speedbar
))
6798 (error "WARNING: Speedbar is only available in newer Emacs versions")
6799 (condition-case () ; due to bug in `speedbar-el' v0.7.2a
6800 (speedbar-frame-mode arg
)
6801 (error "WARNING: Install included `speedbar.el' patch first"))))
6808 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6809 ;;; Imenu: S-mouse3 in emacs to find spice objects quickly
6810 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6814 (defvar spice-imenu-generic-expression nil
6815 "Imenu generic expression for spice mode. See `imenu-generic-expression'.")
6817 (defconst spice-imenu-end-submenu-name
"*End*"
6818 "Label of End submenu in imenu.")
6820 (defconst spice-imenu-libraries-submenu-name
"*Libraries*"
6821 "Label of Libraries submenu in imenu.")
6823 (defun spice-imenu-init ()
6824 "Initialize imenu generic expression and pass to imenu."
6825 (setq spice-imenu-generic-expression
6828 (list spice-imenu-end-submenu-name
6833 (when (spice-standard-p 'layla
)
6835 (list "*Nets*" (concat
6837 "[\.]\\(net\\)\\s-+"
6838 "\\([a-z0-9]\\w*\\)\\>"
6843 "\\.\\(port\\)\\s-+"
6844 "\\([a-z0-9]\\w*\\)\\>"
6846 (list "*Performances*"
6849 "\\.\\(performance\\)\\s-+"
6850 "\\([a-z]\\w*\\)\\>"
6857 "^\\s-*\\.model\\s-+" spice-model-name spice-line-break
6859 (regexp-opt spice-misc-model-type-names
)
6864 (concat "^\\s-*\\.model\\s-+" spice-model-name
6865 spice-line-break
"\\s-+d\\>")
6869 (concat "^\\s-*\\.model\\s-+" spice-model-name
6870 spice-line-break
"\\s-+\\(npn\\|pnp\\)\\>")
6874 (concat "^\\s-*\\.model\\s-+" spice-model-name
6875 spice-line-break
"\\s-+\\(n\\|p\\)mos\\>")
6877 (list spice-imenu-libraries-submenu-name
6878 (concat spice-library-regexp-start
6879 spice-library-regexp-end
)
6883 (concat "^\\s-*\\.\\("
6884 (regexp-opt spice-analyses
)
6888 spice-section-headings-regexp
2)
6891 "^\\.\\(subckt\\s-+"
6892 (when (spice-standard-p 'eldo
)
6893 "\\(lib\\s-+[^ \t\n]+\\s-+\\)?")
6895 "\\([a-z]\\w*\\)\\>"
6896 ) (if (spice-standard-p 'eldo
) 3 2))
6901 ;; ======================================================================
6902 ;; Support for compilation (simulation) - doesn't work 100% currently
6903 ;; and probably never will ...
6904 ;; ======================================================================
6906 (defun spice-simulation-buffer-name-function (arg)
6907 "Derive unique spice simulation buffer for simulator output."
6908 (concat "*Spice-simulation-" (buffer-name) "*"))
6911 (defun spice-get-simulator ()
6912 "Make an educated guess on what simulator a user likely wants to use."
6913 (if (and spice-simulator
6914 (assoc spice-simulator spice-simulator-alist
))
6915 spice-simulator
;; is specified by user, take his choice
6916 (if (spice-standard-p 'eldo
) "Eldo" ;; eldo
6917 (if (spice-standard-p 'hspice
) "Hspice" ;; Hspice
6918 "Spice3")))) ;; fallback Spice3
6921 (defun spice-set-simulator-command ()
6922 "Construct a spice simulator command."
6924 (setq compile-command
6925 (let ((commands-alist spice-simulator-alist
)
6927 (while commands-alist
6928 (when (equal (spice-get-simulator) (nth 0 (car commands-alist
)))
6931 (nth 1 (car commands-alist
)) " "
6932 spice-simulator-switches
6934 (string-equal spice-simulator-switches
"") " ")
6935 (file-name-nondirectory (if buffer-file-name
6936 buffer-file-name
""))
6938 (string-equal (nth 2 (car commands-alist
)) "") " ")
6939 (nth 2 (car commands-alist
))
6941 (setq commands-alist
(cdr commands-alist
)))
6944 (defun spice-set-simulator (name)
6945 "Set spice simulator NAME."
6946 (setq spice-simulator name
)
6947 (spice-set-simulator-command))
6951 (defvar spice-compilation-error-regexp-alist nil
)
6952 (defvar spice-compilation-file-regexp-alist nil
)
6954 (defun spice-compile ()
6955 "Spice wrapper function for compile."
6957 (spice-set-simulator-command)
6958 (call-interactively 'compile nil
)
6961 (defun spice-compile-variables-init ()
6962 "Build variable lists."
6963 (setq spice-compilation-error-regexp-alist
6964 (let ((commands-alist spice-simulator-alist
)
6965 regexp-alist sublist
)
6966 (while commands-alist
6967 (setq sublist
(nth 3 (car commands-alist
)))
6968 (unless (equal "" (car sublist
))
6971 (list (nth 0 sublist
)
6972 (if (= 0 (nth 1 sublist
))
6976 (list (nth 3 sublist
))
6978 (if (stringp (nth 4 sublist
))
6979 (list (nth 4 sublist
))
6980 (list (eval (nth 4 sublist
))))))
6982 (setq commands-alist
(cdr commands-alist
)))
6984 ; (message "setting compilation file regexps command")
6985 (setq spice-compilation-file-regexp-alist
6986 (let ((commands-alist spice-simulator-alist
)
6988 (while commands-alist
6989 (unless (equal "" (car (nth 4 (car commands-alist
))))
6991 (append regexp-alist
6992 (list (nth 4 (car commands-alist
))))))
6993 (setq commands-alist
(cdr commands-alist
)))
6998 (defun spice-compile-init ()
6999 "Initialize for simulation(/compilation)."
7001 ;;------------------------------------------------------------
7002 ;; use Eldo/Hspice as compiler, on current buffer
7003 (make-local-variable 'compile-command
)
7004 (make-local-variable 'compilation-read-command
)
7005 (make-local-variable 'compilation-buffer-name-function
)
7006 (make-local-variable 'compilation-error-regexp-alist
)
7007 (make-local-variable 'compilation-file-regexp-alist
)
7009 (setq compilation-read-command
't
)
7010 (setq compilation-buffer-name-function
7011 'spice-simulation-buffer-name-function
)
7013 ; (message "setting compilation error regexps command")
7014 (setq compilation-error-regexp-alist spice-compilation-error-regexp-alist
7015 compilation-file-regexp-alist spice-compilation-file-regexp-alist
)
7019 (defvar spice-column
1
7020 "Global variable to do column hack.
7022 Why ? Compile.el requires that every error is 'special', ie.
7023 different from the previous one. This is either the file is
7024 different, the line number is different or the column number is
7025 different. Prob: the file is always the same, the simulator guys
7026 never output the file name of the file that is being read, so
7027 that one doesn't change; the line number can not be found either;
7028 the column number is same problem; Solution: always take line
7029 number one, then take the column number 1 or 2 alternatingly,
7030 remember previous value here !
7032 This is ugly, I know, but it's the only way I could think of to find
7033 the errors in the simulation buffer with compile.el")
7036 (defun spice-linenum (f c
)
7037 "Dirty hack function for `spice-column' global varible."
7038 ;;(message (format "calling linenum fun '%s'" f))
7039 (with-current-buffer compilation-last-buffer
7040 ;;(message (format "buffer '%s'" (buffer-name)))
7042 (list (point-marker) f
1
7043 (if (= spice-column
1)
7044 (setq spice-column
2)
7045 (setq spice-column
1))))
7048 (defun spice-next-error (n)
7049 "Move point to the next error N in the compilation buffer.
7050 Does NOT find the source line like \\[next-error] does, is defined
7051 in spice-mode since many simulators don't output errors with source line
7052 numbers included, so finding the error is still difficult."
7056 (setq prev-buffer
(buffer-name))
7057 (pop-to-buffer compilation-last-buffer
)
7058 (compilation-next-error n
)
7060 (pop-to-buffer prev-buffer
))))
7063 (defun spice-previous-error (n)
7064 "Move point to the previous error N in the compilation buffer.
7065 Does NOT find the source line like \\[next-error] does, is defined
7066 in spice-mode since many simulators don't output errors with source line
7067 numbers included, so finding the error is still difficult."
7071 (setq prev-buffer
(buffer-name))
7072 (pop-to-buffer compilation-last-buffer
)
7073 (compilation-previous-error n
)
7075 (pop-to-buffer prev-buffer
))))
7078 ;;------------------------------------------------------------
7079 ;; Waveform viewer support
7080 ;;------------------------------------------------------------
7081 ;; This is work in progress; (user) interface might change
7083 (defun spice-waveform-buffer-name-function (arg)
7084 "Check running process."
7085 (let ((name (if arg arg
(buffer-name))))
7086 (concat "*Spice-waveform-" name
"*")))
7089 (defun spice-set-waveform-viewer (name)
7090 (setq spice-waveform-viewer name
)
7091 (spice-set-waveform-viewer-command))
7093 (defun spice-get-waveform-viewer ()
7094 "Make an educated guess on what waveform viewer a user likely would want."
7095 (if (and spice-waveform-viewer
7096 (assoc spice-waveform-viewer spice-waveform-viewer-alist
))
7097 spice-waveform-viewer
;; is specified by user, take his choice
7098 (if (spice-standard-p 'eldo
) "Xelga" ;; eldo's viewer is xelga
7099 (if (spice-standard-p 'hspice
) "Awaves" ;; Hspice's viewer is awaves
7100 "Nutmeg")))) ;; fallback Spice3's viewer nutmeg ...
7103 (defun spice-waveform-viewer-derive-filename (arg)
7104 "Derive from the buffer file name the name of a derived file.
7106 If ARG is a string, it is a suffix to replace the buffer's
7107 suffix, if ARG is a list , , if ARG is a function, the function
7108 is called without arguments and it should return the derived
7109 filename, if ARG is nil, nil is returned, if ARG is t, the
7110 filename itself is returned unmodified."
7111 (cond ((stringp arg
)
7112 (concat (file-name-sans-extension buffer-file-name
) arg
))
7118 (message (concat (file-name-sans-extension buffer-file-name
) (car alist
)))
7121 (concat (file-name-sans-extension buffer-file-name
) (car alist
)))
7122 (setq alist
(cdr alist
)))
7127 nil
) ;; nil if nil ...
7129 buffer-file-name
) ;; fallback if t ...
7133 (defvar spice-waveform-viewer-command
""
7134 "Variable containing buffer local waveform viewer command.")
7136 (defvar spice-waveform-viewer-filename nil
7137 "Variable filename field of waveform viewer structure.")
7139 (defvar spice-waveform-viewer-alist-entry nil
7140 "Variable holding selected entry of waveform viewer.")
7142 (defvar spice-waveform-viewer-read-command t
7143 "Variable containing boolean indicating reading of buffer local waveform viewer command.")
7145 (defvar spice-after-start-process-function nil
7146 "Variable containing after start process function.")
7148 (defun spice-set-waveform-viewer-command ()
7149 "Set waveform viewer command for spice."
7151 (setq spice-waveform-viewer-alist-entry nil
)
7152 (let ((commands-alist spice-waveform-viewer-alist
))
7153 (while commands-alist
7154 (when (equal (spice-get-waveform-viewer)
7155 (nth 0 (car commands-alist
)))
7156 (setq spice-waveform-viewer-alist-entry
(car commands-alist
))
7158 (setq commands-alist
(cdr commands-alist
)))))
7161 (defun spice-waveform-viewer-init ()
7162 "Initialize for waveform viewer."
7164 ;;------------------------------------------------------------
7165 (make-local-variable 'spice-waveform-viewer-command
)
7166 (make-local-variable 'spice-waveform-viewer-read-command
)
7167 (make-local-variable 'spice-waveform-viewer-filename
)
7168 (make-local-variable 'spice-waveform-viewer-alist-entry
)
7169 (make-local-variable 'spice-after-start-process-function
)
7171 (setq spice-waveform-viewer-read-command
't
)
7173 (spice-set-waveform-viewer-command))
7176 (defun spice-run-waveform-viewer ()
7177 "Run the waveform viewer if it is not yet running."
7179 (if (not buffer-file-name
)
7180 (message "Can not run waveform viewer on unsaved file-less buffers.")
7181 (let (name command file
)
7182 (setq name
(nth 0 spice-waveform-viewer-alist-entry
)
7183 command
(concat (nth 1 spice-waveform-viewer-alist-entry
)
7185 (nth 2 spice-waveform-viewer-alist-entry
)
7187 (spice-waveform-viewer-derive-filename
7188 (nth 4 spice-waveform-viewer-alist-entry
)))
7190 (spice-process-check file
)
7191 (message "Starting waveform viewer %s" name
)
7192 (funcall (nth 3 spice-waveform-viewer-alist-entry
) name command file
))
7197 (defun spice-master-directory ()
7198 "Directory of master file."
7199 (abbreviate-file-name
7201 (file-name-directory (buffer-file-name)))))
7204 (defun spice-run-silent (name command file
)
7205 "Start process NAME with (optional) second argument COMMAND and FILE."
7206 (let ((dir (spice-master-directory)))
7207 (with-current-buffer (get-buffer-create "*spice silent*")
7210 ; (message "cd to %s" dir)
7211 (let ((process (start-process (concat name
" silent")
7212 (current-buffer) ; can be nil
7214 spice-shell-command-option
7216 (message "started %s" command
)
7217 (if spice-after-start-process-function
7218 (funcall spice-after-start-process-function process
))
7219 (set-process-query-on-exit-flag process
)))))
7221 (defun spice-run-interactive (name command file
)
7222 "Run waveform viewer interactively with process (NAME COMMAND FILE).
7223 Run command in a buffer (in comint-shell-mode) so that it accepts user
7226 (let (; (default spice-command-default)
7227 (buffer (spice-waveform-buffer-name-function file
))
7229 (dir (spice-master-directory)))
7230 (spice-process-check file
) ; Check that no process is running
7231 ; (setq spice-command-buffer (current-buffer))
7232 (with-output-to-temp-buffer buffer
)
7234 (setq buffer-read-only nil
)
7236 (insert "Running `" name
"' on `" file
"' with ``" command
"''\n")
7237 (comint-exec buffer name spice-shell nil
7238 (list spice-shell-command-option command
))
7240 (setq mode-name name
)
7241 ; (setq spice-command-default default)
7242 (setq process
(get-buffer-process buffer
))
7243 (if spice-after-start-process-function
7244 (funcall spice-after-start-process-function process
))
7245 ; (spice-command-mode-line process) ; mode line setting
7246 ; (set-process-sentinel process 'spice-command-sentinel)
7247 (set-marker (process-mark process
) (point-max))
7248 ;;; (setq compilation-in-progress (cons process compilation-in-progress))
7249 ; (spice-parse-reset)
7250 ; (setq spice-parse-function 'spice-parse-spice)
7251 ; (setq spice-sentinel-function 'spice-LaTeX-sentinel)
7254 (defun spice-command-mode-line (process)
7255 "Format the mode line for a buffer containing output from PROCESS."
7256 (setq mode-line-process
(concat ": " (symbol-name (process-status process
))))
7257 (set-buffer-modified-p (buffer-modified-p)))
7259 (defun spice-process-check (name)
7260 "Check if a process for the spice deck NAME already exist.
7261 If so, give the user the choice of aborting the process or the current
7263 (let ((process (get-buffer-process
7264 (spice-waveform-buffer-name-function name
))))
7265 ; (message "checking %s for running process" (spice-waveform-buffer-name-function name))
7266 (cond ((null process
))
7267 ((not (eq (process-status process
) 'run
)))
7268 ((yes-or-no-p (concat "Process `"
7269 (process-name process
)
7272 "' running, kill it? "))
7273 (delete-process process
))
7275 (error "Cannot have two processes for the spice deck")))))
7278 ;; ---- setting commands ?
7280 (defun spice-set-command ()
7281 "Set both simulator an waveform viewer commands for current buffer."
7283 (spice-set-simulator-command)
7284 (spice-set-waveform-viewer-command)
7288 ;;------------------------------------------------------------
7289 ;; File initialization support, code taken from eldo-mode and
7290 ;; modified/extended
7291 ;;------------------------------------------------------------
7293 ;; initialize empty file:
7294 (defun spice-initialize-empty-file ()
7295 "Create a standard template for a new/empty file.
7297 This is the default initialization function. If the user has specified
7298 an initialization function, by setting
7299 `spice-initialize-file-function', the user-specified function is
7300 called instead. This function first checks for the template file
7301 specified in `spice-initialization-file' which is inserted and a default
7302 changelog entry is added. If this file isn't readable, a default
7303 template is inserted depending on the submode (eldo, hspice or layla)
7304 that has been selected."
7305 (interactive "*") ; read-only check
7306 (if (file-readable-p spice-initialize-template-file
) ;; template file
7307 (insert-file-contents spice-initialize-template-file
)
7308 ;; this has been taken from eldo-mode and thus only applies if
7310 (if (spice-standard-p 'eldo
)
7313 (concat "# " (buffer-name) " "
7316 spice-default-header
7318 (spice-add-section "LIBRARIES")
7320 (spice-add-section "SIMULATION OPTIONS")
7323 ".options STAT=1 SIMUDIV=10 !Status reports\n"
7324 ".options noascii nomod \n"
7325 ".options eps=1e-7 itol=1e-6 gmin=1e-16 analog \n"
7326 ".options nobound_phase"
7330 (spice-add-section "SUPPLIES/REFERENCES")
7331 (insert "\n\n.END\n\n\n\n")
7332 (spice-add-section "Changelog")
7333 (insert "\n\n*** Local Variables:\n*** mode:spice\n*** End:\n")
7335 (if (spice-standard-p 'hspice
) ;; hspice specific options
7338 (concat "* " (buffer-name) " "
7340 spice-default-header
7342 (spice-add-section "LIBRARIES")
7344 (spice-add-section "SIMULATION OPTIONS")
7347 ".options nomod nopage opts \n"
7348 ".options itl1=5000 itl2=2500 itl3=20 itl4=20 itl5=0 \n"
7349 ".options numdgt=10 $ print 10 digits in output \n"
7353 (spice-add-section "SUPPLIES/REFERENCES")
7354 (insert "\n\n.end\n\n\n\n")
7355 (spice-add-section "Changelog")
7356 (insert "\n\n*** Local Variables:\n*** mode:spice\n*** End:\n")
7358 (if (spice-standard-p 'layla
) ;; layla specific options
7361 (concat "* " (buffer-name) " "
7363 spice-default-header
7365 (spice-add-section "MAIN CIRCUIT")
7367 (spice-add-section "PORTS")
7368 (insert "\n\n.end\n\n\n\n")
7369 (spice-add-section "Changelog")
7370 (insert "\n\n*** Local Variables:\n*** mode:spice\n*** End:\n")
7376 (spice-add-changelog-entry "File created") ; in any case
7379 ;; ======================================================================
7380 ;; Support for .subckt search !?
7381 ;; ======================================================================
7383 ;; What about searching from an included file, how to find the
7384 ;; top-level then ? think I've cracked it: .end identifies top-level
7385 ;; spice files so remember the last one to start search from if the
7388 ;; BUG: doesn't handle nested .subckt defs ! Reports first found match...
7390 (defun spice-search-included-files (subckt)
7393 (goto-char (point-min))
7395 (search-forward-regexp spice-library-regexp-start
7399 (if (looking-at (concat spice-library-regexp-start
7400 spice-library-regexp-end
))
7401 (if (file-readable-p (substitute-in-file-name (match-string 3)))
7403 (spice-search-file-for-subckt
7404 (substitute-in-file-name (match-string 3)) subckt
))
7405 (message "File '%s' isn't readable" (match-string 3))) ; if
7407 (end-of-line)) ; while
7413 (defvar spice-subckt-search-master-filename nil
7414 "Latest top level (identified by .end in file) .cir file used in subcircuit searches.")
7416 (defun spice-search-file-for-subckt (filename subckt
)
7417 "Searche a FILENAME for a SUBCKT definition.
7418 Remembers `spice-subckt-search-master-filename' for future subckt searches."
7419 (with-current-buffer (find-file-noselect filename
)
7421 (let ((index-alist (imenu--make-index-alist t
))
7423 (if (assoc spice-imenu-end-submenu-name index-alist
)
7424 (setq spice-subckt-search-master-filename buffer-file-name
))
7425 (setq mrk
(assoc-string subckt index-alist
))
7426 (if mrk mrk
(spice-search-included-files subckt
)))
7430 ;; History of subckt searches.
7431 (defvar spice-subckt-search-history nil
7432 "History of subcircuit searches.")
7434 (defun spice-guess-subckt-name ()
7435 "Guess name of subckt from context, multiple lines."
7436 (let ((subckt "")) ; (current-word)
7439 (while (and (looking-at "^+")
7440 (not (forward-line -
1))))
7441 (if (looking-at spice-xinstance-regexp
)
7443 ;; (message "Could it be '%s' ?" (match-string 3))
7444 (setq subckt
(match-string 5))
7445 (remove-text-properties 0 (length subckt
) '(face nil
) subckt
)
7450 (defun spice-visit-subckt-def (mark)
7451 "Helper function visiting buffer and MARK specified."
7452 (when (and (eq (marker-buffer (cdr mark
))
7454 (not (and transient-mark-mode mark-active
)))
7456 (pop-to-buffer (marker-buffer (cdr mark
)) t
)
7458 (goto-char (cdr mark
)))
7461 (defun spice-search-subckt (subckt-args)
7462 "Searches for the .subckt definition with name under cursor, or any other name specified by user.
7464 Be CAREFUL using this command. Depending on the structure of your
7465 spice decks this might find wrong definitions. To AVOID any such
7466 problems always start searching from the TOP-LEVEL spice
7467 deck (ie. the file that is supplied to the simulator). If you
7468 start searching from an included file, potentially the definition
7469 is not found or it is found starting from ANOTHER top level
7470 file (which could result in a completely wrong search result).
7472 This search command places the mark if search result is in the
7473 same file, return to the search start position by using C-u
7474 C-<SPC> or C-u C-@."
7476 (list (let* ((default-subckt (spice-guess-subckt-name))
7477 (input (read-from-minibuffer
7479 default-subckt nil nil
7480 spice-subckt-search-history
)))
7481 (if (string= input
"")
7482 (if (string= default-subckt
"")
7483 (error "No subckt args given")
7486 ;(message (format "name of subckt is %s" subckt-args))
7488 (setq mrk
(spice-search-file-for-subckt buffer-file-name subckt-args
))
7489 ; (message (format "mark is %s" (cdr mrk)))
7490 (if (and (cdr mrk
) (markerp (cdr mrk
)))
7491 (spice-visit-subckt-def mrk
)
7493 (message "Couldn't find subcircuit '%s', retrying search in top-level file"
7496 spice-subckt-search-master-filename
)
7498 (setq mrk
(spice-search-file-for-subckt
7499 spice-subckt-search-master-filename subckt-args
))
7500 (if (and (cdr mrk
) (markerp (cdr mrk
)))
7502 (spice-visit-subckt-def mrk
)
7503 (message "Used top-level file '%s' to find '%s'"
7504 spice-subckt-search-master-filename subckt-args
)
7508 (format "Couldn't find subcircuit '%s', retry search in top-level file"
7513 ;; ======================================================================
7514 ;; loading of include files of current deck.
7516 (defun spice-load-include-files (&optional non-recursive
)
7517 "Loads all files that are included in this deck.
7519 Makes it more easy to load a project. This loading occurs
7520 recursively. Files already loaded are not reloaded or scanned for
7521 .includes. This function is only guaranteed to work when all
7522 included files are not already loaded."
7524 (let ((index-alist (imenu--make-index-alist t
))
7526 (if (setq l
(cdr (assoc spice-imenu-libraries-submenu-name index-alist
))) ;; file contains include files/libraries
7528 (setq filename
(expand-file-name
7529 (substitute-in-file-name (car (car l
)))))
7530 ;;(message "Trying to load %s" filename)
7531 (if (and (file-readable-p filename
)
7533 (assoc filename
;; already loaded
7536 (cons (buffer-file-name buffer
) buffer
))
7538 (with-current-buffer (find-file-noselect filename
)
7539 ;; (message "filename is %s" filename)
7540 ;; (spice-mode) ? ref. discussion Manu
7541 (unless (or non-recursive
7542 (not (eq major-mode
'spice-mode
)))
7543 (spice-load-include-files))))
7544 (setq l
(cdr l
))))))
7547 ;; ======================================================================
7548 ;; unloading of spice files except current deck.
7550 (defun spice-unload-other-decks ()
7551 "Kills all other spice files except current one.
7553 Makes it easy to unload a lot of spice files without restarting Emacs."
7556 (let ((current (current-buffer)))
7560 (if (and (eq major-mode
'spice-mode
)
7561 (not (eq current buffer
)))
7563 (message "Killing %s" buffer
)
7564 (kill-buffer buffer
))))
7568 ;; ======================================================================
7569 ;; folding for commented out regions ...
7570 ;;; taken from and adapted:
7571 ;;; Filename: foldingo.el
7572 ;;; Author: Christian Queinnec <Christian.Queinnec@lip6.fr>
7573 ;; This is work in progress; (user) interface might change
7575 (defvar spice-some-comment-regions-are-hidden nil
7576 "Keeps track if some comment regions are hidden.")
7577 (make-variable-buffer-local 'spice-some-comment-regions-are-hidden
)
7579 (defvar spice-last-hide-comment-regions-tick nil
7580 "Keeps track when last time comment hiding was called.")
7581 (make-variable-buffer-local 'spice-last-hide-comment-regions-tick
)
7583 (defun spice-hide-init ()
7584 "Initialize buffer local variables to make hiding of spice regions
7586 ;; trick to make a comment-start/padding dependent regexp:
7587 (custom-initialize-reset 'spice-hide-line-prefix
7588 (car (get 'spice-hide-line-prefix
7590 ;; make sure we have invisibility property working, local for a buffer
7591 (if (fboundp 'add-to-invisibility-spec
)
7592 (add-to-invisibility-spec 'spice-mode
))
7593 ;; (remove-from-invisibility-spec '(spice-mode . t))
7594 ;; local for buffers:
7595 (set (make-local-variable 'line-move-ignore-invisible
) t
)
7596 (if spice-auto-hide-comments
7597 (spice-hide-all-comments))
7600 (defun spice-hide (from to
)
7601 "Not supported, don't use this."
7603 (spice-hide-region from to t
))
7605 (defun spice-unhide (from to
)
7606 "Not supported, don't use this."
7608 (spice-hide-region from to nil
))
7610 (defun spice-hide-all-comments-p ()
7611 "Checks if there are comments that can be hidden...; assumes that if
7612 the user edited the file, new comments might have been created and
7613 thus hide all comments must be activated. This is not the best
7614 criterion, but it is safe."
7616 ;; (message "buffer tick is %s, last hide comment is %s"
7617 ;; (buffer-modified-tick) spice-last-hide-comment-regions-tick)
7619 spice-last-hide-comment-regions-tick
; can be nil
7620 (= spice-last-hide-comment-regions-tick
(buffer-modified-tick)))
7623 (defun spice-hide-all-comments ()
7624 "Hides all commented out regions in the current spice deck. Allows
7625 to get a better overview of the deck if many lines are commented out.
7626 It relies on having all regions being commented out using the
7627 \"Comment Region\" menu entry that uses `comment-region'. The regexp
7628 used to match comment lines, `spice-hide-line-prefix', might identify
7629 standard spice comment lines used for documentation. To avoid
7630 problems, make sure documentation is not part of comments. For
7631 instance by using the doc starters available in the spice languages,
7632 or by making sure they are different from the comment lines generated
7633 with the menu entry, by placing two *'s when the default comment is
7634 only one *. If you want to unhide all the hidden comment lines, use
7635 `spice-unhide-all-comments'."
7637 (spice-unhide-all-comments)
7638 (setq spice-last-hide-comment-regions-tick
(buffer-modified-tick))
7640 (goto-char (point-min))
7641 ;; (message "beginning of buffer reached %s" (point))
7643 (while (search-forward-regexp (concat "^" spice-hide-line-prefix
)
7646 ;; (message "reached %s" (point))
7650 ;; (message "found start of regexp %s" (point))
7651 (setq lines
(forward-line))
7652 ;; (message "%s left" lines)
7653 ;; the empty lines following commented lines are also hidden
7654 (while (and (looking-at (concat "^\\(" spice-hide-line-prefix
"\\|[ ]*$\\)"))
7655 (= (setq lines
(forward-line)) 0))
7656 ;; (message "%s left" lines)
7659 (spice-hide-region beg end t
))))
7660 (spice-set-spice-name)
7663 (defun spice-unhide-all-comments ()
7664 "Unhides all hidden comment regions."
7666 (setq spice-some-comment-regions-are-hidden nil
)
7667 (setq spice-last-hide-comment-regions-tick nil
)
7668 (spice-hide-region (point-min) (point-max) nil
)
7669 (spice-set-spice-name)) ;; update mode-line
7671 (defun spice-hide-region (from to flag
)
7672 "Hides or shows lines from FROM to TO, according to FLAG. If FLAG
7673 is nil then the text is shown, while if FLAG is t the text is hidden."
7674 (let ((inhibit-read-only t
))
7677 ; (foldingo-discard-overlays (point) to 'invisible 'spice-comment)
7678 (spice-discard-overlays from to
'spice-comment
)
7680 (let ((overlay (make-overlay (point) to
)))
7681 (spice-make-overlay-hidden overlay
))))))
7683 (defun spice-make-overlay-hidden (overlay)
7684 ;; Make overlay hidden and intangible.
7685 ;; (overlay-put overlay 'intangible t)
7686 (overlay-put overlay
'invisible
'spice-mode
)
7687 (overlay-put overlay
'spice-comment t
)
7688 (setq spice-some-comment-regions-are-hidden t
)
7689 ;; (overlay-put overlay 'intangible t)
7692 (defun spice-discard-overlays (from to prop
)
7693 "discards overlays in region FROM to TO that have property PROP set."
7694 (let ((inhibit-read-only t
))
7697 (while (< (point) to
)
7698 (let ((overlays (overlays-at (point))))
7700 (let ((o (car overlays
)))
7701 (if (overlay-get o prop
)
7702 (delete-overlay o
)))
7703 (setq overlays
(cdr overlays
))))
7704 (goto-char (next-overlay-change (point)))))))
7707 ;; ======================================================================
7708 ;; utility spice-mode-output functions
7710 (defun spice-check-output-mode ()
7711 "Check if current buffer is output file and return symbol or NIL."
7713 (goto-char (point-min))
7714 (if (looking-at "1\\*\\*\\*\\*\\*\\*\\*") ; eldo
7716 (if (or (looking-at "Using: ")
7717 (looking-at " \\*\\*\\*\\*\\*\\* Star-HSPICE")) ; hspice
7721 (defun spice-output-p ()
7722 "Check if current buffer is output file."
7724 (if spice-output-local t nil
))
7726 (defconst spice-output-sections-regexp
7729 "\\(0\\*\\*\\*\\*\\| \\*\\*\\*\\*\\*\\*\\) *"
7730 "\\( [a-z0-9]\\w*\\(\\s-+\\w+\\)* \\)\\s-+\\(t[a-z]*\\) ?=.*$")
7731 "Regexp identifying spice output headers (both hspice and eldo).")
7733 (defvar spice-output-font-lock-keywords
7735 (list spice-output-sections-regexp
7736 '(1 font-lock-comment-face
)
7737 '(2 spice-title-face
)
7738 (list 4 spice-constant-face
))
7739 (list "^[0-1] ?\\*.*$" 0 font-lock-comment-face
)
7740 (list "^ \\(\\*\\*\\*\\*\\*?\\) \\(.*\\)$"
7741 '(1 font-lock-comment-face
)
7742 '(2 font-lock-type-face
))
7743 (list "^\\(FATAL \\)?ERROR.+$" 0 'font-lock-warning-face
) ; eldo errors
7744 (list "^\\s-*\\(..?error..?[: ]\\).+$" 0 'font-lock-warning-face
) ; hspice errors
7746 "List of regexps for font-lock in output mode."
7749 (defun spice-mode-output ()
7750 "Spice major mode start up function for spice output files. Experimental ;)"
7752 (setq buffer-read-only t
) ; don't want to edit output files, do we
7753 ; common mistake in hspice output files!
7755 ;; use local keymap (for keys and menu)
7756 (use-local-map spice-output-mode-map
)
7758 ;; set menu for local buffer
7759 (easy-menu-define spice-output-menu spice-output-mode-map
7760 "Menu keymap for Spice Output Mode." spice-output-menu-list
)
7762 ;; font-lock local start-up
7763 (set (make-local-variable 'font-lock-defaults
)
7764 (list 'spice-output-font-lock-keywords
7765 nil t
(list (cons ?
\" "w")))) ; nil, t (do multiline
7768 ;; imenu buffer local init
7769 (set (make-local-variable 'imenu-case-fold-search
) t
)
7770 (set (make-local-variable 'imenu-generic-expression
)
7771 (list (list "*Errors*"
7772 "^\\s-*\\(\\(..?error..?[: ]\\|\\(FATAL \\)?ERROR\\).+$\\)"
7774 (list nil
;; "*Sections*"
7775 spice-output-sections-regexp
7780 (defun spice-output-filename ()
7781 "Determines output filename of current spice deck."
7783 (let ((filename nil
)
7784 (l spice-output-filename-alist
))
7786 (if (spice-standard-p (car (car l
)))
7788 (setq filename
(eval (car (cdr (car l
)))))
7789 ;; (message "Checking filename %s" filename)
7790 (if (file-readable-p filename
)
7792 (setq filename nil
))))
7796 (defun spice-output-file-p ()
7797 "Checks if an output file is available for current spice deck."
7799 (and (not spice-output-local
)
7801 (spice-output-filename)))
7803 (defun spice-load-output-file-internal (filename)
7804 "Loads output file into emacs and sets major mode"
7808 (file-readable-p filename
))
7810 (find-file-other-window filename
)
7813 (defun spice-load-output-file ()
7814 "Loads output file into spice, calls `spice-load-output-file-internal'
7815 to do the actual work, this is called from the menu or key binding"
7818 (setq filename
(spice-output-filename))
7819 (spice-load-output-file-internal filename
)))
7822 ;; ======================================================================
7823 ;; .guess statement auxiliary functions (eldo !)
7825 (defvar spice-guess-nodeset-statements nil
7826 "holds temp .guess/nodeset statements")
7828 (defun spice-derive-guess-nodeset-statements (from to
)
7829 "Derives .guess/nodeset statements from DC operating point
7830 lines. This implements the hspice functionality of .ic0 files for
7835 (goto-char (max from to
))
7836 (setq m1
(make-marker))
7837 (set-marker m1
(point))
7838 (goto-char (min from to
))
7839 (while (re-search-forward "^\\s-*\\(\\S-+\\)\\s-+\\([-0-9\.E+]+\\)"
7842 ;;(message "Inserting .guess...(%s)" (make-string (incf count) ?.))
7843 ;;(beginning-of-line)
7844 ;;(insert ".guess V(" (match-string 1) ") = " (match-string 2) "\n*")
7845 (setq spice-guess-nodeset-statements
7846 (append spice-guess-nodeset-statements
7848 (match-string-no-properties 1)
7850 (match-string-no-properties 2)))
7855 (defun spice-create-guess-nodeset-file (str)
7856 "Creates a <buffer-file-name>_guess/nodeset.cir file from node
7857 voltage pairs in the current output file."
7859 (setq spice-guess-nodeset-statements nil
)
7860 (let (from to outbuf stats filename
)
7861 (setq filename
(file-name-nondirectory buffer-file-name
))
7863 (goto-char (point-min))
7864 (setq from
(re-search-forward "^\\s-+NODE\\s-+VOLTAGE\\s-*$" (point-max) t
))
7866 (setq to
(re-search-forward "^$" (point-max) t
)))
7868 (spice-derive-guess-nodeset-statements from to
)))
7869 (if (not spice-guess-nodeset-statements
)
7870 (message "Didn't find 'node -- voltage' pairs in output file...")
7872 (find-file-noselect (concat
7873 (file-name-sans-extension buffer-file-name
)
7875 (switch-to-buffer-other-window outbuf
)
7877 (insert "* ." str
" statements derived from " filename
" ["
7878 (format-time-string "%b %d %Y") " " (format-time-string "%T")
7880 (setq stats spice-guess-nodeset-statements
)
7885 (insert (car stats
))
7887 (setq stats
(cdr stats
)))
7888 (insert "\n\n* ." str
" statements derived "
7889 (format-time-string "%b %d %Y") " "
7890 (format-time-string "%T") "\n\n")
7892 (goto-char (point-min))
7898 (defun spice-replace-with-guess-statements (from to
)
7899 "replace with .guess statements."
7901 (spice-replace-with-guess-nodeset-statements "guess" from to
))
7904 (defun spice-replace-with-nodeset-statements (from to
)
7905 "replace with .nodeset statements."
7907 (spice-replace-with-guess-nodeset-statements "nodeset" from to
))
7910 (defun spice-replace-with-guess-nodeset-statements (str from to
)
7911 "Replaces selected region with .guess/nodeset statements."
7913 (setq spice-guess-nodeset-statements nil
)
7915 (spice-derive-guess-nodeset-statements from to
))
7916 (if (not spice-guess-nodeset-statements
)
7917 (message "Didn't find any 'node -- voltage' pairs in region...")
7919 (kill-region from to
)
7920 (setq stats spice-guess-nodeset-statements
)
7925 (insert (car stats
))
7927 (setq stats
(cdr stats
))))
7931 ;; ======================================================================
7932 ;; fill-prefix related functions
7934 (defvar spice-save-comment-line-break-function nil
7935 "*Mode specific variable to save previous line break function in.")
7937 (defun spice-comment-indent-new-line (&optional soft
)
7938 "Spice mode comment-indent-new-line function, used by `auto-fill'. Sets
7939 `fill-prefix' depending on context: comment prefix if in comment with special
7940 layla handling (!); \"!\" doc prefix if in hspice mode; \"$\" doc prefix
7941 in eldo mode, otherwise uses \"+ \" prefix."
7943 (let ((fpx fill-prefix
) ; remember prefix
7944 (end (point))) ; don't look beyond point for doc starters
7948 (looking-at (concat "\\([" comment-start
7949 (when (spice-standard-p 'layla
)
7950 spice-continuation-prefix
)
7951 (when (spice-standard-p 'hspice
)
7953 (when (spice-standard-p 'eldo
)
7957 (spice-standard-p 'hspice
)
7958 (re-search-forward "\\s-\\([$]\\)" end t
))
7960 (spice-standard-p 'eldo
)
7961 (re-search-forward "\\s-\\([!]\\)" end t
))))
7962 (setq fill-prefix
(concat (match-string-no-properties 1) " "))
7963 (setq fill-prefix
(concat spice-continuation-prefix
" ")))
7964 ;(comment-indent-new-line) ;;call standard comment-indent-new-line function
7965 (when spice-save-comment-line-break-function
7966 (funcall spice-save-comment-line-break-function
))
7967 (setq fill-prefix fpx
)))
7970 (defun spice-fill-context-prefix () ; ???
7971 "Calculates prefix from current position (move-to-left-margin), and
7972 returns it. Non-comment paragraphs can also be filled correctly."
7973 ;; (message "deriving fill prefix")
7975 (if (or (looking-at (concat "\\([" comment-start
7976 (when (spice-standard-p 'layla
)
7977 spice-continuation-prefix
)
7979 (looking-at "\\([$!]+\\)"))
7980 (concat (match-string-no-properties 1) " ")
7981 (concat spice-continuation-prefix
" "))))
7982 ;; (message (format "result is '%s'" result))
7985 (defun spice-delete-indentation (&optional arg
)
7986 "Wrapper for `delete-indentation', sets `fill-prefix' to adequate value."
7988 (let ((fillpfx fill-prefix
))
7990 (if arg
(forward-line 1))
7991 (if (looking-at "\\([+$!*]+\\)") ;; don't check submodes here ?
7992 (setq fill-prefix
(match-string-no-properties 1)))
7993 (delete-indentation)
7994 (setq fill-prefix fillpfx
)))
7997 ;; ======================================================================
7998 ;; msb fix (from cperl-mode.el)
7999 (defvar spice-msb-fixed nil
) ;; global variable keeping track of addition
8001 (defun spice-msb-fix ()
8002 "Adds \"Spice Decks\" entry in msb menu, assumes that msb is already loaded"
8003 (setq spice-msb-fixed t
)
8004 (let* ((l (length msb-menu-cond
))
8005 (last (nth (1- l
) msb-menu-cond
))
8006 (precdr (nthcdr (- l
2) msb-menu-cond
)) ; cdr of this is last
8007 (handle (1- (nth 1 last
))))
8008 (setcdr precdr
(list
8010 '(eq major-mode
'spice-mode
)
8016 ;; ======================================================================
8017 ;; utility spice-mode functions
8019 (defun spice-about ()
8022 (message "spice-mode version %s, © %s" spice-version spice-developer
))
8024 (defun spice-set-spice-name ()
8025 "Set mode line name of spice mode"
8026 (setq mode-name
"Spice"))
8028 ;; (defun spice-set-spice-name ()
8029 ;; "Set mode line name of spice mode"
8032 ;; (when (not spice-output-local)
8034 ;; (when (spice-standard-p 'layla) "Layla")
8035 ;; (when (spice-standard-p 'mondriaan) "-Mdrn")
8036 ;; (when (spice-standard-p 'hspice)
8037 ;; (when (spice-standard-p 'layla) "/"))
8038 ;; (when (spice-standard-p 'hspice) "Hspice")
8039 ;; (when (spice-standard-p 'eldo)
8040 ;; (when (or (spice-standard-p 'hspice)
8041 ;; (spice-standard-p 'layla)) "/"))
8042 ;; (when (spice-standard-p 'eldo) "Eldo")
8043 ;; (when (spice-standard-p 'eldorf) "-RF")
8044 ;; (when (spice-standard-p 'eldovloga) "-VlA")
8045 ;; (when (spice-standard-p 'fasthenry)
8046 ;; (when (or (spice-standard-p 'eldo)
8047 ;; (spice-standard-p 'hspice)
8048 ;; (spice-standard-p 'layla)) "/"))
8049 ;; (when (spice-standard-p 'fasthenry) "FastHenry")
8050 ;; (when (spice-standard-p 'draccdl)
8051 ;; (when (or (spice-standard-p 'eldo)
8052 ;; (spice-standard-p 'hspice)
8053 ;; (spice-standard-p 'layla)
8054 ;; (spice-standard-p 'fasthenry)) "/"))
8055 ;; (when (spice-standard-p 'draccdl) "DracCDL")
8056 ;; (when (spice-standard-p 'spectre)
8057 ;; (when (or (spice-standard-p 'eldo)
8058 ;; (spice-standard-p 'hspice)
8059 ;; (spice-standard-p 'layla)
8060 ;; (spice-standard-p 'fasthenry)
8061 ;; (spice-standard-p 'draccdl)) "/"))
8062 ;; (when (spice-standard-p 'spectre) "Spectre")
8063 ;; (when (or (spice-standard-p 'fasthenry)
8064 ;; (spice-standard-p 'eldo)
8065 ;; (spice-standard-p 'hspice)
8066 ;; (spice-standard-p 'layla)
8067 ;; (spice-standard-p 'draccdl)
8068 ;; (spice-standard-p 'spectre)) "|")))
8070 ;; (when spice-output-local "-output")
8071 ;; (when spice-some-comment-regions-are-hidden " H+"))))
8074 (defun spice-check-spice-standard ()
8075 "checks if spice-standard is set to a correct value."
8076 ;; if mondriaan then also layla
8077 (when (spice-standard-p 'mondriaan
)
8078 (unless (spice-standard-p 'layla
)
8079 (error "Error: turn on Layla when you want to use Mondriaan")))
8080 ;; if eldoRf then also eldo
8081 (when (spice-standard-p 'eldorf
)
8082 (unless (spice-standard-p 'eldo
)
8083 (error "Error: turn on Eldo when you want to use Eldo RF")))
8084 ;; if eldo verilog-A then also eldo
8085 (when (spice-standard-p 'eldovloga
)
8086 (unless (spice-standard-p 'eldo
)
8087 (error "Error: turn on Eldo when you want to use Eldo Verilog-A")))
8090 (defun spice-update-existing-buffers ()
8091 "updates all spice-mode buffers with new customization"
8093 (let ((current (current-buffer)))
8097 (if (and (eq major-mode
'spice-mode
)
8098 (not (eq current buffer
)))
8100 (message "Activating customizations in %s" buffer
)
8101 (spice-activate-customizations-local))))
8106 (defun spice-activate-customizations-local ()
8107 "Activates customization (of global variables) in current buffer."
8108 (if (spice-output-p)
8109 (use-local-map spice-output-mode-map
)
8110 (use-local-map spice-mode-map
))
8111 (spice-set-spice-name)
8112 (spice-update-mode-menu)
8113 (set-syntax-table spice-mode-syntax-table
)
8114 (if (not (spice-output-p))
8115 (setq imenu-generic-expression spice-imenu-generic-expression
))
8116 (when spice-imenu-add-to-menubar
8117 (imenu-add-to-menubar "Index"))
8119 (setq imenu--index-alist nil
)
8120 (imenu--make-index-alist t
)
8121 (spice-compile-init)
8122 (spice-waveform-viewer-init)
8123 (if (fboundp 'font-lock-unset-defaults
)
8124 (font-lock-unset-defaults))
8125 (font-lock-set-defaults)
8130 (defun spice-activate-customizations-obsolete ()
8131 "Activate all customizations on local variables.
8133 Run this if you set the spice-standard variable to modify
8134 spice-mode's behaviour in the local buffer. It sets up the buffer
8135 local variables using the modified global variables of the
8136 customization buffer."
8138 (if (spice-output-p)
8139 (use-local-map spice-output-mode-map
)
8140 (use-local-map spice-mode-map
))
8141 ;; (setq spice-standard-local spice-standard)
8142 (spice-set-spice-name)
8144 (spice-update-mode-menu)
8145 (spice-mode-syntax-table-init)
8146 (set-syntax-table spice-mode-syntax-table
)
8147 (spice-keywords-init)
8148 (spice-font-lock-init)
8150 (if (not (spice-output-p))
8151 (setq imenu-generic-expression spice-imenu-generic-expression
))
8152 ;; add imenu to menubar ?
8153 (when spice-imenu-add-to-menubar
8154 (imenu-add-to-menubar "Index"))
8155 (spice-compile-variables-init)
8156 (spice-compile-init)
8157 (spice-waveform-viewer-init)
8158 (if (fboundp 'font-lock-unset-defaults
)
8159 (font-lock-unset-defaults))
8160 ;; (setq font-lock-defaults
8161 ;; (list 'spice-font-lock-keywords nil t (list (cons ?\" "w"))))
8162 (font-lock-set-defaults)
8166 ;; ======================================================================
8167 ;; spice-mode main entry point
8168 ;; ======================================================================
8170 (defun spice-mode ()
8171 "Major mode for editing spice decks in (X)Emacs.
8173 Entry to Spice mode calls the value of the variable `spice-mode-hook'
8174 with no args, if that value is non-nil after initialization is finished.
8179 - Comprehensive menu
8181 - Highlighting of (extended) SPICE syntax, with (limited) ERROR notification
8182 Please setup spice-mode to recognize the correct syntax through
8183 customization of the `spice-standard' variable. You can use the menu
8184 entry Spice->Customize->Spice Standard to do this interactively.
8186 - Template insertion (abbrev/electrification) for many spice constructs,
8187 two alternatives are available: Abbrev minor mode and `tempo-complete-tag'
8188 + Abbrevs can be turned on and off via the Settings submenu.
8189 To see the available abbrevs, use `M-x list-abbrevs' or use the menu
8190 after enabling abbrev minor mode. To find out what key sequence
8191 triggers an expand do 'C-h w expand-abbrev'.
8192 + `tempo-complete-tag' is bound to <tab> - for example, type 'M<tab>'
8193 at the beginning of a line and you will be prompted with a complete
8194 Mosfet template. Most tags are pretty straightforward i.e 'C' for a
8195 capacitor, 'L' for an inductance etc...
8196 You can type `C-h v tempo-tags'for a complete list of tags and
8197 associated templates. Note: to insert a real <TAB>, use <C-q TAB> or
8200 - Comment & documentation string handling
8201 + the '*' symbol is used to comment out a whole line - that symbol has
8202 to be at the beginning of a line
8203 + the '!' and '$' symbols are used to document your netlist in eldo
8204 and hspice/layla mode respectively
8205 + menu entry to comment out region/uncomment region
8206 + key bindings for commenting/uncommenting a region as in `auctex-mode'.
8208 - Comment hiding support
8209 + Can hide all commented out regions in a buffer to improve readability
8210 + prefix string is customizable: `spice-hide-line-prefix'.
8211 + custom variable can be set to automatically hide all commented regions
8212 at load time (`spice-auto-hide-comments')
8213 + requires use of doc strings, otherwise also documentation might be
8215 + When parts of the deck are hidden the string \"H+\" appears in the
8218 - Imenu (Index menu and/or shift right click in emacs if configured)
8219 + shows subcircuit definitions
8220 + shows .end statements in submenu
8221 + shows device models in submenus
8222 + shows libraries (.lib/.inc) in submenu
8223 + shows analyses in submenu
8224 + shows sections in submenu
8225 + shows output file sections in menu
8226 + shows LAYLA objects in submenus if layla submode has been enabled
8227 + can be added to the menubar by setting `spice-imenu-add-to-menubar'
8228 (uses `imenu-add-to-menubar' to add an Imenu entry to the menubar).
8230 - File browser using Speedbar (`speedbar') and/or index/sources menu
8232 - .inc/.include/.lib/.libfas access
8233 + through mouse-2 click (`ffap-at-mouse' or `spice-load-file-at-mouse')
8234 + using \\r (ie. <return>), (`ffap')
8235 + through menu entry all include/lib files of a deck can be loaded at
8236 once (`spice-load-include-files'), recursively.
8238 - Searching for .subckt defs: `spice-search-subckt' or `C-c C-s'
8239 + extracts subcircuit name from context
8241 + mark is set where search has been started if the definition is found
8242 in the same file. Return to mark with `C-u C-<SPC>' (or `C-u C-@')
8243 as with interactive searches (fi `isearch-forward')
8244 + be careful when starting the search from an included file,
8245 correctness can not be guaranteed. Starting a search from
8246 a top-level .cir file gives correct results. The latest used
8247 top-level file is stored (a top-level file contains a .end
8248 statement !), and also searched if the subckt def is not found in
8249 a first pass (for instance when starting from an included file).
8251 - Postscript printing with fontification (through `ps-print' package).
8253 - Addition of Spice Deck submenu in msb mode, see `msb', `spice-msb-fix'.
8255 - Section support (as in eldo-mode):
8256 + add section headers, goto section through menu entries or interactive
8257 + customizable through `spice-section-alist', you can add your
8258 own section headers, alter the list of predefined sections, ...
8259 + Changelog addition through `spice-add-changelog-entry', or
8263 + use `spice-simulator' and `spice-simulator-switches' to
8264 select your simulator from `spice-simulator-alist'.
8265 + Support for error parsing of spice3 (batch-mode, -b),
8266 hspice, eldo and spectre. Add your own in spice-mode or through
8267 customization in `.emacs'.
8268 + use local file variables to customize per file as follows:
8275 * spice-simulator: \"Hspice\"
8276 * spice-simulator-switches: \"\"
8277 * eval: (spice-set-command)
8279 <<< test.cir ends here >>>
8281 - Waveform viewer support (beta)
8282 + use `spice-waveform-viewer' and `spice-waveform-viewer-switches' to
8283 select your waveform from `spice-waveform-viewer-alist'.
8284 + Support for interactive (command-line) waveform viewer such as
8285 nutmeg, or batch (GUI) type waveform viewer such as xelga or gsi.
8287 - Output file support
8288 + can load output file from menu (checks if file exists and is readable)
8289 + imenu in output files shows output file sections
8290 + for eldo .chi files: can create <file>_guess.cir files automatically
8291 for inclusion in <file>.cir file through
8292 `spice-create-guess-nodeset-file'
8293 or `spice-replace-with-guess-nodeset-statements'; this speeds up DC
8294 convergence for AC analyses.
8296 - (Fully) customizable
8297 + can select spice compatibility mode:
8298 * spice2g6/3 (default)
8300 * eldo (default), RF and verilog-A extensions
8301 * fasthenry (default)
8303 * LAYLA, Mondriaan extensions
8304 * any combination of the above (there are conflicts however, so not
8305 all keyword fontification is correct in the latter case)
8306 + spice-mode font-lock faces
8307 + spice-mode default initialization of empty/new files determined by
8308 `spice-initialize-empty-file', `spice-initialize-template-file',
8309 `spice-default-header' and `spice-initialize-file-function'.
8310 + see the customization examples in the `spice-mode.el' file header
8311 + You can adapt `spice-simulator-alist' for your local site in
8312 `spice-mode.el' or in `.emacs' through customization.
8313 + You can adapt `spice-waveform-viewer-alist' for your local site in
8314 `spice-mode.el' or in `.emacs' through customization.
8315 + You can adapt `spice-section-alist' for your local site in
8316 `spice-mode.el' or in `.emacs' through customization.
8318 - Auto fill minor mode support
8319 + can be turned on from the Settings menu
8320 + auto fill works both for element where the continuation character
8321 is a '+', as well as in comment/doc mode where the continuation
8322 character is a '*', '$' or a '!'.
8323 + uses `fill-column' to determine where to wrap the line
8324 + doesn't use `fill-prefix'. A context dependent prefix is calculated
8325 through the `spice-comment-indent-new-line' function. This function
8326 is used as `comment-line-break-function' instead of the default line
8327 break function (in emacs: `comment-indent-new-line').
8329 - Paragraph support: [a-z] starts dev lines, '+' continues dev lines,
8330 [*!$] start paragraphs.
8332 - Works under GNU Emacs20.6/21.[123].
8335 Do not use a -*- Mode -*- line in a spice deck as the first card in
8336 the deck is defined to be the title card. Rather, autoload spice-mode
8337 through your .emacs file:
8339 (autoload 'spice-mode \"spice-mode\" \"Spice/Layla Editing Mode\" t)
8340 (setq auto-mode-alist (append (list (cons \"\\\\.sp$\" 'spice-mode)
8341 (cons \"\\\\.cir$\" 'spice-mode)
8342 (cons \"\\\\.cdl$\" 'spice-mode)
8343 (cons \"\\\\.chi$\" 'spice-mode) ; output
8344 (cons \"\\\\.mod$\" 'spice-mode)); models
8347 Alternative methods are provided in the spice-mode.el file header.
8349 Key bindings in highlighted include file lines:
8350 -----------------------------------------------
8352 \\{spice-mode-mouse-map}
8354 Key bindings for other parts in the file:
8355 -----------------------------------------
8359 ;;Key bindings for output files:
8360 ;;------------------------------
8362 ;;\\{spice-output-mode-map}
8366 (kill-all-local-variables) ; important !
8368 (setq major-mode
'spice-mode
)
8369 (setq mode-name
"Spice")
8371 ;; remember if this file is an output type
8372 (set (make-local-variable 'spice-output-local
) (spice-check-output-mode))
8375 (spice-set-spice-name)
8377 ;; build global syntax table
8378 (unless spice-mode-syntax-table
8379 (spice-mode-syntax-table-init))
8380 ;; set it for local buffer
8381 (set-syntax-table spice-mode-syntax-table
)
8383 ;; initialize global spice keywords, required for output mode !
8384 (unless spice-keywords
8385 (spice-keywords-init))
8387 ;; global font-lock start-up
8388 (unless spice-font-lock-keywords
8389 (spice-font-lock-init))
8391 ;; create global Spice mode menu's: mode-menu and output-mode-menu
8392 (unless (and spice-menu-list spice-output-menu-list
)
8395 ;; global spice-imenu init (not output mode !)
8396 (unless spice-imenu-generic-expression
8399 ;; global vars for compile init
8400 (unless spice-compilation-error-regexp-alist
8401 (spice-compile-variables-init))
8403 (set (make-local-variable 'parse-sexp-ignore-comments
) nil
)
8405 (set (make-local-variable 'tempo-interactive
) t
)
8406 (set (make-local-variable 'require-final-newline
) t
) ; hspice empty deck errors
8408 (set (make-local-variable 'comment-start
) "*")
8409 (set (make-local-variable 'comment-end
) "")
8410 (set (make-local-variable 'comment-start-skip
) "\*")
8411 (set (make-local-variable 'comment-multi-line
) nil
)
8413 ;;------------------------------------------------------------
8414 ;; initialize hiding functions, mix of global and buffer local settings
8417 (if (spice-output-p)
8420 ;; use local keymap (for keys and menu)
8421 (use-local-map spice-mode-map
)
8423 ;; set menu for local buffer
8424 (easy-menu-define spice-menu spice-mode-map
8425 "Menu keymap for Spice Mode." spice-menu-list
)
8427 ;; abbreviations table: buffer local
8428 (setq local-abbrev-table spice-mode-abbrev-table
)
8430 ;; buffer local init
8431 (set (make-local-variable 'fill-prefix
) nil
) ; automatically derived
8432 ;; remove auto-fill-inhibit and added spice-comment-indent... function
8433 ;; (set (make-local-variable 'auto-fill-inhibit-regexp) "^\*[^\.\+].*")
8435 ;; buffer local init for indentation of comment
8436 (set (make-local-variable 'spice-save-comment-line-break-function
)
8437 comment-line-break-function
)
8438 (set (make-local-variable 'comment-line-break-function
)
8439 'spice-comment-indent-new-line
)
8440 (set (make-local-variable 'fill-column
) 78) ;; was 80
8442 ;; support for paragraphs (is it useful?) ; this is really arbitrary
8444 ;; (set (make-local-variable 'paragraph-start) "^[!$*]-.*$")
8445 ;; (set (make-local-variable 'paragraph-separate) "^[!$*]-.*$")
8446 (set (make-local-variable 'paragraph-start
)
8447 "\\([a-z\\.].*\\([\n][+].*\\)*\\|[$]...+\\|[!]...+\\|[ \t\f]*$\\|\\*...+\\|.*\\s-[$!].*$\\)")
8448 ;; (set (make-local-variable 'paragraph-separate) "[a-z$!*]")
8449 (set (make-local-variable 'paragraph-separate
) "\\([ \t\f]*\\|.*\\s-[$!].*\\)$")
8450 (set (make-local-variable 'adaptive-fill-regexp
) nil
)
8451 (set (make-local-variable 'adaptive-fill-function
) 'spice-fill-context-prefix
)
8452 (set (make-local-variable 'adaptive-fill-first-line-regexp
) "[*$!+]\\s-+")
8454 ;; Tempo tags - using 'tempo-local-tags' doesn't work (why??)
8455 (set (make-local-variable 'tempo-tags
)
8456 (append spice-tempo-tags tempo-tags
))
8458 ;; buffer local font lock
8459 (set (make-local-variable 'font-lock-defaults
)
8460 (list 'spice-font-lock-keywords nil t
(list (cons ?
\" "w")))) ;; nil, t (do multiline comments)
8461 (set (make-local-variable 'font-lock-multiline
) t
)
8462 (font-lock-set-defaults)
8465 (set (make-local-variable 'imenu-case-fold-search
) t
)
8466 ;; buffer local imenu init
8467 (set (make-local-variable 'imenu-generic-expression
)
8468 spice-imenu-generic-expression
)
8470 ;; add speedbar (global, can be moved ?)
8471 (spice-speedbar-init)
8473 ;;------------------------------------------------------------
8474 ;; now hook in 'spice-colorize-libraries (eldo-mode.el)
8475 ;; all buffer local:
8476 (add-hook 'font-lock-after-fontify-buffer-hook
8477 'spice-colorize-libraries-buffer t t
) ; not in emacs 20
8478 (add-hook 'after-change-functions
'spice-colorize-libraries t t
)
8479 (spice-colorize-libraries-buffer)
8481 ;;------------------------------------------------------------
8482 ;; compile buffer local init
8483 (spice-compile-init)
8485 ;;------------------------------------------------------------
8486 ;; buffer local init
8487 (spice-waveform-viewer-init)
8489 ;; if new file add a default template
8490 (if (and (= (buffer-size) 0)
8491 (not buffer-read-only
)
8492 spice-initialize-empty-file
8493 (functionp spice-initialize-file-function
))
8494 (funcall spice-initialize-file-function
))
8496 ) ;; matches big if (normal spice or spice output mode)
8498 ;; build imenu, buffer local
8499 (imenu--make-index-alist t
)
8501 ;; add imenu to menubar, buffer local
8502 (when spice-imenu-add-to-menubar
8503 (imenu-add-to-menubar "Index"))
8505 ;; msb fix, run only once
8506 (and (featurep 'msb
) ;; have we got this feature ?
8507 msb-mode
;; is it on ?
8508 (boundp 'msb-menu-cond
) ;; still using msb-menu-cond ?
8509 (not spice-msb-fixed
) ;; haven't yet added spice decks category ?
8510 (spice-msb-fix)) ;; add category
8512 ;; open describe window, hope this doesn't annoy people too much...
8513 (if spice-show-describe-mode
8515 (describe-mode) ;; aha...
8516 (setq spice-show-describe-mode nil
)) ;; but only once in a session !!
8518 (if spice-echo-intro
8519 (message "Spice mode %s. Type C-h m for documentation." ;; always
8522 ;; run spice-mode hooks
8523 (run-hooks 'spice-mode-hook
)
8527 ;; this is sometimes useful
8528 (provide 'spice-mode
)
8530 ;;; spice-mode.el ends here
8532 ;;; Local Variables: