Update library homepage
[spice-mode.git] / spice-mode.el
blob261aa1353cd5c50aa46d8dd206f25f9afda6c4a0
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
10 ;; Version: 1.2.25
11 ;; Maintainer: Geert A. M. Van der Plas <geert_vanderplas@email.com>
12 ;; Last-Updated: 01 November 2004
13 ;; Description: spice file editing
14 ;; Homepage: https://repo.or.cz/spice-mode.git
15 ;; URL: http://spice-mode.4t.com/
16 ;; old-URL: http://www.esat.kuleuven.ac.be/~vdplas/emacs/
18 ;; Please send suggestions and bug reports to
19 ;; mailto:Geert_VanderPlas@email.com
21 ;; Copyright (C) 1994, MIT Artificial Intelligence Lab
22 ;; Copyright (C) 1997- Emmanuel Rouat
23 ;; Copyright (C) 1999- Geert A. M. Van der Plas
25 ;; This file is free software; you can redistribute it and/or modify
26 ;; it under the terms of the GNU General Public License as published by
27 ;; the Free Software Foundation; either version 2, or (at your option)
28 ;; any later version.
30 ;; This file is distributed in the hope that it will be useful,
31 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;; GNU General Public License for more details.
35 ;; You should have received a copy of the GNU General Public License
36 ;; along with GNU Emacs; see the file COPYING. If not, write to
37 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
39 ;; INSTALL:
40 ;; ========
42 ;; byte compile spice-mode.el to spice-mode.elc (see `byte-compile-file')
43 ;; put these two files in an arbitrary, but accesible directory
44 ;; for example: $HOME/emacs, /usr/lib/emacs/site-lisp/ or
45 ;; /usr/local/lib/emacs/site-lisp/
47 ;; If you chose a non-standard place to put the files add the following
48 ;; line to your Emacs start-up file (`.emacs') or custom `site-start.el'
49 ;; file (replace <directory-name> by the directory where you placed
50 ;; spice-mode.el and spice-mode.elc):
51 ;; (setq load-path (cons (expand-file-name "<directory-name>") load-path))
53 ;; To use spice-mode, add either the following to your `.emacs' file. This
54 ;; assumes that you will use the .sp, .cir, .ckt, .mod, ... extensions for
55 ;; your spice source decks and output files:
56 ;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
57 ;; (setq auto-mode-alist (append (list (cons "\\.sp$" 'spice-mode)
58 ;; (cons "\\.cir$" 'spice-mode)
59 ;; (cons "\\.ckt$" 'spice-mode)
60 ;; (cons "\\.mod$" 'spice-mode)
61 ;; (cons "\\.cdl$" 'spice-mode)
62 ;; (cons "\\.chi$" 'spice-mode) ;eldo outpt
63 ;; (cons "\\.inp$" 'spice-mode))
64 ;; auto-mode-alist))
66 ;; Other way to load spice mode (by Andrew Scott):
67 ;; ;;; Testing for spice-mode (Another spice mode, also works on Spice,
68 ;; ;;; Eldo, Layla; this one works on GNU Emacs-20.6 issues).
69 ;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
70 ;; (add-to-list 'auto-mode-alist '("\\.cir$" . spice-mode))
71 ;; (add-to-list 'auto-mode-alist '("\\.ckt$" . spice-mode))
72 ;; (add-to-list 'auto-mode-alist '("\\.inp$" . spice-mode))
73 ;; (add-to-list 'auto-mode-alist '("\\.spout$" . spice-mode));hspice out
74 ;; (add-to-list 'auto-mode-alist '("\\.pdir$" . spice-mode))
75 ;; ;;; Intel formats
76 ;; (add-to-list 'auto-mode-alist '("\\.[sS][pP]$" . spice-mode))
77 ;; (add-to-list 'auto-mode-alist '("\\.[sm]?t0$" . spice-mode))
78 ;; (add-to-list 'auto-mode-alist '("\\.[h]?spice$" . spice-mode))
80 ;; CUSTOMIZATION:
81 ;; ==============
83 ;; use customization to modify the behaviour of spice-mode; add
84 ;; custom-set-variables to your `.emacs' file, for example:
85 ;; (custom-set-variables
86 ;; ; '(spice-initialize-file-function (quote geert-spice-file-header)) ;; use geert-spice-file-header function (not included in this file !)
87 ;; '(spice-initialize-empty-file t) ;; initialize empty/new spice file
88 ;; ; '(spice-standard '(spice2g6 (hspice eldo eldorf eldovloga layla))) ;; all 4 modes
89 ;; '(spice-standard (quote (spice2g6 (hspice eldo)))) ;; hspice and eldo
90 ;; '(spice-standard (quote (spice2g6 ()))) ;; spice2g6/3 only
91 ;; '(spice-simulator "Spice3") ;; default simulator
92 ;; '(spice-waveform-viewer "Nutmeg") ;; default waveform
93 ;; '(spice-highlight-keywords nil) ;; less highlighting
94 ;; '(spice-section-alist ;; add own sections
95 ;; ;; this is ugly, I know ;)
96 ;; (append (nth 1 (nth 0 (get 'spice-section-alist 'standard-value)))
97 ;; (list
98 ;; (list "My Header" "MY HEADER" nil)
99 ;; )))
100 ;; '(spice-show-describe-mode nil) ;; don't describe mode at startup
101 ;; )
103 ;; This can also be achieved interactively through customizations !
105 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
106 ;;; Commentary:
107 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
109 ;; The original spice-mode.el created by C. Vieri has been modified
110 ;; extensively. These changes have been heavily influenced by the eldo-mode.el
111 ;; of Emmanuel Rouat (the tempo-templates for one) and the vhdl-mode.el of
112 ;; Reto Zimmermann and Rodney J. Whitby (the font-locking, the
113 ;; customization, the menus, ...) Help in understanding 'advanced' Lisp
114 ;; was provided by G. Debyser <geert.debyser@advalvas.be>, our (Common) Lisp
115 ;; expert. Since version 0.97 a lot of input/ideas have been provided by
116 ;; Emmanuel Rouat. Just take a look and search for eldo-mode ;)
118 ;; This package provides an Emacs major mode for editing SPICE decks.
120 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121 ;;; TODO:
122 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
124 ;; - customization group spice- needs to be improved
125 ;; activate customizations needs to be looked at (potentially removed)
126 ;; - fix problem imenu sometimes truncating filenames of include files
127 ;; by replacing the functionality with own function
128 ;; - improve Y instance handling. use builtin macromodels, and own development;; models
129 ;; - ...
131 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132 ;;; BUGS:
133 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
135 ;; - searching for .subckt could be buggy because of user's file structure
136 ;; - xinstance highlighting is buggy, and probably always will ?
137 ;; - font-lock expressions are incredibly complicated, and multiple spice
138 ;; formats are not handled correctly at the same time...
140 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
142 ;; If you have any questions about this mode, feel free to contact me
143 ;; at the following address: geert_vanderplas@email.com. If I find the
144 ;; time, I can take a look at the problem
146 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
148 ;;; Code:
149 (defconst spice-version "1.2.25 (03 Jan 2007)"
150 "Current version of spice mode (spice2g6/spice3/hspice/eldo(rf&verilog-a)/fasthenry/layla/mondriaan/draccdl/spectre).")
152 (defconst spice-developer
153 "Geert Van der Plas & Emmanuel Rouat (<geert_vanderplas@email.com>, <emmanuel.rouat@wanadoo.fr>)"
154 "Current developers/maintainers of spice-mode.")
156 (defvar spice-tempo-tags nil
157 "List of templates used in spice mode.")
160 ;; help function
161 (defun spice-custom-set (variable value &rest functions)
162 "Set VARIABLE as VALUE in `custom-set-default' and call FUNCTIONS (if bound) afterwards."
163 (if (fboundp 'custom-set-default)
164 (custom-set-default variable value)
165 (set-default variable value))
166 (while functions
167 (when (fboundp (car functions)) (funcall (car functions)))
168 (setq functions (cdr functions))))
171 (defgroup spice nil
172 "Customizations for Spice mode."
173 :prefix "spice-"
174 :link '(url-link "http://spice-mode.4t.com/")
175 :group 'languages
179 ;;;###autoload
180 (defcustom spice-mode-hook nil
181 "*List of hook functions run by `spice-mode' (see `run-hooks')."
182 :type 'hook
183 :group 'spice)
186 ;;;###autoload
187 (defcustom spice-standard '(spice2g6 (hspice eldo eldorf eldovloga fasthenry))
188 "Spice standards used.
190 Basic standard:
191 Spice2g6 : Original Berkeley Spice (leave this always on!)
192 Additional standards:
193 Hspice (TM) : Commercial Spice, formerly Meta Software, now owned by Synopsys
194 Eldo (TM) : Commercial Spice, formerly Anacad, now owned by Mentor Graphics
195 EldoRf (TM) : RF Steady State analyses of Eldo (also turn on Eldo!)
196 EldoVlogA : Verilog-A extensions to Eldo netlist language (also turn on Eldo!)
197 FastHenry : Multipole-accelerated inductance analysis program from MIT
198 Layla : KULeuven LAYLA (layout synthesis) extensions to Spice format
199 Mondriaan : KULeuven MONDRIAAN (layout synthesis) extensions (also turn on Layla!)
200 DracCDL (TM): Dracula CDL extensions (Cadence LOGLVS netlists)
201 Spectre (TM): Spice compatibility of Spectre language (simulator language=spice decks)."
202 :type '(list (choice :tag "Basic standard"
203 (const :tag "Spice2g6" spice2g6))
204 (set :tag "Additional standards" :indent 2
205 (const :tag "Hspice" hspice)
206 (const :tag "Eldo" eldo)
207 (const :tag "Eldo RF" eldorf)
208 (const :tag "Eldo Verilog-A" eldovloga)
209 (const :tag "FastHenry" fasthenry)
210 (const :tag "Layla" layla)
211 (const :tag "Mondriaan" mondriaan)
212 (const :tag "DracCDL" draccdl)
213 (const :tag "Spectre Spice Compatibility" spectre)))
214 :set (lambda (variable value)
215 (spice-custom-set variable value
216 'spice-check-spice-standard
217 'spice-mode-syntax-table-init
218 'spice-keywords-init
219 'spice-font-lock-init
220 'spice-imenu-init
221 'spice-update-existing-buffers))
222 :group 'spice)
225 ;;;###autoload
226 (defcustom spice-imenu-add-to-menubar t
227 "Spice mode adds imenu (Index) item to menubar."
228 :group 'spice
229 :set (lambda (variable value)
230 (spice-custom-set variable value
231 'spice-update-existing-buffers))
232 :type 'boolean)
234 ;;;###autoload
235 (defcustom spice-show-describe-mode nil ; was t
236 "Spice mode runs `describe-mode' once at start of spice-mode."
237 :group 'spice
238 :type 'boolean)
240 ;;;###autoload
241 (defcustom spice-echo-intro t
242 "Spice mode echos introductory message on entry to spice-mode."
243 :group 'spice
244 :type 'boolean)
246 (defgroup spice-initialize-file nil
247 "Customizations for initialization of empty/new spice files."
248 :group 'spice)
250 ;;;###autoload
251 (defcustom spice-initialize-empty-file nil
252 "Spice initialize empty/new file setting."
253 :group 'spice-initialize-file
254 :type 'boolean)
256 ;;;###autoload
257 (defcustom spice-initialize-template-file "~/.spice-default"
258 "File containing the default header in new empty file.
259 See also `spice-initialize-empty-file'."
260 :group 'spice-initialize-file
261 :type 'file)
263 ;;;###autoload
264 (defcustom spice-default-header nil
265 "Default header for new Spice netlists, see also `spice-initialize-empty-file'."
266 :group 'spice-initialize-file
267 :type 'string)
269 ;;;###autoload
270 (defcustom spice-initialize-file-function 'spice-initialize-empty-file
271 "Optional initialize function for empty/new files,
273 See also `spice-initialize-empty-file'.
275 If a different function is specified it should insert a default
276 header/template in the current buffer. This function should check
277 which submode is in use with `spice-standard-p' and adapt its
278 output accordingly. It may also use the `spice-default-header'
279 variable and insert its contents into the buffer."
280 :group 'spice-initialize-file
281 :type 'function)
283 (defgroup spice-simulate nil
284 "Customizations for simulation."
285 :group 'spice)
288 (defcustom spice-simulator-alist
290 ;; Spice3; spice3 -b <file.cir>
292 ("Spice3" "spice3 -b" ""
293 ("\\s-*Error[\t ]+on[ \t]+line[\t ]+\\([0-9]+\\) +:.+"
294 0 1 nil (buffer-file-name))
295 ("Circuit: \\(.*\\)$" 1)) ; spice3 hack, is not the filename, but that's no prob
296 ;; Hspice; hspice <file.cir>
297 ;; **error**: only 1 connection at node 0:2
298 ("Hspice" "hspice" ""
299 ("\\s-*\\(..?error..?[: ]\\).+" 0 spice-linenum 1 (buffer-file-name))
300 ("[* ]* [iI]nput [fF]ile: +\\([^ \t]+\\).*$" 1))
301 ;; Eldo; eldo -i <file.cir>
302 ;; ERROR 503: MODEL "NMOS": Undeclared model reference.
303 ("Eldo" "eldo -i" ""
304 ("\\s-*\\(E[rR][rR][oO][rR] +[0-9]+:\\).*"
305 0 spice-linenum 1 (buffer-file-name))
306 ("Running \\(eldo\\).*$" 1)) ; eldo hack, true filename can not be found
307 ;; Spectre; spectre <file.cir>
308 ;; "viblok2.cir" 7: Unknown dot word `.param'.
309 ("Spectre" "spectre" ""
310 ("\\s-*\"\\([^ \t\n]+\\)\" +\\([0-9]+\\):.*"
311 1 2)
312 ("" 0)) ; filename is in regexp of error
313 ;;; Add your local simulators here:
316 "*List of available Spice simulators and their properties.
317 Each list entry specifies the following items for a simulator:
318 Simulator:
319 Simulator Name : name used in variable `spice-simulator' to choose
320 simulator
321 Simulate Command : command including options used for simulation program
322 Extra switches : extra switches for simulator, after filename
323 Error Message:
324 Regexp : regular expression to match error messages
325 File Subexp Index: index of subexpression that matches the file name
326 Line Subexp Index: index of subexpression that matches the line number.
327 use function `spice-linenum' when the line number
328 is not available
329 Col Subexp Index : index of subexpression that matches the column number
330 if not available but `spice-linenum' has been
331 supplied in the previous field, use 1
332 File Message:
333 Regexp : regular expression to match a file name message
334 File Subexp Index: index of subexpression that matches the file name
336 See also variable `spice-simulator-switches' to add options to the
337 simulate command.
339 Most simulators do not include the file name in the error message, but print
340 out a file name message in advance. In this case, set \"File Subexp Index\"
341 to 0 and fill out the \"File Message\" entries."
342 :type '(repeat (list :tag "Simulator" :indent 2
343 (string :tag "Simulator Name ")
344 (string :tag "Simulate Command ")
345 ;(string :tag "From Directory " "./")
346 (string :tag "Extra Switches ")
347 (list :tag "Error Message" :indent 4
348 (regexp :tag "Regexp ")
349 (integer :tag "File Subexp Index")
350 (integer :tag "Line Subexp Index"))
351 (list :tag "File Message" :indent 4
352 (regexp :tag "Regexp ")
353 (integer :tag "File Subexp Index"))))
354 :set (lambda (variable value)
355 (spice-custom-set variable value
356 'spice-menu-init
357 'spice-compile-variables-init
358 'spice-update-existing-buffers))
359 :group 'spice-simulate)
362 ;;;###autoload
363 (defcustom spice-simulator nil ; example: "Hspice"
364 "Spice command, used when compiling buffer with `compile-mode', see also `spice-simulator-switches'."
365 :group 'spice-simulate
366 :type 'string)
369 ;;;###autoload
370 (defcustom spice-simulator-switches "" ; example "-noconf"
371 "Spice command switches, used when compiling buffer with `compile-mode', see also `spice-simulator'."
372 :group 'spice-simulate
373 :type 'string)
376 (defcustom spice-waveform-viewer-alist
378 ;; Nutmeg; nutmeg <waveformdata.dat>
380 ("Nutmeg" "nutmeg" "" spice-run-interactive (".dat" ".ac0" ".tr0")) ; spice3 nutmeg viewer
381 ("Gwave" "gwave" "" spice-run-silent
382 (".raw" ".braw" ".ac0" ".tr0" ".sw0" ".W" ".N" ".acs")) ; gwave viewer
383 ("Xelga" "xelga" "" spice-run-silent ".cou") ; xelga eldo viewer
384 ("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...
386 ;; ("Awaves2" "echo_awaves" "" spice-run-silent nil) ; awaves hspice viewer
387 ;;; Add your local waveform viewers here:
390 "*List of available Waveform viewers and their properties.
391 Each list entry specifies the following items for a waveform viewer:
392 Waveform Viewer:
393 Wave Viewer Name : name used in variable `spice-waveform-viewer' to choose
394 a waveform viewer
395 Wave Viewer Command : command including options used for waveform viewer
396 Extra switches : extra switches for waveform viewer, after filename
398 See also variable `spice-waveform-viewer-switches' to add options to the
399 waveform viewer command."
400 :type '(repeat (list :tag "Waveform Viewer" :indent 2
401 (string :tag "Waveform Viewer Name ")
402 (string :tag "Waveform Viewing Command ")
403 (string :tag "Extra Switches ")
404 (choice :tag "How"
405 :value spice-run-silent
406 (function-item spice-run-silent)
407 (function-item spice-run-interactive)
408 (function :tag "Other"))
409 (choice (string :tag "Filename Suffix ")
410 (function :tag "Function Deriving Filename")
411 (repeat (list :tag "List of Filename Suffixes")))))
412 :set (lambda (variable value)
413 (spice-custom-set variable value
414 'spice-menu-init
415 'spice-update-existing-buffers))
416 :group 'spice-simulate)
419 ;;;###autoload
420 (defcustom spice-waveform-viewer nil ; example: "Nutmeg"
421 "Spice command, used when starting waveform viewer, see also `spice-waveform-viewer-switches'."
422 :group 'spice-simulate
423 :type 'string)
426 ;;;###autoload
427 (defcustom spice-waveform-viewer-switches "" ; example "-b"
428 "Spice waveform viewer command switches, see also `spice-waveform-viewer'."
429 :group 'spice-simulate
430 :type 'string)
433 (defgroup spice-commands nil
434 "Customizations for commands."
435 :group 'spice)
437 ;;;###autoload
438 (defcustom spice-shell
439 (if (memq system-type '(ms-dos emx windows-nt))
440 shell-file-name
441 "/bin/sh")
442 "*Name of shell used to parse spice commands."
443 :group 'spice-commands
444 :type 'file)
446 ;;;###autoload
447 (defcustom spice-shell-command-option
448 (cond ((memq system-type '(ms-dos emx windows-nt) )
449 (cond ((boundp 'shell-command-option)
450 shell-command-option)
451 ((boundp 'shell-command-switch)
452 shell-command-switch)
454 "/c")))
455 (t ;Unix & EMX (Emacs 19 port to OS/2)
456 "-c"))
457 "*Shell argument indicating that next argument is the command."
458 :group 'spice-commands
459 :type 'string)
462 (defgroup spice-hide nil
463 "Customizations for hiding of comments."
464 :group 'spice)
466 ;;;###autoload
467 (defcustom spice-hide-line-prefix
468 (if (featurep 'newcomment)
469 '(concat
470 (regexp-quote
471 (concat comment-start
472 (if (boundp 'comment-padding)
473 (if (integerp comment-padding)
474 (make-string comment-padding ? )
475 comment-padding)
476 " ")))
477 "[a-z\\*!$0-9+\\.]"))
478 "Regexp string describing lines that are commented out and will be hidden.
480 The regexp is matched to the beginning of a line, the ^ is added
481 automatically. The initialization of this variable is handled in
482 `spice-hide-init', which is after the setting of `comment-start'
483 and `comment-padding' variables."
484 :group 'spice-hide
485 :type 'string)
487 ;;;###autoload
488 (defcustom spice-auto-hide-comments nil
489 "*Boolean indicating automatic hiding of all commented regions at load time."
490 :group 'spice-hide
491 :type 'boolean)
494 (defgroup spice-section nil
495 "Customizations for sections."
496 :group 'spice)
498 ;; sections (entirely different implementation but sections idea has
499 ;; been taken from eldo-mode.el)
500 ;;;###autoload
501 (defcustom spice-section-alist
503 ;; Libraries
504 ("Libraries" "LIBRARIES" nil) ;
505 ;; Netlist
506 ("Netlist" "NETLIST" nil) ;
507 ;; Main Circuit
508 ("Main Circuit" "MAIN CIRCUIT" nil) ;
509 ;; Options
510 ("Options" "SIMULATION OPTIONS" nil) ;
511 ;; Supplies
512 ("Supplies" "SUPPLIES/REFERENCES" nil) ;
513 ;; Input Signals
514 ("Input Signals" "INPUT SIGNALS" nil) ;
515 ;; DC Analysis
516 ("DC Analysis" "DC ANALYSIS" nil) ;
517 ;; AC Analysis
518 ("AC Analysis" "AC ANALYSIS" nil) ;
519 ;; Transient Analysis
520 ("Transient Analysis" "TRANSIENT ANALYSIS" nil) ;
521 ;;; Add your site-local spice sections here:
524 "*List of valid sections in a Spice file and their options.
525 Each list entry specifies the following items for a section:
526 Section:
527 Section Name : name used in to select/create find section, make this
528 name short and descriptive.
529 Section String : string used in file to start section (usually all
530 uppercase variant of name).
531 Extra switches : extra switches for a section, unspecified for now."
532 :type '(repeat (list :tag "Section" :indent 2
533 (string :tag "Section Name ")
534 (string :tag "Section String ")
535 (sexp :tag "Extra Switches (nil)")))
536 :set (lambda (variable value)
537 (spice-custom-set variable value
538 'spice-keywords-init
539 'spice-font-lock-init
540 'spice-menu-init
541 'spice-imenu-init
542 'spice-update-existing-buffers))
543 :group 'spice-section)
546 (defgroup spice-faces nil
547 "Customizations for highlighting."
548 :group 'spice)
550 ;;;###autoload
551 (defcustom spice-highlight-keywords t
552 "*Non-nil means highlight SPICE keywords and other standardized words.
553 The following faces are used:
554 `spice-title-face' : title (first line in a spice file)
555 `spice-doc-face' : doc strings
556 `spice-analysis-face' : analyses
557 `spice-instance-name-face' : instance/element names
558 `spice-model-name-face' : subckt model names
559 `spice-layla-function-name-face': layla function names
560 `spice-include-file-face' : include files and libraries
561 `font-lock-keyword-face' : keywords
562 `font-lock-warning-face' : warnings
563 `font-lock-comment-face' : comment
564 `font-lock-function-name-face': subcircuit references / names of objects
565 `font-lock-type-face' : types
566 `font-lock-string-face' : strings & include files
567 `font-lock-constant-face' : simulator's options
568 `font-lock-variable-name-face': names of .param's & variables
569 NOTE: Activate the new setting in a spice buffer by re-fontifying it (menu
570 entry \"Fontify Buffer\")."
571 :type 'boolean
572 :group 'spice-faces)
574 ;; We try to use usual/standard font-lock faces, plus a few specific ones:
575 (custom-add-to-group
576 'spice-faces 'font-lock-comment-face 'custom-face)
577 (custom-add-to-group
578 'spice-faces 'font-lock-keyword-face 'custom-face)
579 (custom-add-to-group
580 'spice-faces 'font-lock-type-face 'custom-face)
581 (custom-add-to-group
582 'spice-faces 'font-lock-function-name-face 'custom-face)
583 (custom-add-to-group
584 'spice-faces 'font-lock-variable-name-face 'custom-face)
585 (custom-add-to-group
586 'spice-faces 'font-lock-warning-face 'custom-face)
587 (custom-add-to-group
588 'spice-faces 'font-lock-string-face 'custom-face)
591 (defgroup spice-output nil
592 "Customizations for spice output file handling."
593 :group 'spice)
595 ;;;###autoload
596 (defcustom spice-output-filename-alist
598 ;; Libraries
599 (eldo (concat (file-name-sans-extension (buffer-file-name)) ".chi")) ;
600 (hspice (concat (file-name-sans-extension (buffer-file-name)) ".lis")) ;
601 (hspice (concat (file-name-sans-extension (buffer-file-name)) ".spout")) ;
602 (hspice (concat (file-name-sans-extension (buffer-file-name)) ".hspout")) ;
603 (spice2g6 (concat (file-name-sans-extension (buffer-file-name)) ".out")) ;
605 "List of valid output names depending on selected spice standard.
607 Spice Standard : one of spice2g6, hspice, eldo or layla
608 Expression : expression calculating the output filename."
609 :type '(repeat (list :tag "Output Filenames" :indent 2
610 (symbol :tag "Spice Standard ")
611 (sexp :tag "Expression ")))
612 :group 'spice-output)
615 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
616 ;; buffer local vars for spice-mode
618 ;;(defvar spice-standard-local nil
619 ;; "buffer local version of spice-standard.")
621 (defvar spice-output-local nil
622 "Buffer local version of spice-output.")
624 (defun spice-standard-p (standard)
625 "Check if STANDARD is specified as used standard on local variable."
626 (or (eq standard (car spice-standard))
627 (memq standard (cadr spice-standard))))
630 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
631 ;; regexps for spice mode
633 (defconst spice-continuation-prefix "+"
634 "Continuation prefix for normal spice line.")
636 (defconst spice-line-break "\\(\n\\s-*\\+\\s-*\\)*"
637 "Regexp that matches a (possible) line break (\n+).")
639 (defconst spice-model-name "\\([a-z][^ \t\n=]*\\)" ; "\\([a-z]\\sw*[^ \t\n=]*\\)"
640 "Regexp that describes a syntactically correct model or subckt name.")
642 (defconst spice-library-regexp-start
643 "^\\.\\(inc\\|include\\|verilog\\|use_veriloga\\|lib\\(\\s-+key=\\w+\\)?\\|libfas\\|subckt\\s-+lib\\|model\\s-+lib\\)\\s-+[\"']?"
644 "Regexp that matches the beginning of library or include filename.")
646 (defconst spice-library-regexp-end
647 "\\([^ \t\n\"']*\\)"
648 "Regexp that matches the end of library or include filename.") ; doesn't catch end of buffer
650 (defconst spice-section-regexp-start "\\(^[*!$]\\s-*\\)"
651 "Spice mode section header start regexp.")
653 (defconst spice-spice2g6-keywords
655 "subckt"
656 "print" "plot"
657 "opt" ; opt is actually a spice3 keyword, not 2g6
658 "nodeset"
659 "model" "macro" "include" ; include is actually a spice3 keyword, not 2g6
660 "ends" "end"
662 "List of Spice2g6 keywords.")
664 (defconst spice-spice2g6-analyses
666 "tran" "op" "noise" "four" "disto" "dc" "ac"
668 "List of Spice2g6 analysis keywords.")
670 (defconst spice-spice2g6-analysis-modifiers
672 "dec" "lin" "oct" ;; the ubiquitous spice2g6 ac modifiers
673 "pol" "zer" "pz" "cur" "vol" ;; pz analysis spice3
674 "ac" ;; .sens analysis spice3
676 "List of Spice2g6 analysis modifier keywords.")
678 (defconst spice-eldo-keywords
680 "width" "use" "unprotect" "tvinclude" "topcell"
681 "table" "subdup" "solve" "sinus" "sigbus"
682 "setsoa" "setbus" "save" "restart" "ramp"
683 "protect" "probe" "plotbus"
684 "param" "overwrite_input" "optwind" "optpwl" "optnoise" "options"
685 "option" "optfour"
686 "notrc" "nocom" "modlogic"
687 "moddup" "meas" "mcmod" "lotgroup" "loop" "load"
688 "libfas" "lib" "init" "include" "ic" "hier" "guess" "global"
689 "extract" "endl" "enddata" "dspf_include" "distrib" "del"
690 "defwave" "defplotdig" "defmac" "data" "d2a" "comchar" "conso" "connect"
691 "chrsim" "chrent" "chrand" "checksoa" "checkbus" "alter" "addlib" "a2d"
693 "List of Eldo keywords.")
695 (defconst spice-eldo-colon-keywords
697 "param" "pin" "model"
699 "List of Eldo colon keywords.")
701 (defconst spice-eldo-macromodel-keywords
703 "opamp0" "opamp0d" "opamp1" "opamp1d" "opamp2" "opamp2d"
704 "satr" "satv" "vswitch" "cswitch"
705 "tri2sin" "stairgen" "sawgen" "trigen"
706 "amm" "pam"
707 "sa_ho" "tr_ho"
708 "pwm" "vco"
709 "peak_d" "lev_d"
710 "logamp" "expamp"
711 "diff" "integ"
712 "add" "sub" "mult" "div"
713 "sc_ideal" "sc_i" "sc_n" "sc_p" "sc_s1" "sc_s2"
714 "sc_sp1" "sc_sp2" "sc_b" "sc_u"
716 "List of Eldo macromodels.")
718 (defconst spice-eldo-analyses
720 "wcase" "tf" "temp"
721 "step" "snf" "sens" "pz"
722 "noisetran" "mc"
724 "List of Eldo analysis keywords.")
726 (defconst spice-eldo-analysis-modifiers
729 "List of Eldo analysis modifier keywords.")
731 (defconst spice-eldorf-keywords
733 "sst"
735 "List of Eldo RF keywords.")
737 (defconst spice-eldovloga-keywords
739 "verilog" "use_veriloga"
741 "List of Eldo Verilog-A keywords.")
743 (defconst spice-eldovloga-colon-keywords
745 "port" "generic"
747 "List of Eldo Verilog-A colon keywords.")
749 (defconst spice-eldorf-analyses
751 "sstac" "sstxf" "sstnoise"
753 "List of Eldo RF keywords.")
755 (defconst spice-hspice-keywords
757 "width" "unprot" "unprotect" "uic"
758 "title" "sys" "system" "save"
759 "sample" "prot" "protect"
760 "probe" "pc" "parameter"
761 "param" "options" "option"
762 "nomod"
763 "measure" "meas" "macro"
764 "load" "lib" "include" "inc" "ic" "graph" "global"
765 "eom" "enddata" "dellib" "delete"
766 "del" "dcvolt" "data" "control" "comment"
767 "alter"
768 "fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
770 "List of Hspice keywords.")
772 (defconst spice-hspice-analyses
774 "disto"
775 "fft"
776 "tf" "temp"
777 "net" ;; S, Z, Y and H parameters
778 "sample"
779 "sens"
780 "pz"
781 "noise"
783 "List of Hspice analysis keywords.")
785 (defconst spice-hspice-analysis-modifiers
787 "sweep" "poi"
789 "List of Hspice analysis modifier keywords.")
791 (defconst spice-fasthenry-keywords
793 "units" "default" "external" "equiv"
795 "List of FastHenry keywords.")
797 (defconst spice-fasthenry-analyses
799 "freq"
801 "List of FastHenry analysis keywords.")
803 (defconst spice-fasthenry-analysis-modifiers
806 "List of FastHenry analysis modifier keywords.")
808 (defconst spice-layla-keywords
810 "stop" "start"
811 "port" "performance" "parameter"
812 "param" "options" "option"
813 "net"
814 "model" "matching"
815 "include" "inc"
816 "bus"
818 "List of Layla keywords.")
820 (defconst spice-mondriaan-keywords
822 "master" "routingarea" "routingchannel" "ports" "portgrid" "net"
824 "List of Mondriaan keywords.")
826 (defconst spice-draccdl-keywords
828 "bipolar" "busdelimiter" "capa" "caparea" "capval" "default" "dioarea"
829 "dioperi" "diode" "edifdelimiter" "busdelimiter" "equation" "equiv"
830 "gnonswap" "ldd" "mega" "nonswap" "nopin" "nosub" "pin" "pininfo"
831 "resi" "ressize" "resval" "reverse" "scale" "spice" "unspec"
832 "eom" "global" "param" "macro" "swap"
834 "List of Dracula CDL keywords.")
836 (defconst spice-spice2g6-types
838 "ac" "dc" "exp" "pulse" "pwl" "sffm" "sin"
840 "List of types in spice2g6.")
842 (defconst spice-hspice-types
844 "metal" "dielectric" "pec" "rectangle" "circle" "strip" "polygon" ;; ""
846 "List of types in hspice.")
848 (defconst spice-eldo-types
850 "pattern"
852 "List of source types in eldo.")
854 (defconst spice-eldorf-types
856 "fpulse" "four" "probe"
858 "List of source types in eldorf.")
860 (defconst spice-fasthenry-types
862 "point" "rect" "circle"
863 "user1" "user2" "user3" "user4" "user5" "user6" "user7"
865 "List of source types in fasthenry.")
867 (defconst spice-special-model-type-names
869 "d" "npn" "pnp" "nmos" "pmos"
871 "List of model type names which are excluded for imenu.")
873 (defconst spice-spice2g6-model-type-names
875 "r" "c" "urc" "ltra"
876 "njf" "pjf"
877 "nmf" "pmf"
878 "sw" "csw"
880 "List of model type names in spice2g6.")
882 (defconst spice-eldo-model-type-names
884 "res" "cap" "ind"
885 "rn" "rp" "lpnp"
887 "List of model type names extra in eldo.")
889 (defconst spice-eldo-vloga-model-type-names
891 "macro"
893 "List of model type names extra in Eldo Verilog-A.")
895 (defconst spice-hspice-model-type-names
897 "l" "core" "w" "plot"
899 "List of model type names extra in hspice.")
901 (defconst spice-spice2g6-output-keywords
902 '("print" "plot")
903 "List of output keywords in spice2g6.")
905 (defconst spice-spice2g6-output-types
906 '("ac" "dc" "tran")
907 "List of output types in spice2g6.")
909 (defconst spice-eldo-output-keywords
910 '("extract" "meas")
911 "List of output keywords in eldo.")
913 (defconst spice-eldo-output-types
914 '("dcac" "dcsweep" "dctran" "noise" "four" "sweep")
915 "List of output types in eldo.")
917 (defconst spice-eldorf-output-types
918 '("fsst" "tsst" "sstac" "sstxf" "ssnoise" )
919 "List of output types in eldo.")
921 (defconst spice-hspice-output-keywords
922 '("probe" "graph" "measure")
923 "List of output keywords in hspice.")
925 (defconst spice-hspice-output-types
926 '("noise" "disto")
927 "List of output types in hspice.")
929 (defconst spice-spice2g6-options-keywords
930 '("trytocompact")
931 "List of spice2g6/3 options keywords.")
933 (defconst spice-eldo-options-keywords
934 '("wsf" "wsfascii" "sda"
935 "precise" "spi3asc" "spi3bin" "spicedc" "spiout" "libfas" "nolib"
936 "ammeter" "msgbias" "nowarn" "ulogic" "aspec" "mod4pins" "modwl" "wl"
937 "captab" "coustep" "input" "lcapop" "list" "noascii" "ascii"
938 "autostop" "nobound_phase" "nocou" "node" "nomod" "nopage" "nosizechk"
939 "notrc" "trap" "smooth" "be" "gear" "newton" "iem" "analog" "digital"
940 "osr" "mixed" "pstran" "dptran" "itl6" "itl7" "itl8" "nmaxsize"
941 "noconvassist" "nolat" "pivrel" "pivtol" "qtrunc" "noconvassist"
942 "nolat" "pivrel" "pivtol" "qtrunc" "relvar" "splitc" "noswitch"
943 "unbound" "randmc" "usedefap" "engnot" "nodcpart" "probeop"
944 "noprobeop" "histlim" "wbulk" "noinit" "nonoise" "tempcouk" "nofnsiem"
945 "icdc" "icdev" "carlo_gauss" "cteprec" "d2dmvl9bit" "defconvmsg"
946 "maxnodeord" "notrclib" "motorola" "aex")
947 "List of eldo options keywords.")
949 (defconst spice-eldorf-options-keywords
950 '("sst_freqdiv")
951 "List of Eldo RF options keywords.")
953 (defconst spice-hspice-options-keywords
954 '("acct" "converge"
955 "absh" "acout" "cds" "scale" "cshdc" "alt999" "alt9999" "csdf"
956 "accurate" "dvdt" "measout" "acout" "brief" "cshunt" "gshunt" "probe"
957 "kcltest" "dctran" "di" "itl5" "list" "sda" "gshunt" "cshunt" "post"
958 "node" "noelck" "gshunt" "maxamp" "nomod" "aspec" "icsweep" "relh"
959 "nopage" "newtol" "reli" "notop" "parhier" "off" "spice" "wl"
960 "dvtr" "nxx" "seed" "risetime" "imax" "nopiv" "imin" "opts" "cscal"
961 "vntol" "absv" "pathnum" "badchr" "fmax" "plim" "diagnostic" "pivref"
962 "fscal" "autostop" "nowarn" "gscal" "search" "lscal" "bypass" "verify"
963 "sparse" "pivot" "pzabs" "cpu" "pztol" "fast" "interp" "h9007" "expli"
964 "ritol" "itlpz" "itrprt" "unwrap" "captab" "newtol" "dccap")
965 "List of hspice options keywords.")
967 (defconst spice-spice2g6-options-parameters
968 '("gmin" "reltol" "abstol" "vntol" "trtol" "chgtol" "pivtol" "pivrel"
969 "tnom" "temp" "lvlcod" "itl1" "itl2" "itl3" "itl4" "itl5" "defl"
970 "defw" "defad" "defas" "method")
971 "List of spice2g6/3 options parameters.")
973 (defconst spice-eldo-options-parameters
974 '("cptime" "msgnode" "zoomtime" "bsim3ver" "defnrd" "defnrs" "defpd" "defps"
975 "gramp" "scale" "scalebsim" "scalm" "soiback" "flicker_noise"
976 "thermal_noise" "cousmp" "limprobe" "ascii" "savetime" "simudiv"
977 "stat" "timediv" "maxord" "bloc" "epsdig" "absvar" "capanw" "chgtol"
978 "dvdt" "eps" "fluxtol" "freqsmp" "ft" "hmin" "hmax" "itol" "lvltim"
979 "maxnodes" "maxtran" "maxv" "netsize" "ngtol" "ratprint" "reltrunc"
980 "sample" "startsmp" "step" "trtol" "tuning" "vmin" "vntol" "xa"
981 "numdgt" "dcpart" "couresol" "defa2d" "defd2a" "vbcsat" "dclog" "epso"
982 "optype")
983 "List of eldo options parameters.")
985 (defconst spice-eldorf-options-parameters
986 '("sst_start" "sst_stop" "sst_nper"
987 "sst_npt" "sst_ovrsmp" "sst_spectrum" "sst_uic"
988 "sst_max_liniter" "sst_verbose")
989 "List of Eldo RF options parameters.")
991 (defconst spice-hspice-options-parameters
992 '("artist" "dcap" "absh" "absvar" "absi" "absv" "delmax" "absmos"
993 "dcfor" "dchold" "fs" "mentor" "absvdc" "dcon" "ft" "co" "reltol" ; "post"
994 "cvtol" "di" "dcstep" "imin" "ingold" "imax" "lennam" "psf" "maxamp"
995 "dv" "defl" "relh" "gmax" "relvar" "measdgt" "zuken" "defnrd" "reli"
996 "gmindc" "rmax" "defnrs" "relmos" "gramp" "rmin" "defpd" "relv"
997 "slopetol" "defps" "relvdc" "timeres" "limpts" "scalm" "relq" "numdgt"
998 "resmin" "optlst" "trtol" "genk" "pivot" "sparse" "lvltim" "klim"
999 "maxord" "post_version" "bkpsiz" "mu" "xmu" "warnlimit" "expli"
1000 "bytol" "cptime" "epsmin" "mbypass" "expmax" "limtim" "vfloor")
1001 "List of hspice options parameters.")
1003 (defconst spice-layla-options-parameters
1004 '("begin_temp_iterations" "begin_acc_prob" "min_temp_scale_factor"
1005 "max_temp_scale_factor" "max_inner_loop_delta" "max_cost_delta"
1006 "min_range_scale_factor" "nr_temp_steps"
1007 "min_stable_inner_loops" "min_local_iterations" "max_local_iterations"
1008 "max_iterations" "bank_min_ar" "bank_max_ar" "bank_orientations"
1009 "bank_routing_space" "bus_sides" "bus_layer" "bus_port_width"
1010 "bus_port_height" "bus_port_distance" "bus_routing_space" "cap_min_ar"
1011 "cap_max_ar" "cap_orientations" "cap_routing_space" "cap_ar_step"
1012 "coil_orientations" "coil_routing_space" "alfa_area"
1013 "alfa_performance" "alfa_aspect_ratio" "alfa_overlap" "alfa_overlap_min"
1014 "alfa_overlap_max" "kappa_overlap" "device_min_ar" "device_max_ar"
1015 "device_orientations" "device_routing_space" "device_current"
1016 "diode_min_ar" "diode_max_ar" "diode_orientations"
1017 "diode_routing_space" "diode_current" "matching_compute_method"
1018 "dummy_min_ar" "dummy_max_ar" "dummy_orientations"
1019 "dummy_routing_space" "dummy_ar_step"
1020 "mos_min_ar" "mos_max_ar" "mos_orientations" "mos_routing_space"
1021 "mos_current" "prob_reshape" "prob_reorientation"
1022 "prob_symmetric_translation" "prob_symmetric_swap"
1023 "prob_symmetric_flip" "prob_symmetric_flip" "prob_symmetric_shift"
1024 "prob_independent_translation" "prob_independent_swap"
1025 "prob_independent_flip" "min_move_range" "net_compute_method"
1026 "write_init" "write_int" "int_write_interval" "write_fin" "write_final"
1027 "mentor_write_ipc" "gds2_write_ipc" "construct_net_performance"
1028 "construct_matching_performance" "aspect_ratio" "field_grow_factor"
1029 "field_aspect_ratio" "disable_symmetry" "disable_matching"
1030 "do_kul_routing" "kul_router_program" "kul_router_directives_file"
1031 "number_of_randomize_loops" "port_inherit_terminals" "bus_priority"
1032 "port_sides" "port_layer" "port_width" "port_height" "port_distance"
1033 "port_abutment" "port_routing_space" "port_no_routing" "port_current"
1034 "res_ar_step" "res_min_ar" "res_max_ar" "res_orientations"
1035 "res_routing_space" "res_width" "res_current" "disable_couple_flipping"
1036 "symmetry_max_offset_factor" "print_cost" "placement_name"
1037 "write_final_ample" "write_final_skill" "write_final_gds2_bin"
1038 "write_final_gds2_cells" "write_final_tud"
1039 "write_final_ample_generators" "write_final_ample_cells"
1040 "write_final_cif" "write_final_rose" "write_final_kul"
1041 "write_final_text"
1042 "write_int_ample" "write_int_skill" "write_int_gds2_bin"
1043 "write_int_gds2_cells" "write_int_tud" "write_int_ample_generators"
1044 "write_int_ample_cells" "write_int_cif" "write_int_rose"
1045 "write_int_kul" "write_int_text"
1046 "write_init_ample" "write_init_skill" "write_init_gds2_bin"
1047 "write_init_gds2_cells" "write_init_tud" "write_init_ample_generators"
1048 "write_init_ample_cells" "write_init_cif" "write_init_rose"
1049 "write_init_kul" "write_init_text" "time_out"
1050 "random_seed" "anneal_rs" )
1051 "List of LAYLA options parameters.")
1053 (defconst spice-layla-functions
1055 "bus_double_param" "bus_integer_param" "bus_string_param"
1056 "device_double_param" "device_integer_param" "device_string_param"
1057 "net_double_param" "net_integer_param" "net_string_param"
1058 "placement_double_param" "placement_integer_param" "placement_string_param"
1059 "port_double_param" "port_integer_param" "port_string_param"
1060 "symmetry_double_param" "symmetry_integer_param" "symmetry_string_param"
1062 "List of functions in Layla mode.")
1064 (defconst spice-draccdl-device-keywords
1065 '("nonswap" )
1066 "List of Dracula CDL device keywords.")
1068 (defconst spice-draccdl-device-parameters
1069 '("w" "l" "sub" "ea" ;; CDL parameters
1070 "x" "y") ;; added X&Y, dracula extracts them (not CDL!)
1071 "List of Dracula & CDL device parameters.")
1073 (defconst spice-spice2g6-entity-start-keywords
1075 "ends" "macro" "subckt"
1077 "List of spice2g6 entity start keywords.")
1079 (defconst spice-eldo-entity-start-keywords
1081 "endl"
1083 "List of eldo entity start keywords.")
1085 (defconst spice-hspice-entity-start-keywords
1087 "endl" "eom"
1088 "fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
1090 "List of hspice entity start keywords.")
1092 (defconst spice-layla-entity-start-keywords
1094 "bus" "net" "symmetry" "performance" "port"
1096 "List of layla entity start keywords.")
1098 (defconst spice-mondriaan-entity-start-keywords
1100 "routingarea" "routingchannel" ;; "net" ; already in layla
1102 "List of mondriaan entity start keywords.")
1104 (defconst spice-draccdl-entity-start-keywords
1106 "eom"
1108 "List of DracCDL entity start keywords.")
1110 (defvar spice-keywords nil
1111 "List of spice mode keywords.")
1113 (defvar spice-colon-keywords nil
1114 "List of spice mode colon keywords.")
1116 (defvar spice-analyses nil
1117 "List of spice mode analyses.")
1119 (defvar spice-analysis-modifiers nil
1120 "List of spice mode analysis modifiers.")
1122 (defvar spice-types nil
1123 "List of spice mode standardized types.")
1125 (defvar spice-functions nil
1126 "List of spice mode functions.")
1128 (defvar spice-section-headings nil
1129 "List of spice mode section headings.")
1131 (defvar spice-misc-model-type-names nil
1132 "List of miscellaneous model type name.")
1134 (defvar spice-model-type-names nil
1135 "List of all model type name.")
1137 (defvar spice-output-keywords nil
1138 "List of all output keywords.")
1140 (defvar spice-output-types nil
1141 "List of all output types.")
1143 (defvar spice-options-keywords nil
1144 "List of all output options keywords.")
1146 (defvar spice-options-parameters nil
1147 "List of all output options parameters.")
1149 (defvar spice-entity-start-keywords nil
1150 "List of entity definition keywords.")
1152 (defvar spice-keywords-regexp nil
1153 "Regexp for keywords.")
1155 (defvar spice-colon-keywords-regexp nil
1156 "Regexp for colon keywords.")
1158 (defvar spice-analyses-regexp nil
1159 "Regexp for analyses.")
1161 (defvar spice-analysis-modifiers-regexp nil
1162 "Regexp for analysis modifiers.")
1164 (defvar spice-layla-keywords-regexp nil
1165 "Regexp for layla keywords.")
1167 (defvar spice-mondriaan-keywords-regexp nil
1168 "Regexp for mondriaan keywords.")
1170 (defvar spice-draccdl-keywords-regexp nil
1171 "Regexp for dracula CDL keywords.")
1173 (defvar spice-types-regexp nil
1174 "Regexp for spice mode types.")
1176 (defvar spice-functions-regexp nil
1177 "Regexp for spice mode functions (Layla).")
1179 (defvar spice-section-headings-regexp nil
1180 "Regexp for spice mode section headings.")
1182 (defvar spice-xinstance-regexp nil
1183 "Regexp for x instances.")
1185 (defvar spice-model-name-regexp nil
1186 "Regexp model names of elements.")
1188 (defvar spice-entity-start-regexp nil
1189 "Regexp for start of entity definition.")
1191 (require 'font-lock)
1193 (defvar spice-instance-name-face 'spice-instance-name-face
1194 "Face name to use spice instances.")
1196 (defface spice-instance-name-face
1197 '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
1198 (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1199 (((class color) (background light)) (:foreground "ForestGreen" :bold t))
1200 (((class color) (background dark)) (:foreground "Yellow" :bold t))
1201 (t (:bold t)))
1202 "Spice mode face used to highlight instances."
1203 :group 'spice-faces)
1205 (defvar spice-model-name-face 'spice-model-name-face
1206 "Face name to use spice instances.")
1208 (defface spice-model-name-face
1209 '((((class grayscale) (background light)) (:foreground "LightGray"))
1210 (((class grayscale) (background dark)) (:foreground "DimGray"))
1211 (((class color) (background light)) (:foreground "Red3"))
1212 (((class color) (background dark)) (:foreground "LightSteelBlue"))
1213 (t (:bold t)))
1214 "Spice mode face used to highlight models."
1215 :group 'spice-faces)
1217 (defvar spice-title-face 'spice-title-face
1218 "Face name for title string.")
1220 (defface spice-title-face
1221 '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
1222 (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1223 (((class color) (background light))
1224 (:foreground "Yellow" :background "black" :bold t))
1225 (((class color) (background dark))
1226 (:foreground "green3":background "lightyellow" :bold t))
1227 (t (:bold t)))
1228 "Spice mode face used for title string."
1229 :group 'spice-faces)
1231 (defvar spice-layla-function-name-face 'spice-layla-function-name-face
1232 "Face name to use for layla function names.")
1234 (defface spice-layla-function-name-face
1235 '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
1236 (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
1237 (((class color) (background light))
1238 (:foreground "Darkgreen"))
1239 (((class color) (background dark)) (:foreground "green"))
1240 (t (:bold t)))
1241 "Spice mode face used to higlight layla functions."
1242 :group 'spice-faces)
1245 (defvar spice-analysis-face 'spice-analysis-face
1246 "Face name to highlight spice mode analysis commands.")
1248 (defface spice-analysis-face
1249 '((((class color) (background light)) (:foreground "Magenta" :bold t :underline t))
1250 (((class color) (background dark)) (:foreground "Lightgreen" :bold t :underline t))
1251 (t (:bold t)))
1252 "Spice mode face used to highlight analysis commands."
1253 :group 'spice-faces)
1255 (defvar spice-doc-face 'font-lock-string-face
1256 "Face name to use for doc strings.")
1258 (custom-add-to-group 'spice-faces 'font-lock-string-face 'custom-face)
1261 (defvar spice-constant-face 'font-lock-constant-face
1262 "Face name to use for constants.")
1264 (custom-add-to-group 'spice-faces 'font-lock-constant-face 'custom-face)
1266 (defvar spice-include-file-face 'font-lock-string-face
1267 "Face name to use for include files and libraries.")
1269 (custom-add-to-group 'spice-faces 'font-lock-string-face 'custom-face)
1271 (custom-add-to-group 'spice-faces 'font-lock-builtin-face 'custom-face)
1273 (defvar spice-builtin-face 'font-lock-builtin-face
1274 "Face name for builtin types.")
1276 (defun spice-keywords-init ()
1277 "Initialize reserved words."
1278 (setq spice-keywords
1279 (append spice-spice2g6-keywords
1280 (when (spice-standard-p 'hspice)
1281 spice-hspice-keywords)
1282 (when (spice-standard-p 'eldo)
1283 spice-eldo-keywords)
1284 (when (spice-standard-p 'eldorf)
1285 spice-eldorf-keywords)
1286 (when (spice-standard-p 'fasthenry)
1287 spice-fasthenry-keywords)))
1288 (setq spice-colon-keywords
1289 (append (when (spice-standard-p 'eldo)
1290 spice-eldo-colon-keywords)
1291 (when (spice-standard-p 'eldovloga)
1292 spice-eldovloga-colon-keywords)))
1293 (setq spice-analyses
1294 (append spice-spice2g6-analyses
1295 (when (spice-standard-p 'hspice)
1296 spice-hspice-analyses)
1297 (when (spice-standard-p 'eldo)
1298 spice-eldo-analyses)
1299 (when (spice-standard-p 'eldorf)
1300 spice-eldorf-analyses)
1301 (when (spice-standard-p 'fasthenry)
1302 spice-fasthenry-analyses)))
1303 (setq spice-analysis-modifiers
1304 (append spice-spice2g6-analysis-modifiers
1305 (when (spice-standard-p 'hspice)
1306 spice-hspice-analysis-modifiers)
1307 (when (spice-standard-p 'eldo)
1308 spice-eldo-analysis-modifiers)
1309 (when (spice-standard-p 'fasthenry)
1310 spice-fasthenry-analysis-modifiers)))
1311 (setq spice-misc-model-type-names
1312 (append spice-spice2g6-model-type-names
1313 (when (spice-standard-p 'hspice)
1314 spice-hspice-model-type-names)
1315 (when (spice-standard-p 'eldovloga)
1316 spice-eldo-vloga-model-type-names)
1317 (when (spice-standard-p 'eldo)
1318 spice-eldo-model-type-names)))
1319 (setq spice-output-keywords
1320 (append spice-spice2g6-output-keywords
1321 (when (spice-standard-p 'hspice)
1322 spice-hspice-output-keywords)
1323 (when (spice-standard-p 'eldo)
1324 spice-eldo-output-keywords)))
1325 (setq spice-output-types
1326 (append spice-spice2g6-output-types
1327 (when (spice-standard-p 'hspice)
1328 spice-hspice-output-types)
1329 (when (spice-standard-p 'eldo)
1330 spice-eldo-output-types)
1331 (when (spice-standard-p 'eldorf)
1332 spice-eldorf-output-types)))
1333 (setq spice-model-type-names
1334 (append spice-misc-model-type-names
1335 spice-special-model-type-names))
1336 (setq spice-types
1337 (append spice-spice2g6-types
1338 (when (spice-standard-p 'hspice)
1339 spice-hspice-types)
1340 (when (spice-standard-p 'eldo)
1341 spice-eldo-types)
1342 (when (spice-standard-p 'eldorf)
1343 spice-eldorf-types)
1344 (when (spice-standard-p 'fasthenry)
1345 spice-fasthenry-types)))
1346 (setq spice-options-keywords
1347 (append spice-spice2g6-options-keywords
1348 (when (spice-standard-p 'hspice)
1349 spice-hspice-options-keywords)
1350 (when (spice-standard-p 'eldo)
1351 spice-eldo-options-keywords)
1352 (when (spice-standard-p 'eldorf)
1353 spice-eldorf-options-keywords)))
1354 (setq spice-options-parameters
1355 (append spice-spice2g6-options-parameters
1356 (when (spice-standard-p 'hspice)
1357 spice-hspice-options-parameters)
1358 (when (spice-standard-p 'layla)
1359 spice-layla-options-parameters)
1360 (when (spice-standard-p 'eldo)
1361 spice-eldo-options-parameters)
1362 (when (spice-standard-p 'eldorf)
1363 spice-eldorf-options-parameters)))
1364 (setq spice-functions spice-layla-functions)
1365 (setq spice-section-headings (list "Changelog")) ; Changelog is special case
1366 (let ((section-alist spice-section-alist) heading)
1367 (while section-alist
1368 (setq heading (downcase (car (cdr (car section-alist)))))
1369 (setq spice-section-headings (append spice-section-headings
1370 (list heading)))
1371 (setq section-alist (cdr section-alist))))
1372 (setq spice-entity-start-keywords
1373 (append spice-spice2g6-entity-start-keywords
1374 (when (spice-standard-p 'hspice)
1375 spice-hspice-entity-start-keywords)
1376 (when (spice-standard-p 'layla)
1377 spice-layla-entity-start-keywords)
1378 (when (spice-standard-p 'mondriaan)
1379 spice-mondriaan-entity-start-keywords)
1380 (when (spice-standard-p 'draccdl)
1381 spice-draccdl-entity-start-keywords)
1382 (when (spice-standard-p 'eldo)
1383 spice-eldo-entity-start-keywords)))
1384 (setq spice-section-headings-regexp
1385 (concat spice-section-regexp-start "\\("
1386 (regexp-opt spice-section-headings) "\\)\\(.*\\)$"
1387 ; "\\s-*$" ; ??
1389 (setq spice-keywords-regexp
1390 (concat "^\\.\\("
1391 (regexp-opt spice-keywords)
1392 "\\)\\>"))
1393 (setq spice-colon-keywords-regexp
1394 (concat "\\<\\("
1395 (regexp-opt spice-colon-keywords)
1396 "\\)\\(:\\)"))
1397 (setq spice-analyses-regexp
1398 (concat "^\\s-*"
1399 "\\(\\.\\)\\("
1400 (regexp-opt spice-analyses)
1401 "\\)\\>"))
1402 (setq spice-analysis-modifiers-regexp
1403 (concat "\\<\\(" (regexp-opt spice-analysis-modifiers) "\\)\\>"))
1404 (setq spice-layla-keywords-regexp
1405 (concat "^\\s-*\\*?"
1406 "\\.\\("
1407 (regexp-opt spice-layla-keywords)
1408 "\\)\\>"))
1409 (setq spice-mondriaan-keywords-regexp
1410 (concat "^\\s-*\\*?"
1411 "\\.\\("
1412 (regexp-opt spice-mondriaan-keywords)
1413 "\\)\\>"))
1414 (setq spice-draccdl-keywords-regexp
1415 (concat "^\\s-*"
1416 "\\.\\("
1417 (regexp-opt spice-draccdl-keywords)
1418 "\\)\\>"))
1419 (setq spice-types-regexp
1420 (concat "\\<\\(" ;"\\(\\s-+\\|\n\\+\\s-*\\)\\<\\("
1421 (regexp-opt spice-types)
1422 "\\)\\>"))
1423 (setq spice-functions-regexp
1424 (concat "^\\s-*\\(\\*?\\.\\("
1425 (regexp-opt spice-functions)
1426 "\\)\\)\\>(\\([^,]+\\),\\([^,]+\\),[^,]+)"))
1427 ; old xinstance regexp
1428 ; "\\([ \t]+[^ $!(=\t\n][^ (=\t\n]*\\|\n[+]\\)*" ; $! are hspice & eldo's doc string starters
1429 (setq spice-xinstance-regexp
1430 (concat "^\\(x\\S-*\\)"
1431 "\\(\\([ \t]+[^ *"
1432 ;; "\\(\\([ \t]*[^ *" ;; should solve problem when no space between + and name, but fails horribly due to CPU hungry recursion in matcher....
1433 (when (spice-standard-p 'hspice) "$")
1434 (when (spice-standard-p 'eldo) "!")
1435 ":(=\t\n][^ :(=\t\n]*\\|[ \t]*\\(\n?[*"
1436 (when (spice-standard-p 'hspice) "$")
1437 (when (spice-standard-p 'eldo) "!")
1438 "].*\\)?\n[+]\\)*\\s-*\\)" ;; \\([a-z]\\w*\\)
1439 "\\<" spice-model-name "\\>"
1440 "\\(\\s-*\n\\|\\s-+[^=\n]\\)"
1443 (setq spice-model-name-regexp
1444 (concat "^\\([qmd]\\S-*\\)" ;; only bips, mos and diodes
1445 "\\([ \t]+[^ *" ;; first '*' was '+' ! but fails see spice-xinstance-regexp...
1446 (when (spice-standard-p 'hspice) "$")
1447 (when (spice-standard-p 'eldo) "!")
1448 "(=\t\n][^ (=\t\n]*\\|[ \t]*\\([*"
1449 (when (spice-standard-p 'hspice) "$")
1450 (when (spice-standard-p 'eldo) "!")
1451 "].*\\)?\n[+]\\)*\\s-*" ;; \\([a-z]\\w*\\)
1452 "\\<" spice-model-name "\\>"
1453 "\\(\\s-*\n\\|\\s-+[^=]\\)"
1455 (setq spice-entity-start-regexp
1456 (concat "^\\*?\\.\\("
1457 (regexp-opt spice-entity-start-keywords)
1458 "\\)")))
1461 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1462 ;; Font lock initialization
1463 (defvar spice-font-lock-keywords-0 nil
1464 ;; set in `spice-font-lock-init' because dependent on custom variables
1465 "For consideration as a value of `spice-font-lock-keywords'.
1466 This does highlighting of keywords and standard identifiers.")
1468 (defvar spice-font-lock-keywords-1 nil
1469 ;; set in `spice-font-lock-init' because dependent on custom variables
1470 "For consideration as a value of `spice-font-lock-keywords'.
1471 This does highlighting of keywords and standard identifiers.")
1473 (defvar spice-font-lock-keywords-2 nil
1474 ;; set in `spice-font-lock-init' because dependent on custom variables
1475 "For consideration as a value of `spice-font-lock-keywords'.
1476 This does highlighting of keywords and standard identifiers.")
1478 (defvar spice-font-lock-keywords-3 nil
1479 ;; set in `spice-font-lock-init' because dependent on custom variables
1480 "For consideration as a value of `spice-font-lock-keywords'.
1481 This does highlighting of keywords and standard identifiers.")
1483 (defvar spice-font-lock-keywords-4 nil
1484 ;; set in `spice-font-lock-init' because dependent on custom variables
1485 "For consideration as a value of `spice-font-lock-keywords'.
1486 This does highlighting of keywords and standard identifiers.")
1488 (defvar spice-font-lock-keywords-5 nil
1489 ;; set in `spice-font-lock-init' because dependent on custom variables
1490 "For consideration as a value of `spice-font-lock-keywords'.
1491 This does highlighting of keywords and standard identifiers.")
1493 (defvar spice-font-lock-keywords-6 nil
1494 ;; set in `spice-font-lock-init' because dependent on custom variables
1495 "For consideration as a value of `spice-font-lock-keywords'.
1496 This does highlighting of keywords and standard identifiers.")
1498 (defvar spice-font-lock-keywords-7 nil
1499 ;; set in `spice-font-lock-init' because dependent on custom variables
1500 "For consideration as a value of `spice-font-lock-keywords'.
1501 This does highlighting of keywords and standard identifiers.")
1503 (defvar spice-font-lock-keywords-8 nil
1504 ;; set in `spice-font-lock-init' because dependent on custom variables
1505 "For consideration as a value of `spice-font-lock-keywords'.
1506 This does highlighting of keywords and standard identifiers.")
1508 (defvar spice-font-lock-keywords-9 nil
1509 ;; set in `spice-font-lock-init' because dependent on custom variables
1510 "For consideration as a value of `spice-font-lock-keywords'.
1511 This does highlighting of keywords and standard identifiers.")
1513 (defvar spice-font-lock-keywords-10 nil
1514 ;; set in `spice-font-lock-init' because dependent on custom variables
1515 "For consideration as a value of `spice-font-lock-keywords'.
1516 This does highlighting of keywords and standard identifiers.")
1518 (defvar spice-font-lock-keywords-11 nil
1519 ;; set in `spice-font-lock-init' because dependent on custom variables
1520 "For consideration as a value of `spice-font-lock-keywords'.
1521 This does highlighting of keywords and standard identifiers.")
1523 (defvar spice-font-lock-keywords-12 nil
1524 ;; set in `spice-font-lock-init' because dependent on custom variables
1525 "For consideration as a value of `spice-font-lock-keywords'.
1526 This does highlighting of keywords and standard identifiers.")
1528 (defvar spice-font-lock-keywords-13 nil
1529 ;; set in `spice-font-lock-init' because dependent on custom variables
1530 "For consideration as a value of `spice-font-lock-keywords'.
1531 This does highlighting of keywords and standard identifiers.")
1534 ;; fast variable name matcher in parameter=value constructs
1535 (defun spice-match-variable-name (limit)
1536 "Match variable names with LIMIT."
1537 (let (pos found (start (point)))
1538 (setq found nil)
1539 (setq pos (search-forward "=" limit 'end)) ;
1540 (while (and pos
1541 (not found))
1542 (forward-word -1)
1543 (if (< (point) start) (goto-char pos))
1544 (if (looking-at "\\([a-z]\\w*\\)\\s-*\\(=\\)")
1545 (progn
1546 (goto-char pos)
1547 ;; (message (match-string 1))
1548 (setq found t))
1549 (progn
1550 (goto-char pos)
1551 (setq pos (search-forward "=" limit 'end)))))
1552 found))
1554 ;; font-lock aux functions
1555 (defun spice-match-eldo-colon-keywords (limit)
1556 "Match with LIMIT ((param|pin|model|port|generic):)."
1557 ;; latter two are eldo verilog-A
1558 (let (pos found (start (point)))
1559 (setq found nil)
1560 (setq pos (search-forward ":" limit 'end)) ;
1561 (while pos
1562 (forward-word -1)
1563 (if (< (point) start) (goto-char pos))
1564 ;; (message "pos is %d" pos)
1565 (if (looking-at ;; "\\(\\(param\\|pin\\|model\\|port\\|generic\\):\\)")
1566 spice-colon-keywords-regexp)
1567 (progn
1568 (goto-char pos)
1569 (setq pos nil)
1570 (setq found t))
1571 (progn
1572 (goto-char pos)
1573 (setq pos (search-forward ":" limit 'end)))))
1574 found))
1576 ;; these are try outs to solve the font-locking of problematic xinstances:
1578 (defun spice-match-xinstances-dummy (limit)
1579 "Match xinstances with LIMIT."
1580 (let (min max pt)
1581 (setq pt (point))
1582 (goto-char (point-min))
1583 (setq min (point))
1584 (goto-char (point-max))
1585 (setq max (point))
1586 (with-current-buffer (get-buffer-create "*Matcher*")
1587 (goto-char (point-max))
1588 (insert (format "Point min is %s\n" min))
1589 (insert (format "Current point is %s\n" pt))
1590 (insert (format "Limit is %s\n" limit))
1591 (insert (format "Point max is %s\n" max))))
1592 nil)
1594 (defun spice-idle-font-lock (beg end)
1595 "Run font-lock on a region between BEG and END."
1596 (message "rerunning font-lock on %s:%s=%s" beg end (buffer-substring beg end))
1597 (save-excursion (font-lock-fontify-region beg end)))
1599 (defvar spice-previous-xinstance-match-result nil)
1600 (make-variable-buffer-local 'spice-previous-xinstance-match-result)
1602 (defun spice-match-in-xinstance (limit)
1603 "Check if in xinstance with LIMIT."
1604 (let ((pt (point)))
1605 (if (or (looking-at "^\\s-*[xX]")
1606 (re-search-backward "^[xX]" (point-min) t))
1607 (if (and (looking-at spice-xinstance-regexp)
1608 (or (> (match-end 5) pt)
1609 (not spice-previous-xinstance-match-result))
1611 (progn
1612 (message ".")
1613 (goto-char (match-end 5))
1614 (if (or (> pt (match-beginning 1))
1615 (< limit (match-end 5)))
1616 (progn
1617 (message "*")
1618 ;;(spice-idle-font-lock (match-beginning 1) (match-end 5))
1619 (run-with-idle-timer 1 nil 'spice-idle-font-lock
1620 (match-beginning 1) (match-end 5))
1622 ;; (if (> (match-end 5) limit)
1623 ;; (run-with-idle-timer 1 nil 'spice-idle-font-lock
1624 ;; (match-beginning 1) (match-end 5)))
1626 (goto-char pt)
1627 nil)
1628 nil)
1631 (defun spice-match-next-xinstance (limit)
1632 "Check if there is a next xinstance partly within LIMIT."
1633 (if (re-search-forward "^[xX]" limit 'end)
1634 (progn
1635 (backward-char 1)
1636 (if (looking-at spice-xinstance-regexp)
1637 (progn
1638 (message "+")
1639 (goto-char (match-end 5))
1641 (message "-")
1642 (forward-char 1)
1643 (spice-match-next-xinstance limit))
1645 nil))
1647 (defun spice-match-xinstance (limit)
1648 "Match xinstances with LIMIT."
1649 (if (spice-match-in-xinstance limit)
1651 (spice-match-next-xinstance limit)))
1653 (defun spice-match-xinstances-old (limit)
1654 "Match an xinstance with LIMIT."
1655 (setq spice-previous-xinstance-match-result (spice-match-xinstance limit))
1656 spice-previous-xinstance-match-result)
1658 ;; this xinstances matcher is a complete parser !
1660 (defun spice-match-xinstances (limit)
1661 "Match xinstance with LIMIT subckt name, this one parses the lines.
1663 Should work for all cases, infinite number of comment lines,
1664 continuation lines. Could fail when modifying an xinstance line
1665 though, hard to tell."
1666 (interactive)
1667 (let ((result nil) match-start)
1668 (while
1669 (and (not result)
1670 (re-search-forward "^\\(x\\S-*\\)" limit 'end)) ;; should be checked ?
1671 (setq match-start (match-data))
1672 ;;(message "match-start is %s" match-start)
1673 (while
1675 (and (looking-at "\\([ \t]+\\|\\s-*\n[+]\\s-*\\)\\(\\([a-z][^ :(=\t\n]*\\)\\|\\([^ *$!:(=\t\n][^ :(=\t\n]*\\)\\)\\(\\s-*\n\\|\\s-+[^=\n]\\)")
1676 (progn
1677 (goto-char (match-end 2))
1678 (setq result t)))
1679 (save-match-data
1680 (and
1681 (looking-at "\\(\\([ \t]+\\|\\s-*\n\\s-*\\)[$!*].*\\)")
1682 (progn
1683 (goto-char (match-end 1))
1684 t))))
1685 nil))
1686 (when result (set-match-data
1687 (append (list (car match-start) (car (cdr (match-data))))
1688 (cdr (cdr match-start)) (cdr (cdr (match-data))))))
1689 ;;(when result (message "Matched %s[%d]" (match-string 3) (match-end 3)))
1690 (when result (when (< limit (match-end 3)) (setq result nil)))
1691 result))
1693 (defvar spice-font-lock-keywords nil
1694 "Regular expressions to highlight in spice mode.")
1696 (defun spice-font-lock-init ()
1697 "Initialize fontification."
1698 ;; makes spice-font-lock-keywords valid
1699 ;; highlight title & titles after .alter & .title (hspice only)
1700 (setq spice-font-lock-keywords-0
1701 (append (list ;; first line of spice deck
1702 (list "\\`.+$" 0 spice-title-face)
1703 (list spice-section-headings-regexp
1704 '(1 font-lock-comment-face)
1705 '(2 spice-title-face)
1706 (list (regexp-opt-depth spice-section-headings-regexp)
1707 spice-doc-face 'keep t)))
1708 ;; hspice title in .alter or .title line
1709 (when (spice-standard-p 'hspice)
1710 (list
1711 (list "^\\.\\(alter\\|title\\)\\s-+\\(.+\\)$"
1712 2 spice-title-face)))))
1713 ;; highlight layla functions: .xx_yy_param(name,prop,val);
1714 (setq spice-font-lock-keywords-1
1715 (list
1716 (list spice-functions-regexp
1717 '(1 spice-layla-function-name-face)
1718 (list (- (regexp-opt-depth spice-functions-regexp) 1)
1719 font-lock-function-name-face)
1720 (list (regexp-opt-depth spice-functions-regexp)
1721 font-lock-variable-name-face)
1723 ;; highlight spice keywords (mainly .<keyword> & .<analysis>)
1724 (setq spice-font-lock-keywords-2
1725 (list ;; .opt, .nodeset, ...
1726 (list spice-keywords-regexp 0 font-lock-keyword-face)
1727 ;; '+' of continuation lines ? maybe over the top ...
1728 ;; (list (concat "^"
1729 ;; (when (spice-standard-p 'layla) "\\*?")
1730 ;; "\\+") 0 font-lock-keyword-face)
1731 ;; .op, .ac, .dc, .tran, ...
1732 (list spice-analyses-regexp
1733 '(1 font-lock-keyword-face)
1734 '(2 spice-analysis-face)
1735 (list spice-analysis-modifiers-regexp
1736 nil nil '(0 font-lock-type-face)))))
1738 (setq spice-font-lock-keywords-12
1739 ;; do dracula CDL stuff
1740 (list
1741 ;; add $ docs when they are followed by a space...
1742 (list (concat "\\<\\([$]\\)\\s-+\\(.*\\)$")
1743 (list 1 font-lock-comment-face)
1744 (list 2 spice-doc-face 'keep))
1745 ;; special models on element line
1746 (list (concat "\\([$]\\(?:ldd\\)?\\[\\)" spice-model-name "\\(\\]\\)")
1747 '(1 font-lock-keyword-face)
1748 '(2 spice-model-name-face)
1749 '(3 font-lock-keyword-face))
1750 ;; normal .model on element line
1751 (list (concat "\\([$]\\.model\\)\\s-*=\\s-*" spice-model-name)
1752 '(1 font-lock-keyword-face)
1753 '(2 spice-model-name-face))
1754 ;; element options behind $ syntax
1755 (list (concat "\\([$]\\)\\(" (regexp-opt spice-draccdl-device-keywords) "\\)")
1756 '(1 font-lock-keyword-face)
1757 '(2 font-lock-keyword-face))
1758 ;; element parameters behind $ syntax
1759 (list (concat "\\([$]\\)\\(" (regexp-opt spice-draccdl-device-parameters) "\\)\\s-*=")
1760 '(1 font-lock-keyword-face)
1761 '(2 font-lock-variable-name-face))
1762 ;; general '.' keywords
1763 (list spice-draccdl-keywords-regexp 0 font-lock-keyword-face)))
1765 ;; highlight layla specific keywords, also if *. syntax is used
1766 (setq spice-font-lock-keywords-3
1767 (append (list
1768 (list spice-layla-keywords-regexp 0 font-lock-keyword-face)
1769 (list "^\\(\\*\\)\\+" 1 font-lock-keyword-face))
1770 (when (spice-standard-p 'mondriaan)
1771 (list
1772 (list spice-mondriaan-keywords-regexp 0 font-lock-keyword-face)))))
1774 (setq spice-font-lock-keywords-13
1775 ;; do spectre stuff
1776 (list
1777 ;; * spectre: + syntax
1778 (list "^\\(\\*\\)\\s-+spectre:\\s-+" 1 font-lock-keyword-face)
1779 ;; // comments
1780 (list "//.*$" 0 font-lock-comment-face)
1781 ;; add simulator language=spice
1782 (list "^\\s-*\\(simulator\\)\\>"
1783 '(1 font-lock-keyword-face))))
1785 ;; varia: .end, spice instances and '*' comment lines and output lines
1786 (setq spice-font-lock-keywords-4
1787 (list
1788 ;; elements
1789 ;;'("^[a-z]\\S-*" . spice-instance-name-face)
1790 '("^[a-z][^ \t\n]+" . spice-instance-name-face)
1791 ;(list (concat "^\\*\\([^"
1792 ; (when (spice-standard-p 'layla) "+")
1793 ; "\n].*\\|\n\\)") 0 font-lock-comment-face)
1794 (list (concat "^\\*[^\n"
1795 (when (or (spice-standard-p 'hspice)
1796 (spice-standard-p 'draccdl)
1797 (spice-standard-p 'layla)) "$")
1798 (when (spice-standard-p 'eldo) "!")
1799 "]*") 0 font-lock-comment-face)
1800 (list (concat "^\\.\\(" (regexp-opt spice-output-keywords)
1801 "\\)\\s-*" spice-line-break "\\s-+\\("
1802 (regexp-opt spice-output-types) "\\)\\>")
1803 '(0 font-lock-type-face keep)) ;
1805 ;; highlight additional . unknowns (to detect stupid typing errors)
1806 (setq spice-font-lock-keywords-5
1807 (list '("^\\s-*\\.[^ \t\n]*" 0 font-lock-warning-face)))
1809 ;; highlight additional $ and ! comments, only eldo, hspice, draccdl and layla
1810 (setq spice-font-lock-keywords-6
1811 (list
1812 (list (concat "\\<\\(["
1813 (when (or (spice-standard-p 'hspice)
1814 (spice-standard-p 'draccdl)
1815 (spice-standard-p 'layla)) "$")
1816 (when (spice-standard-p 'eldo) "!")
1817 "]\\)\\(.*\\)$")
1818 (list 1 font-lock-comment-face)
1819 (list 2 spice-doc-face 'append) ;; needs at least 'append or 'keep
1821 (list (concat "\\<\\([*"
1822 (when (or (spice-standard-p 'hspice)
1823 (spice-standard-p 'draccdl)
1824 (spice-standard-p 'layla)) "$")
1825 (when (spice-standard-p 'eldo) "!")
1826 "]\\)")
1827 ;; elisp mode like quotes, for extra clarity
1828 (list "['\"]\\([^'\"]+\\)['\"]" nil nil
1829 (list 1 spice-constant-face 'prepend)))))
1831 ;; subcircuit instance names of x instances and model names of mos,bip&diode
1832 (setq spice-font-lock-keywords-7
1833 (list
1834 (list spice-xinstance-regexp 5 spice-model-name-face)
1835 ;; test xinstance function matcher
1836 ;;(list 'spice-match-xinstances
1837 ;; '(4 spice-model-name-face keep t)
1838 ;; '(5 font-lock-warning-face keep t))
1839 (list spice-model-name-regexp 4 spice-model-name-face)
1842 ;; highlight poly's of inductors and caps
1843 (setq spice-font-lock-keywords-8
1844 (list
1845 '("^[cl]\\w*\\s-+\\w[^ \t\n]*\\s-+\\w[^ \t\n]*\\s-+\\(poly\\)"
1846 1 font-lock-type-face)))
1848 ;; types, included files, libs and names of subcircuits, ports, libs, models
1849 (setq spice-font-lock-keywords-9
1850 (append
1851 ;; names and types of models/subckt, lib concept of eldo...
1852 (when (spice-standard-p 'eldo)
1853 (list
1854 (list (concat "^\\s-*\\.\\(model\\|subckt\\|macro\\)\\s-+"
1855 "\\(\\(lib\\)\\s-+[^ \t\n]+\\s-+\\)"
1856 spice-model-name)
1857 '(3 font-lock-keyword-face)
1858 '(4 font-lock-function-name-face))))
1859 (list
1860 ;; types
1861 (list "^[+vi.]" '(0 'default) ;; find v & i's and continuation and . lines
1862 (list spice-types-regexp nil nil '(1 font-lock-type-face)))
1863 ;; libs, inc's, ...
1864 (list (concat spice-library-regexp-start
1865 spice-library-regexp-end) 3 spice-include-file-face)
1866 ;; names of (defined) entities
1867 (list
1868 (concat spice-entity-start-regexp
1869 "\\(\\s-+\\([a-z]\\w*\\)\\s-*"
1870 "\\|\\s-*[\n][+]\\s-*\\([a-z]\\w*\\)\\s-*\\)")
1871 (1+ (regexp-opt-depth spice-entity-start-regexp))
1872 font-lock-function-name-face)
1873 ;; names and types of models
1874 (list (concat "^\\s-*\\.model\\s-+"
1875 spice-model-name
1876 spice-line-break "\\s-+\\("
1877 (regexp-opt spice-model-type-names) "\\)\\>")
1878 '(1 font-lock-function-name-face)
1879 '(3 font-lock-type-face))
1882 ;; highlight additional eldo reserved words
1883 (setq spice-font-lock-keywords-10
1884 (list
1885 ;; eldo's labels
1886 (list "\\<\\(label\\)\\s-*=\\s-*\\([^\"]\\w*\\)\\>"
1887 '(1 font-lock-type-face)
1888 '(2 font-lock-variable-name-face))
1889 ;; eldo's labels(2)
1890 (list "\\<\\(label\\)\\s-*=\\s-*\"\\([^\"]+\\)\""
1891 '(1 font-lock-type-face)
1892 '(2 font-lock-variable-name-face))
1893 ;; eldo's param,model&pin:
1894 ;;'("\\<\\(\\(param\\|pin\\|model\\):\\)" 0 font-lock-keyword-face)
1895 (list 'spice-match-eldo-colon-keywords
1896 (list 1 font-lock-keyword-face)
1897 '(2 'default))
1898 ;; eldo's builtin macro models
1899 (list (concat "^y\\w+\\s-+\\<\\("
1900 (regexp-opt spice-eldo-macromodel-keywords) "\\)\\>")
1901 '(1 spice-builtin-face))
1902 ;; eldo's y instances, type is second word on line
1903 (list (concat "^y\\w+\\s-+\\<" spice-model-name "\\>")
1904 1 spice-model-name-face)))
1905 ;; highlight property names property=value & strings (way at the end)
1906 (setq spice-font-lock-keywords-11
1907 (list
1908 ;; this is 1 second faster when loading 28 files, appx 10000 lines
1909 ;; .options keywords & parameters
1910 (list (concat "^\\s-*" ;; was "^"
1911 (when (spice-standard-p 'layla) "\\*?")
1912 "\\.opt\\(ion"
1913 (when (or (spice-standard-p 'hspice)
1914 (spice-standard-p 'layla))
1915 "\\(s\\)?")
1916 "\\)?\\s-+")
1917 '(0 font-lock-keyword-face) ;; not used, already colored
1918 (list (concat "\\<\\(\\("
1919 (regexp-opt spice-options-keywords)
1920 "\\)\\>\\|\\("
1921 (regexp-opt spice-options-parameters)
1922 "\\)\\s-*=\\)") nil nil
1923 (list 1 spice-constant-face)))
1924 ;; param=value
1925 ;; '("\\<\\([a-z]\\w*\\)\\s-*=" 1 font-lock-variable-name-face)
1926 ;; this function matcher is much faster, it searches for '=' and then
1927 ;; returns the word in front of the '=', doesn't work in xemacs though
1928 ;;(if (string-match "XEmacs" emacs-version)
1929 ;; (list "\\<\\([a-z]\\w*\\)\\s-*=" 1 font-lock-variable-name-face)
1930 (list 'spice-match-variable-name
1931 (list 1 font-lock-variable-name-face 'append)
1932 ;;(list 1 font-lock-variable-name-face)
1933 '(2 'default 'append)) ;; default is required for XEmacs
1934 ;; 'append is required for Xemacs 21.4.11 on Windows. Otherwise
1935 ;; the matcher overrules the previous highlighting (for instance when
1936 ;; this 'var=value' is after a doc starter...
1937 ;; )
1939 ;; changelog entries
1940 (list
1941 (concat
1942 "^[*"
1943 (when (or (spice-standard-p 'hspice)
1944 (spice-standard-p 'layla)) "$")
1945 (when (spice-standard-p 'eldo) "!")
1946 "]+\\s-+\\([A-Z].*[0-9]\\)\\s-+\\([a-zA-Z].*\\)<\\(.*@.*\\)>$")
1947 '(1 font-lock-string-face t)
1948 '(2 font-lock-type-face t)
1949 '(3 font-lock-variable-name-face t))
1951 ;; strings
1952 '("\"[^\"]*\"" 0 font-lock-string-face)
1954 ;; scale factors and powers or is this overkill ?
1955 (list (concat
1956 "\\<[-+]?[0-9.]+\\(\\("
1957 (regexp-opt '("T" "G" "Meg" "K" "mil" "m" "u" "M" "n" "p" "f"))
1958 "\\)[a-zA-Z]*\\)\\>")
1959 (list 2 spice-constant-face 'append))
1960 (list (concat
1961 "[0-9.]\\(e\\)[-+]?[0-9]+\\>")
1962 (list 1 spice-constant-face 'append))
1964 ;; set font-lock-keywords, all of 'em
1965 (setq spice-font-lock-keywords
1966 (append spice-font-lock-keywords-0 ;; title first
1967 (when (spice-standard-p 'layla)
1968 spice-font-lock-keywords-1)
1969 (when spice-highlight-keywords
1970 spice-font-lock-keywords-2)
1971 (when (and
1972 spice-highlight-keywords
1973 (spice-standard-p 'layla))
1974 spice-font-lock-keywords-3)
1975 (when (spice-standard-p 'spectre)
1976 spice-font-lock-keywords-13)
1977 (when (spice-standard-p 'draccdl)
1978 spice-font-lock-keywords-12)
1979 spice-font-lock-keywords-4
1980 (when spice-highlight-keywords
1981 spice-font-lock-keywords-5)
1982 (when (or (spice-standard-p 'layla)
1983 (spice-standard-p 'hspice)
1984 (spice-standard-p 'draccdl)
1985 (spice-standard-p 'eldo))
1986 spice-font-lock-keywords-6)
1987 spice-font-lock-keywords-7
1988 (when spice-highlight-keywords
1989 spice-font-lock-keywords-8)
1990 spice-font-lock-keywords-9
1991 (when (spice-standard-p 'eldo)
1992 spice-font-lock-keywords-10)
1993 (when spice-highlight-keywords
1994 spice-font-lock-keywords-11)
1998 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1999 ;;; Comments (taken from eldo-mode.el)
2000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2002 ;; uncomment function, should work for any case now:
2003 (defun spice-uncomment-region (beg end)
2004 "Uncomment selected region - comment symbol is '*'.
2005 Doc comments (starting with '!') are unaffected."
2006 (interactive "*r")
2007 (comment-region beg end '(2))) ; 2 is arbitrary, can be any value
2010 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2011 ;;; spice mode map
2012 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2014 ;; (require 'tempo) ; ? is this necessary
2016 (defvar spice-mode-map ()
2017 "Keymap used in spice-mode.")
2019 (if spice-mode-map
2021 (let ((map (make-sparse-keymap)))
2023 ;; key binding for template completion
2024 (define-key map "\t" 'tempo-complete-tag)
2025 ;; (define-key map "\S-\t" 'indent-for-tab-command)
2026 (define-key map [(shift tab)] 'indent-for-tab-command)
2027 (define-key map [(shift iso-lefttab)] 'indent-for-tab-command)
2029 ;; key bindings for compile
2030 (define-key map "\C-c\C-r" 'spice-compile) ;; r for run
2031 (define-key map "\C-c\C-k" 'kill-compilation)
2033 ;; replace global binding
2034 (define-key map "\C-x`" 'spice-next-error)
2036 ;; key bindings for waveform viewer
2037 (define-key map "\C-c\C-v" 'spice-run-waveform-viewer)
2039 ;; key bindings for output file loading
2040 (define-key map "\C-c\C-o" 'spice-load-output-file)
2042 ;; key bindings for include file loading
2043 (define-key map "\C-c\C-l" 'spice-load-include-files)
2045 ;; comment region, use auctex-mode bindings...
2046 (define-key map "\C-c\C-c" 'comment-region)
2047 ;;(define-key map "\C-c:" 'spice-uncomment-region) ;; \C-u\C-c\C-c
2049 ;; .subckt search
2050 (define-key map "\C-c\C-s" 'spice-search-subckt)
2052 ;; join lines
2053 (define-key map "\M-^" 'spice-delete-indentation)
2055 ;; key bindings for hiding/unhidding comments
2056 (define-key map "\C-c;" 'spice-hide-all-comments)
2057 (define-key map "\C-c:" 'spice-unhide-all-comments)
2059 ;; changelog addition
2060 (define-key map "\C-c\C-ac" 'spice-add-changelog-entry)
2062 (setq spice-mode-map map)))
2065 (defvar spice-output-mode-map ()
2066 "Keymap used in Spice-output mode.")
2068 (if spice-output-mode-map
2070 (let ((map (make-sparse-keymap)))
2071 ;; nothing for now ...
2073 (setq spice-output-mode-map map)))
2076 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2077 ;;; libraries & include files (taken & adapted from eldo-mode.el, E. Rouat)
2078 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2080 ;;------------------------------------------------------------
2081 ;; Mouse bindings (only used by 'spice-load-file-at-mouse')
2082 ;; I separate this from spice-mode-map so that this particular
2083 ;; mouse binding doesn't interfere with other bindings
2085 (defvar spice-mode-mouse-map nil
2086 "Map containing mouse bindings for spice-mode.")
2088 (if spice-mode-mouse-map
2090 (let ((map (make-sparse-keymap)))
2091 (set-keymap-parent map spice-mode-map)
2092 ;; mouse button bindings
2093 ;;(define-key map "\r" 'ffap)
2094 (define-key map "\r" 'spice-load-file-at-point)
2095 (define-key map [mouse-2] 'spice-load-file-at-mouse)
2096 (define-key map [S-mouse-2] 'mouse-yank-at-click)
2097 (setq spice-mode-mouse-map map)))
2100 ;; overlays and extents are a mess. Depending on emacs/xemacs versions the
2101 ;; following code might actually work. What is known now is that this
2102 ;; works in: emacs 20.7, 21.1 and 21.2 (Linux versions have been tested),
2103 ;; xemacs 21.1 (Windows) and xemacs 21.5 (Linux). You need
2104 ;; fsf-compat package for xemacs 21.4.5 (Linux). Anyone still following this ?
2107 (defun spice-colorize-libraries (beg end old-len)
2108 "Colorize libraries and included files when the mouse passes over them.
2110 Clicking on the middle-mouse button loads them in a buffer.
2111 BEWARE, this feature was hard to implement, and
2112 contains (non-fatal) bugs, primarily because Emacs 20 does not
2113 have the same support for this as XEmacs has."
2114 (save-excursion
2115 (save-match-data
2116 (let (end-point)
2117 (goto-char end)
2118 (end-of-line)
2119 (setq end-point (point))
2120 (goto-char beg)
2121 (beginning-of-line) ; scan entire line !
2122 ;; delete overlays existing on this line
2123 (let ((overlays (overlays-in (point) end-point)))
2124 (while overlays
2125 (if (and (overlay-get (car overlays) 'detachable)
2126 (overlay-get (car overlays) 'spice-library))
2127 (delete-overlay (car overlays))
2129 (setq overlays (cdr overlays)))) ; let
2130 ; make new ones, could reuse deleted one ?
2131 (while (search-forward-regexp spice-library-regexp-start end-point t)
2132 (let (start-lib extent)
2133 (setq start-lib (point))
2134 (search-forward-regexp spice-library-regexp-end end-point) ; (let ((end-lib (point)))
2135 ))))))
2138 (defun spice-colorize-libraries-buffer ()
2139 "Colorize spice libraries in buffer."
2140 (interactive)
2141 ;; (message "running colorize libraries buffer")
2142 ;; delete overlays
2143 (let ((overlays (overlays-in (point-min) (point-max))))
2144 (while overlays
2145 (if (and
2146 (overlay-get (car overlays) 'detachable)
2147 (overlay-get (car overlays) 'spice-library))
2148 (delete-overlay (car overlays)))
2149 (setq overlays (cdr overlays)))) ; let
2150 ;; remake overlays
2151 (spice-colorize-libraries (point-min) (point-max) nil))
2154 ;; ffap needs wrapper to detect end of buffer condition
2155 (defun spice-load-file-at-point ()
2156 "Wrapper for ffap. But if at end of buffer inserts a newline instead."
2157 (interactive)
2158 (if (looking-at "\\'")
2159 (newline) ;; assumes \r is bound to load file...
2160 (ffap)))
2163 ;; ffap-at-mouse isn't available in xemacs < 21
2164 ;; so define this function to do more or less the same (primarily
2165 ;; wraps ffap-at-mouse, except for xemacs 20)...
2166 (defun spice-load-file-at-mouse (event)
2167 "Loads file under button 2 click EVENT. Checks if file is readable."
2168 (interactive "@e")
2169 (if (fboundp 'ffap-at-mouse)
2170 (ffap-at-mouse event) ;; use ffap-at-mouse if available
2171 (save-excursion ;; implement a spice specific ffap-at-mouse
2172 (mouse-set-point event)
2173 (beginning-of-line)
2174 (if (looking-at (concat spice-library-regexp-start
2175 spice-library-regexp-end))
2176 (if (file-readable-p (substitute-in-file-name (match-string 3)))
2177 (find-file (substitute-in-file-name (match-string 3)))
2178 (progn
2179 (message "File '%s' isn't readable, use shift-mouse2 to paste in this field" (match-string 3))))
2180 ))))
2183 ;;------------------------------------------------------------
2184 ;; Changelog and sections support (taken from eldo-mode, trying
2185 ;; to be compatible :)
2186 ;;------------------------------------------------------------
2188 (defun spice-doc-char ()
2189 "Return doc char that's valid in the selected spice submode."
2190 (cond
2191 ((and (spice-standard-p 'eldo)
2192 (spice-standard-p 'hspice))
2193 "*") ; if both eldo and hspice is turned on
2194 ((spice-standard-p 'eldo)
2195 "!") ; only eldo
2196 ((spice-standard-p 'hspice)
2197 "$") ; only hspice
2199 "*"))) ; everything else
2202 (defun spice-find-changelog-point ()
2203 "Find adequate position to place Changelog entries.
2204 Just before .end or if not found at end of buffer."
2205 (save-excursion
2206 (goto-char (point-min))
2207 (let ((pos (re-search-forward
2208 "^\\.end\\b" nil t)))
2209 (if pos (progn (forward-line 1)
2210 (point))
2211 (point-max)))))
2214 (defun spice-add-changelog-entry (changelog-entry)
2215 "Find changelog section (create it if not found) and add an entry for today."
2216 (interactive "sChangelog entry: ")
2217 (goto-char (point-min))
2218 (if (not (re-search-forward
2219 (concat spice-section-regexp-start "Changelog") nil t))
2220 (spice-add-section "Changelog" (spice-find-changelog-point)))
2222 (spice-goto-section "Changelog")
2223 ; (forward-line 2)
2224 (let ((string (concat (spice-doc-char)
2225 (if (equal (spice-doc-char) "*") "* " " ")
2226 (substring (current-time-string) 0 11)
2227 (substring (current-time-string) -4) " "
2228 (user-full-name) " <" user-mail-address ">")))
2229 (if (not (search-forward string nil t))
2230 (insert "\n" string "\n\n")
2231 (forward-line 2))
2232 (insert (spice-doc-char)
2233 (if (equal (spice-doc-char) "*") "*" "")
2234 " - " changelog-entry "\n")))
2237 (defun spice-goto-section (section)
2238 "Move point to the beginning of the specified section; If the section is not found, leave point at previous location."
2239 (interactive "ssection: ")
2240 (let ((pos (point)))
2241 (goto-char (point-min))
2242 (if (not (re-search-forward
2243 (concat spice-section-regexp-start section "\\b") nil t))
2244 (progn (message "Couldn't find section %s" section)
2245 (goto-char pos))
2246 (progn
2247 (forward-line 2)
2248 (recenter))))) ;; added recenter
2251 (defun spice-comment-bar (&optional aligned)
2252 "Insert solid comment bar from column zero to end of line.
2253 If optional argument is provided, bar will be added from current
2254 column."
2255 (interactive)
2256 (if (not aligned) (beginning-of-line) )
2257 (insert "*")
2258 (insert-char ?- (- (1- fill-column) (current-column)))
2259 (insert "\n"))
2262 (defun spice-add-section (section &optional arg)
2263 "Add a SECTION in buffer at (optional) point ARG."
2264 (interactive "ssection: ")
2265 (if arg
2266 (goto-char arg))
2267 (spice-comment-bar)
2268 (insert
2269 (concat (spice-doc-char) "\t" section " \n"))
2270 (spice-comment-bar)
2271 ;; (unless (assoc section spice-section-alist)
2272 ;; ;; new entry
2273 ;; (custom-set-variables
2274 ;; (quote (spice-section-alist
2275 ;; (append spice-section-alist
2276 ;; (list (list section (upcase section) nil))))))
2277 ;; )
2281 (defvar spice-cache-section-alist nil)
2283 (defun spice-cache-section-p (section)
2284 "Check for all sections in file and remembers if they were present or not."
2285 (save-excursion
2286 (setq spice-cache-section-alist nil)
2287 (goto-char (point-min))
2288 (while (re-search-forward spice-section-headings-regexp nil t)
2289 (setq spice-cache-section-alist
2290 (cons (cons (downcase (match-string-no-properties 2)) t)
2291 spice-cache-section-alist)))
2292 (spice-section-p section)))
2295 (defun spice-section-p (section)
2296 "Check if named section is in file.
2298 Returns t if found, nil otherwise, uses cache generated with the
2299 `spice-cache-section-p' function."
2300 (assoc section spice-cache-section-alist))
2303 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2304 ;;; Templates (extensive, long code...)
2305 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2307 (require 'tempo)
2309 ;;; element templates
2311 ;; resistors
2312 (tempo-define-template
2313 "spice-spice2g6-resistor"
2314 '("R"
2315 (p "[name]: ") '(just-one-space)
2316 (p "[pos node]: ") '(just-one-space)
2317 (p "[neg node]: ") '(just-one-space)
2318 (p "[val]: "))
2319 ;; "spice2g6 resistor"
2321 "tempo template for spice2g6 resistor"
2322 'spice-tempo-tags)
2325 (tempo-define-template
2326 "spice-spice3-semiconductor-resistor"
2327 '("R"
2328 (p "[name]: ") '(just-one-space)
2329 (p "[pos node]: ") '(just-one-space)
2330 (p "[neg node]: ") '(just-one-space)
2331 (p "<value>: " value) '(just-one-space)
2332 (p "<mname>: " mname) '(just-one-space)
2333 (p "<length>: " l 'noinsert)
2334 (if (string-equal (tempo-lookup-named 'l) "")
2335 () (list 'l "L=" '(s l)))
2336 '(just-one-space)
2337 (p "<width>: " w 'noinsert)
2338 (if (string-equal (tempo-lookup-named 'w) "")
2339 () (list 'l "W=" '(s w)))
2340 '(just-one-space)
2341 (p "<temp>: " temp 'noinsert)
2342 (if (string-equal (tempo-lookup-named 'temp) "")
2343 () (list 'l "TEMP=" '(s temp)))
2344 '(just-one-space)
2346 ;; "spice3 semiconductor resistor"
2347 "RSS"
2348 "tempo template for spice3 semiconductor resistor"
2349 'spice-tempo-tags)
2352 (tempo-define-template
2353 "spice-eldo-resistor"
2354 '("R"
2355 (p "[name]: ") '(just-one-space)
2356 (p "[pos node]: ") '(just-one-space)
2357 (p "[neg node]: ") '(just-one-space)
2358 (p "<mname>: " mname) '(just-one-space)
2359 (if (string-equal (tempo-lookup-named 'mname) "")
2360 (list 'l "r=" '(p "[val]: "))
2361 (list 'l '(p "[val]: "))) '(just-one-space)
2362 (p "<temp coef 1>: " tc1 'noinsert)
2363 (if (string-equal (tempo-lookup-named 'tc1) "") ()
2364 (list 'l "TC1=" '(s tc1) '(p "<temp coef 2>: " tc2 'noinsert)))
2365 '(just-one-space)
2366 (if (and (tempo-lookup-named 'tc2)
2367 (not (string-equal (tempo-lookup-named 'tc2) "")))
2368 (list 'l "TC2=" '(s tc2)))
2369 '(just-one-space)
2370 (p "<ac resistance>: " ac 'noinsert)
2371 (if (string-equal (tempo-lookup-named 'ac) "")
2372 () (list 'l "AC=" '(s ac)))
2373 '(just-one-space)
2374 (p "<temp>: " temp 'noinsert)
2375 (if (string-equal (tempo-lookup-named 'temp) "")
2376 () (list 'l "T=" '(s temp)))
2377 '(just-one-space)
2378 (p "<m>: " m 'noinsert)
2379 (if (string-equal (tempo-lookup-named 'm) "")
2380 () (list 'l "M=" '(s m)))
2381 '(just-one-space)
2382 (p "<nonoise in transient [y/n]?>: " nonoise 'noinsert)
2383 (if (string-equal (tempo-lookup-named 'nonoise) "y")
2384 (list 'l "NONOISE"))
2385 '(just-one-space)
2386 (p "<kf>: " kf 'noinsert)
2387 (if (string-equal (tempo-lookup-named 'kf) "")
2388 () (list 'l '(s kf) '(p "<af>: " af 'noinsert)))
2389 '(just-one-space)
2390 (if (and (tempo-lookup-named 'af)
2391 (not (string-equal (tempo-lookup-named 'af) "")))
2392 (list 'l '(s af)))
2393 '(just-one-space)
2395 ;; "eldo resistor"
2396 "RE"
2397 "tempo template for eldo resistor"
2398 'spice-tempo-tags)
2401 (tempo-define-template
2402 "spice-eldo-expression-resistor"
2403 '("R"
2404 (p "[name]: ") '(just-one-space)
2405 (p "[pos node]: ") '(just-one-space)
2406 (p "[neg node]: ") '(just-one-space)
2407 (p "[VALUE | TABLE]: " type 'noinsert) '(just-one-space)
2408 (if (string-equal (tempo-lookup-named 'type) "VALUE")
2409 (list 'l "VALUE={" '(p "[val, enter expression without {}]: ") "}")
2410 (list 'l "TABLE={" '(p "[table of values, enter table without {}]: ") "}"))
2411 '(just-one-space)
2412 (if (string-equal (tempo-lookup-named 'type) "VALUE")
2413 (list 'l '(p "<nonoise in transient [y/n]?>: " nonoise 'noinsert)))
2414 (if (and (tempo-lookup-named 'nonoise)
2415 (string-equal (tempo-lookup-named 'nonoise) "y"))
2416 (list 'l "NONOISE"))
2417 '(just-one-space)
2418 (p "<kf>: " kf 'noinsert)
2419 (if (string-equal (tempo-lookup-named 'kf) "")
2420 () (list 'l '(s kf) '(p "<af>: " af 'noinsert)))
2421 '(just-one-space)
2422 (if (and (tempo-lookup-named 'af)
2423 (not (string-equal (tempo-lookup-named 'af) "")))
2424 (list 'l '(s af)))
2426 ;; "eldo expression resistor"
2427 "REE"
2428 "tempo template for eldo expression resistor"
2429 'spice-tempo-tags)
2432 (tempo-define-template
2433 "spice-eldo-semiconductor-resistor"
2434 '("P"
2435 (p "[name]: ") '(just-one-space)
2436 (p "[pos node]: ") '(just-one-space)
2437 (p "[neg node]: ") '(just-one-space)
2438 (p "[mname]: " mname) '(just-one-space)
2439 (p "<res>: " r 'noinsert)
2440 (if (string-equal (tempo-lookup-named 'r) "")
2441 () (list 'l "R=" '(s r)))
2442 '(just-one-space)
2443 (p "<length>: " l 'noinsert)
2444 (if (string-equal (tempo-lookup-named 'l) "")
2445 () (list 'l "L=" '(s l)))
2446 '(just-one-space)
2447 (p "<contact offset length>: " cl 'noinsert)
2448 (if (string-equal (tempo-lookup-named 'cl) "")
2449 () (list 'l "CL=" '(s cl)))
2450 '(just-one-space)
2451 (p "<width>: " w 'noinsert)
2452 (if (string-equal (tempo-lookup-named 'w) "")
2453 () (list 'l "W=" '(s w)))
2454 '(just-one-space)
2455 (p "<contact offset width>: " cw 'noinsert)
2456 (if (string-equal (tempo-lookup-named 'cw) "")
2457 () (list 'l "CW=" '(s cw)))
2458 '(just-one-space)
2459 (p "<area>: " area 'noinsert)
2460 (if (string-equal (tempo-lookup-named 'area) "")
2461 () (list 'l "AREA=" '(s area)))
2462 '(just-one-space)
2463 (p "<init cond (voltage, voltage)>: " ic 'noinsert)
2464 (if (string-equal (tempo-lookup-named 'ic) "")
2465 () (list 'l "IC=" '(s ic)))
2466 '(just-one-space)
2468 ;; "eldo semiconductor resistor"
2469 "RES"
2470 "tempo template for eldo semiconductor resistor"
2471 'spice-tempo-tags)
2474 (tempo-define-template
2475 "spice-hspice-resistor"
2476 '("R"
2477 (p "[name]: ") '(just-one-space)
2478 (p "[pos node]: ") '(just-one-space)
2479 (p "[neg node]: ") '(just-one-space)
2480 (p "<mname>: " mname) '(just-one-space)
2481 (if (string-equal (tempo-lookup-named 'mname) "")
2482 (list 'l "R=" '(p "[val]: "))
2483 (list 'l '(p "<val>: " val 'noinsert)
2484 '(if (not (string-equal (tempo-lookup-named 'val) ""))
2485 (list 'l "R=" '(s val))))) '(just-one-space)
2486 (p "<temp coef 1>: " tc1 'noinsert)
2487 (if (string-equal (tempo-lookup-named 'tc1) "") ()
2488 (list 'l "TC1=" '(s tc1) '(p "<temp coef 2>: " tc2 'noinsert)))
2489 '(just-one-space)
2490 (if (and (tempo-lookup-named 'tc2)
2491 (not (string-equal (tempo-lookup-named 'tc2) "")))
2492 (list 'l "TC2=" '(s tc2)))
2493 '(just-one-space)
2494 (p "<scale>: " scale 'noinsert)
2495 (if (string-equal (tempo-lookup-named 'scale) "")
2496 () (list 'l "SCALE=" '(s scale)))
2497 '(just-one-space)
2498 (p "<m>: " m 'noinsert)
2499 (if (string-equal (tempo-lookup-named 'm) "")
2500 () (list 'l "M=" '(s m)))
2501 '(just-one-space)
2502 (p "<ac resistance>: " ac 'noinsert)
2503 (if (string-equal (tempo-lookup-named 'ac) "")
2504 () (list 'l "AC=" '(s ac)))
2505 '(just-one-space)
2506 (p "<diff temp>: " dtemp 'noinsert)
2507 (if (string-equal (tempo-lookup-named 'dtemp) "")
2508 () (list 'l "DTEMP=" '(s dtemp)))
2509 '(just-one-space)
2510 (p "<length>: " l 'noinsert)
2511 (if (string-equal (tempo-lookup-named 'l) "")
2512 () (list 'l "L=" '(s l)))
2513 '(just-one-space)
2514 (p "<width>: " w 'noinsert)
2515 (if (string-equal (tempo-lookup-named 'w) "")
2516 () (list 'l "W=" '(s w)))
2517 '(just-one-space)
2518 (p "<cap>: " c 'noinsert)
2519 (if (string-equal (tempo-lookup-named 'c) "")
2520 () (list 'l "C=" '(s c)))
2521 '(just-one-space)
2523 ;; "hspice resistor"
2524 "RH"
2525 "template for hspice resistor tempo templates"
2526 'spice-tempo-tags)
2529 (tempo-define-template
2530 "spice-layla-resistor"
2531 '("R"
2532 (p "[name]: ") '(just-one-space)
2533 (p "[pos node]: ") '(just-one-space)
2534 (p "[neg node]: ") '(just-one-space)
2535 ; (p "<mname>: ") '(just-one-space)
2536 (p "[value]: ") '(just-one-space)
2537 (p "<width>: " w 'noinsert)
2538 (if (string-equal (tempo-lookup-named 'w) "")
2539 () (list 'l "width=" '(s w)))
2540 '(just-one-space)
2541 "\n+ type=\""
2542 (p "[type (no quotes)]: ") "\""
2543 '(just-one-space)
2544 (p "<symmetry (no quotes)>: " symmetry 'noinsert)
2545 (if (string-equal (tempo-lookup-named 'symmetry) "")
2546 () (list 'l "symmetry=\"" '(s symmetry) "\""))
2547 '(just-one-space)
2548 (p "<matching (no quotes)>: " matching 'noinsert)
2549 (if (string-equal (tempo-lookup-named 'matching) "")
2550 () (list 'l "matching=\"" '(s matching) "\""))
2551 '(just-one-space)
2552 (p "<couple>: " couple 'noinsert)
2553 (if (string-equal (tempo-lookup-named 'couple) "")
2554 () (list 'l "couple=" '(s couple)))
2555 '(just-one-space)
2556 (p "<array (no quotes)>: " array 'noinsert)
2557 (if (string-equal (tempo-lookup-named 'array) "")
2558 () (list 'l "array=\"" '(s array) "\""))
2559 '(just-one-space)
2560 (p "<orientations (no quotes)>: " orientations 'noinsert)
2561 (if (string-equal (tempo-lookup-named 'orientations) "")
2562 () (list 'l "orientations=\"" '(s orientations) "\""))
2563 '(just-one-space)
2564 (p "<unit_value>: " unit_value 'noinsert)
2565 (if (string-equal (tempo-lookup-named 'unit_value) "")
2566 () (list 'l "unit_value=" '(s unit_value)))
2567 '(just-one-space)
2568 (p "<current>: " current 'noinsert)
2569 (if (string-equal (tempo-lookup-named 'current) "")
2570 () (list 'l "current=" '(s current)))
2571 '(just-one-space)
2572 (p "<power>: " power 'noinsert)
2573 (if (string-equal (tempo-lookup-named 'power) "")
2574 () (list 'l "power=" '(s power)))
2575 '(just-one-space)
2576 (p "<min_ar>: " min_ar 'noinsert)
2577 (if (string-equal (tempo-lookup-named 'min_ar) "")
2578 () (list 'l "min_ar=" '(s min_ar)))
2579 '(just-one-space)
2580 (p "<max_ar>: " max_ar 'noinsert)
2581 (if (string-equal (tempo-lookup-named 'max_ar) "")
2582 () (list 'l "max_ar=" '(s max_ar)))
2583 '(just-one-space)
2584 (p "<routing_space>: " routing_space 'noinsert)
2585 (if (string-equal (tempo-lookup-named 'routing_space) "")
2586 () (list 'l "routing_space=" '(s routing_space)))
2587 '(just-one-space)
2589 ;; "layla resistor"
2590 "RL"
2591 "tempo template for layla resistor"
2592 'spice-tempo-tags)
2595 ;; capacitors
2596 (tempo-define-template
2597 "spice-spice2g6-capacitor"
2598 '("C"
2599 (p "[name]: ") '(just-one-space)
2600 (p "[pos node]: ") '(just-one-space)
2601 (p "[neg node]: ") '(just-one-space)
2602 (p "[val]: ") '(just-one-space)
2603 (p "<initial cond (voltage)>: " ic 'noinsert)
2604 (if (string-equal (tempo-lookup-named 'ic) "")
2605 () (list 'l "ic=" '(s ic)))
2607 ;; "spice2g6 capacitor"
2609 "tempo template for spice2g6 capacitor"
2610 'spice-tempo-tags)
2613 (tempo-define-template
2614 "spice-spice3-semiconductor-capacitor"
2615 '("C"
2616 (p "[name]: ") '(just-one-space)
2617 (p "[pos node]: ") '(just-one-space)
2618 (p "[neg node]: ") '(just-one-space)
2619 (p "<value>: " value) '(just-one-space)
2620 (p "<mname>: " mname) '(just-one-space)
2621 (p "<length>: " l 'noinsert)
2622 (if (string-equal (tempo-lookup-named 'l) "")
2623 () (list 'l "L=" '(s l)))
2624 '(just-one-space)
2625 (p "<width>: " w 'noinsert)
2626 (if (string-equal (tempo-lookup-named 'w) "")
2627 () (list 'l "W=" '(s w)))
2628 '(just-one-space)
2629 (p "<initial conditions (Voltage)>: " ic 'noinsert)
2630 (if (string-equal (tempo-lookup-named 'ic) "")
2631 () (list 'l "IC=" '(s ic)))
2632 '(just-one-space)
2634 ;; "spice3 semiconductor capacitor"
2635 "CSS"
2636 "tempo template for spice3 semiconductor capacitor"
2637 'spice-tempo-tags)
2640 (tempo-define-template
2641 "spice-eldo-capacitor"
2642 '("C"
2643 (p "[name]: ") '(just-one-space)
2644 (p "[pos node]: ") '(just-one-space)
2645 (p "[neg node]: ") '(just-one-space)
2646 (p "<mname | POLY>: " mname) '(just-one-space)
2647 (if (string-equal (tempo-lookup-named 'mname) "POLY")
2648 (list 'l '(p "[val and poly coefficients]: "))
2649 (list 'l '(p "[val]: ")))
2650 '(just-one-space)
2651 (p "<m>: " m 'noinsert)
2652 (if (string-equal (tempo-lookup-named 'm) "")
2653 () (list 'l "M=" '(s m)))
2654 '(just-one-space)
2655 (p "<length>: " l 'noinsert)
2656 (if (string-equal (tempo-lookup-named 'l) "")
2657 () (list 'l "L=" '(s l)))
2658 '(just-one-space)
2659 (p "<width>: " w 'noinsert)
2660 (if (string-equal (tempo-lookup-named 'w) "")
2661 () (list 'l "W=" '(s w)))
2662 '(just-one-space)
2663 (p "<diff temp>: " dtemp 'noinsert)
2664 (if (string-equal (tempo-lookup-named 'dtemp) "")
2665 () (list 'l "DTEMP=" '(s dtemp)))
2666 '(just-one-space)
2667 (p "<temp coef 1>: " tc1 'noinsert)
2668 (if (string-equal (tempo-lookup-named 'tc1) "") ()
2669 (list 'l "TC1=" '(s tc1) '(p "<temp coef 2>: " tc2 'noinsert)))
2670 '(just-one-space)
2671 (if (and (tempo-lookup-named 'tc2)
2672 (not (string-equal (tempo-lookup-named 'tc2) "")))
2673 (list 'l "TC2=" '(s tc2)))
2674 '(just-one-space)
2675 (p "<initial cond (voltage)>: " ic 'noinsert)
2676 (if (string-equal (tempo-lookup-named 'ic) "")
2677 () (list 'l "IC=" '(s ic)))
2679 ;; "eldo capacitor"
2680 "CE"
2681 "tempo template for eldo capacitor"
2682 'spice-tempo-tags)
2685 (tempo-define-template
2686 "spice-eldo-expression-capacitor"
2687 '("C"
2688 (p "[name]: ") '(just-one-space)
2689 (p "[pos node]: ") '(just-one-space)
2690 (p "[neg node]: ") '(just-one-space)
2691 (p "<temp coef 1>: " tc1 'noinsert)
2692 (if (string-equal (tempo-lookup-named 'tc1) "") ()
2693 (list 'l "TC1=" '(s tc1)))
2694 '(just-one-space)
2695 (p "<temp coef 2>: " tc2 'noinsert)
2696 (if (string-equal (tempo-lookup-named 'tc2) "") ()
2697 (list 'l "TC2=" '(s tc2)))
2698 '(just-one-space)
2699 (p "<temp coef 3>: " tc3 'noinsert)
2700 (if (string-equal (tempo-lookup-named 'tc3) "") ()
2701 (list 'l "TC3=" '(s tc3)))
2702 '(just-one-space)
2703 "VALUE={"
2704 (p "[val enter expression without {}]: ")
2707 ;; "eldo expression capacitor"
2708 "CEE"
2709 "tempo template for eldo expression capacitor"
2710 'spice-tempo-tags)
2713 (tempo-define-template
2714 "spice-hspice-capacitor"
2715 '("C"
2716 (p "[name]: ") '(just-one-space)
2717 (p "[pos node]: ") '(just-one-space)
2718 (p "[neg node]: ") '(just-one-space)
2719 (p "<mname | POLY>: " mname) '(just-one-space)
2720 (if (string-equal (tempo-lookup-named 'mname) "POLY")
2721 (list 'l '(p "[val and poly coefficients]: " val))
2722 (if (string-equal (tempo-lookup-named 'mname) "")
2723 (list 'l "C=" '(p "[val or expression]: " val))
2724 (list 'l "C=" '(p "[val]: " val))))
2725 '(just-one-space)
2726 (if (and (not (string-equal (tempo-lookup-named 'mname) "POLY"))
2727 (char-equal (string-to-char (tempo-lookup-named 'val))
2728 (string-to-char "'")))
2729 (list 'l '(p "<ctype>: " ctype 'noinsert)))
2730 (if (and (tempo-lookup-named 'ctype)
2731 (not (string-equal (tempo-lookup-named 'ctype) "")))
2732 (list 'l "CTYPE=" '(s ctype)))
2733 '(just-one-space)
2734 (p "<temp coef 1>: " tc1 'noinsert)
2735 (if (string-equal (tempo-lookup-named 'tc1) "") ()
2736 (list 'l "TC1=" '(s tc1) '(p "<temp coef 2>: " tc2 'noinsert)))
2737 '(just-one-space)
2738 (if (and (tempo-lookup-named 'tc2)
2739 (not (string-equal (tempo-lookup-named 'tc2) "")))
2740 (list 'l "TC2=" '(s tc2)))
2741 '(just-one-space)
2742 (p "<scale>: " scale 'noinsert)
2743 (if (string-equal (tempo-lookup-named 'scale) "")
2744 () (list 'l "SCALE=" '(s scale)))
2745 '(just-one-space)
2746 (p "<initial cond (voltage)>: " ic 'noinsert)
2747 (if (string-equal (tempo-lookup-named 'ic) "")
2748 () (list 'l "IC=" '(s ic)))
2749 '(just-one-space)
2750 (p "<m>: " m 'noinsert)
2751 (if (string-equal (tempo-lookup-named 'm) "")
2752 () (list 'l "M=" '(s m)))
2753 '(just-one-space)
2754 (p "<width>: " w 'noinsert)
2755 (if (string-equal (tempo-lookup-named 'w) "")
2756 () (list 'l "W=" '(s w)))
2757 '(just-one-space)
2758 (p "<length>: " l 'noinsert)
2759 (if (string-equal (tempo-lookup-named 'l) "")
2760 () (list 'l "L=" '(s l)))
2761 '(just-one-space)
2762 (p "<diff temp>: " dtemp 'noinsert)
2763 (if (string-equal (tempo-lookup-named 'dtemp) "")
2764 () (list 'l "DTEMP=" '(s dtemp)))
2765 '(just-one-space)
2767 ;; "hspice capacitor"
2768 "CH"
2769 "tempo template for hspice capacitor"
2770 'spice-tempo-tags)
2773 (tempo-define-template
2774 "spice-layla-capacitor"
2775 '("C"
2776 (p "[name]: ") '(just-one-space)
2777 (p "[pos node]: ") '(just-one-space)
2778 (p "[neg node]: ") '(just-one-space)
2779 (p "[value]: ") '(just-one-space)
2780 (p "<units_ver>: " units_ver 'noinsert)
2781 (if (string-equal (tempo-lookup-named 'units_ver) "")
2782 () (list 'l "units_ver=" '(s units_ver)))
2783 '(just-one-space)
2784 (p "<units_hor>: " units_hor 'noinsert)
2785 (if (string-equal (tempo-lookup-named 'units_hor) "")
2786 () (list 'l "units_hor=" '(s units_hor)))
2787 '(just-one-space)
2788 "\n+ type=\""
2789 (p "[type (no quotes)]: ") "\""
2790 '(just-one-space)
2791 (p "<symmetry (no quotes)>: " symmetry 'noinsert)
2792 (if (string-equal (tempo-lookup-named 'symmetry) "")
2793 () (list 'l "symmetry=\"" '(s symmetry) "\""))
2794 '(just-one-space)
2795 (p "<matching (no quotes)>: " matching 'noinsert)
2796 (if (string-equal (tempo-lookup-named 'matching) "")
2797 () (list 'l "matching=\"" '(s matching) "\""))
2798 '(just-one-space)
2799 (p "<couple>: " couple 'noinsert)
2800 (if (string-equal (tempo-lookup-named 'couple) "")
2801 () (list 'l "couple=" '(s couple)))
2802 '(just-one-space)
2803 (p "<array (no quotes)>: " array 'noinsert)
2804 (if (string-equal (tempo-lookup-named 'array) "")
2805 () (list 'l "array=\"" '(s array) "\""))
2806 '(just-one-space)
2807 (p "<orientations (no quotes)>: " orientations 'noinsert)
2808 (if (string-equal (tempo-lookup-named 'orientations) "")
2809 () (list 'l "orientations=\"" '(s orientations) "\""))
2810 '(just-one-space)
2811 (p "<unit_value>: " unit_value 'noinsert)
2812 (if (string-equal (tempo-lookup-named 'unit_value) "")
2813 () (list 'l "unit_value=" '(s unit_value)))
2814 '(just-one-space)
2815 (p "<power>: " power 'noinsert)
2816 (if (string-equal (tempo-lookup-named 'power) "")
2817 () (list 'l "power=" '(s power)))
2818 '(just-one-space)
2819 (p "<min_ar>: " min_ar 'noinsert)
2820 (if (string-equal (tempo-lookup-named 'min_ar) "")
2821 () (list 'l "min_ar=" '(s min_ar)))
2822 '(just-one-space)
2823 (p "<max_ar>: " max_ar 'noinsert)
2824 (if (string-equal (tempo-lookup-named 'max_ar) "")
2825 () (list 'l "max_ar=" '(s max_ar)))
2826 '(just-one-space)
2827 (p "<routing_space>: " routing_space 'noinsert)
2828 (if (string-equal (tempo-lookup-named 'routing_space) "")
2829 () (list 'l "routing_space=" '(s routing_space)))
2830 '(just-one-space)
2832 ;; "layla capacitor"
2833 "CL"
2834 "tempo template for layla capacitor"
2835 'spice-tempo-tags)
2838 ;; inductors
2839 (tempo-define-template
2840 "spice-spice2g6-inductor"
2841 '("L"
2842 (p "[name]: ") '(just-one-space)
2843 (p "[pos node]: ") '(just-one-space)
2844 (p "[neg node]: ") '(just-one-space)
2845 (p "[val]: ") '(just-one-space)
2846 (p "<initial cond (current)>: " ic 'noinsert)
2847 (if (string-equal (tempo-lookup-named 'ic) "")
2848 () (list 'l "ic=" '(s ic)))
2850 ;; "spice2g6 inductor"
2852 "tempo template for spice2g6 inductor"
2853 'spice-tempo-tags)
2856 (tempo-define-template
2857 "spice-eldo-inductor"
2858 '("L"
2859 (p "[name]: ") '(just-one-space)
2860 (p "[pos node]: ") '(just-one-space)
2861 (p "[neg node]: ") '(just-one-space)
2862 (p "<mname | POLY>: " mname) '(just-one-space)
2863 (if (string-equal (tempo-lookup-named 'mname) "POLY")
2864 (list 'l '(p "[val and poly coefficients]: "))
2865 (list 'l '(p "[val]: ")))
2866 '(just-one-space)
2867 (p "<initial cond (current)>: " ic 'noinsert)
2868 (if (string-equal (tempo-lookup-named 'ic) "")
2869 () (list 'l "ic=" '(s ic)))
2871 ;; "eldo inductor"
2872 "LE"
2873 "tempo template for eldo inductor"
2874 'spice-tempo-tags)
2877 (tempo-define-template
2878 "spice-eldo-expression-inductor"
2879 '("L"
2880 (p "[name]: ") '(just-one-space)
2881 (p "[pos node]: ") '(just-one-space)
2882 (p "[neg node]: ") '(just-one-space)
2883 "VALUE={"
2884 (p "[val enter expression without {}]: ")
2887 ;; "eldo expression inductor"
2888 "LEE"
2889 "tempo template for eldo expression inductor"
2890 'spice-tempo-tags)
2893 (tempo-define-template
2894 "spice-hspice-inductor"
2895 '("L"
2896 (p "[name]: ") '(just-one-space)
2897 (p "[pos node]: ") '(just-one-space)
2898 (p "[neg node]: ") '(just-one-space)
2899 (p "<POLY | NT>: " poly 'noinsert) '(just-one-space)
2900 (cond ((string-equal (tempo-lookup-named 'poly) "POLY")
2901 (list 'l "POLY " '(p "[value and coefficients]: ")))
2902 ((string-equal (tempo-lookup-named 'poly) "NT")
2903 (list 'l "NT=" '(p "[number of turns]: " nt)))
2905 (list 'l "L=" '(p "[value or expression]: " val)))
2907 '(just-one-space)
2908 (if (and (tempo-lookup-named 'val)
2909 (char-equal (string-to-char (tempo-lookup-named 'val))
2910 (string-to-char "'")))
2911 (list 'l '(p "<ltype>: " ltype 'noinsert)))
2912 (if (and (tempo-lookup-named 'ltype)
2913 (not (string-equal (tempo-lookup-named 'ltype) "")))
2914 (list 'l "LTYPE=" '(s ltype)))
2915 '(just-one-space)
2916 (p "<temp coef 1>: " tc1 'noinsert)
2917 (if (string-equal (tempo-lookup-named 'tc1) "") ()
2918 (list 'l "TC1=" '(s tc1) '(p "<temp coef 2>: " tc2 'noinsert)))
2919 '(just-one-space)
2920 (if (and (tempo-lookup-named 'tc2)
2921 (not (string-equal (tempo-lookup-named 'tc2) "")))
2922 (list 'l "TC2=" '(s tc2)))
2923 '(just-one-space)
2924 (p "<scale>: " scale 'noinsert)
2925 (if (string-equal (tempo-lookup-named 'scale) "")
2926 () (list 'l "SCALE=" '(s scale)))
2927 '(just-one-space)
2928 (p "<initial cond (current)>: " ic 'noinsert)
2929 (if (string-equal (tempo-lookup-named 'ic) "")
2930 () (list 'l "IC=" '(s ic)))
2931 '(just-one-space)
2932 (p "<m>: " m 'noinsert)
2933 (if (string-equal (tempo-lookup-named 'm) "")
2934 () (list 'l "M=" '(s m)))
2935 '(just-one-space)
2936 (p "<diff temp>: " dtemp 'noinsert)
2937 (if (string-equal (tempo-lookup-named 'dtemp) "")
2938 () (list 'l "DTEMP=" '(s dtemp)))
2939 '(just-one-space)
2940 (p "<res>: " r 'noinsert)
2941 (if (string-equal (tempo-lookup-named 'r) "")
2942 () (list 'l "R=" '(s r)))
2943 '(just-one-space)
2945 ;; "hspice inductor"
2946 "LH"
2947 "tempo template for hspice inductor"
2948 'spice-tempo-tags)
2951 (tempo-define-template
2952 "spice-layla-inductor"
2953 '("L"
2954 (p "[name]: ") '(just-one-space)
2955 (p "[pos node]: ") '(just-one-space)
2956 (p "[neg node]: ") '(just-one-space)
2957 (p "<value>: ") '(just-one-space)
2958 (p "<outer radius>: " radius 'noinsert)
2959 (if (string-equal (tempo-lookup-named 'radius) "")
2960 () (list 'l "radius=" '(s radius)))
2961 '(just-one-space)
2962 (p "<width>: " w 'noinsert)
2963 (if (string-equal (tempo-lookup-named 'w) "")
2964 () (list 'l "w=" '(s w)))
2965 '(just-one-space)
2966 (p "<number of turns>: " n 'noinsert)
2967 (if (string-equal (tempo-lookup-named 'n) "")
2968 () (list 'l "n=" '(s n)))
2969 '(just-one-space)
2970 (p "<space>: " space 'noinsert)
2971 (if (string-equal (tempo-lookup-named 'space) "")
2972 () (list 'l "space=" '(s space)))
2973 '(just-one-space)
2974 (p "<end_fraction [0-1]>: " end_fraction 'noinsert)
2975 (if (string-equal (tempo-lookup-named 'end_fraction) "")
2976 () (list 'l "end_fraction=" '(s end_fraction)))
2977 '(just-one-space)
2978 "\n+ type=\""
2979 (p "[type (no quotes)]: ") "\""
2980 '(just-one-space)
2981 (p "<symmetry (no quotes)>: " symmetry 'noinsert)
2982 (if (string-equal (tempo-lookup-named 'symmetry) "")
2983 () (list 'l "symmetry=\"" '(s symmetry) "\""))
2984 '(just-one-space)
2985 (p "<matching (no quotes)>: " matching 'noinsert)
2986 (if (string-equal (tempo-lookup-named 'matching) "")
2987 () (list 'l "matching=\"" '(s matching) "\""))
2988 '(just-one-space)
2989 (p "<couple>: " couple 'noinsert)
2990 (if (string-equal (tempo-lookup-named 'couple) "")
2991 () (list 'l "couple=" '(s couple)))
2992 '(just-one-space)
2993 (p "<array (no quotes)>: " array 'noinsert)
2994 (if (string-equal (tempo-lookup-named 'array) "")
2995 () (list 'l "array=\"" '(s array) "\""))
2996 '(just-one-space)
2997 (p "<orientations (no quotes)>: " orientations 'noinsert)
2998 (if (string-equal (tempo-lookup-named 'orientations) "")
2999 () (list 'l "orientations=\"" '(s orientations) "\""))
3000 '(just-one-space)
3001 (p "<power>: " power 'noinsert)
3002 (if (string-equal (tempo-lookup-named 'power) "")
3003 () (list 'l "power=" '(s power)))
3004 '(just-one-space)
3005 (p "<min_ar>: " min_ar 'noinsert)
3006 (if (string-equal (tempo-lookup-named 'min_ar) "")
3007 () (list 'l "min_ar=" '(s min_ar)))
3008 '(just-one-space)
3009 (p "<max_ar>: " max_ar 'noinsert)
3010 (if (string-equal (tempo-lookup-named 'max_ar) "")
3011 () (list 'l "max_ar=" '(s max_ar)))
3012 '(just-one-space)
3013 (p "<routing_space>: " routing_space 'noinsert)
3014 (if (string-equal (tempo-lookup-named 'routing_space) "")
3015 () (list 'l "routing_space=" '(s routing_space)))
3016 '(just-one-space)
3018 ;; "layla inductor"
3019 "LL"
3020 "tempo template for layla inductor"
3021 'spice-tempo-tags)
3024 ;; coupled inductors
3025 (tempo-define-template
3026 "spice-spice2g6-coupled-inductors"
3027 '("K"
3028 (p "[name]: ") '(just-one-space)
3029 (p "[first inductor]: ") '(just-one-space)
3030 (p "[second inductor]: ") '(just-one-space)
3031 (p "[coupling coefficient]: ")
3033 ;; "spice2g6 inductor coupling"
3035 "tempo template for spice2g6 coupled inductors"
3036 'spice-tempo-tags)
3039 ;; lossless transmission lines
3040 (tempo-define-template
3041 "spice-spice2g6-lossless-transmission"
3042 '("T"
3043 (p "[name]: ") '(just-one-space)
3044 (p "[out port1]: ") '(just-one-space)
3045 (p "[ref port1]: ") '(just-one-space)
3046 (p "[out port2]: ") '(just-one-space)
3047 (p "[ref port2]: ") '(just-one-space)
3048 "Z0=" (p "[char impedance]: ") '(just-one-space)
3049 (p "<time delay in seconds>: " td 'noinsert)
3050 (if (string-equal (tempo-lookup-named 'td) "")
3051 (list 'l '(p "<freq>: " freq 'noinsert)) (list 'l "td=" '(s td)))
3052 '(just-one-space)
3053 (if (and (tempo-lookup-named 'freq)
3054 (not (string-equal (tempo-lookup-named 'freq) "")))
3055 (list 'l "f=" '(s freq) '(p "<normalized length [0.25]>: " nrmlen 'noinsert)))
3056 '(just-one-space)
3057 (if (and (tempo-lookup-named 'nrmlen)
3058 (not (string-equal (tempo-lookup-named 'nrmlen) "")))
3059 (list 'l "nl=" '(s nrmlen)))
3060 '(just-one-space)
3061 (p "<initial cond (voltage port1, current port1, voltage port2, current port2)>: " ic 'noinsert)
3062 (if (string-equal (tempo-lookup-named 'ic) "")
3063 () (list 'l "ic=" '(s ic)))
3065 ;;"spice2g6 lossless transmission line"
3067 "tempo template for spice2g6 lossless transmission line"
3068 'spice-tempo-tags)
3071 (tempo-define-template
3072 "spice-hspice-lossless-transmission"
3073 '("T"
3074 (p "[name]: ") '(just-one-space)
3075 (p "[out port1]: ") '(just-one-space)
3076 (p "[ref port1]: ") '(just-one-space)
3077 (p "[out port2]: ") '(just-one-space)
3078 (p "[ref port2]: ") '(just-one-space)
3079 "Z0=" (p "[char impedance]: ") '(just-one-space)
3080 (p "<time delay in seconds per meter>: " td 'noinsert)
3081 (if (string-equal (tempo-lookup-named 'td) "")
3082 (list 'l '(p "<freq>: " freq 'noinsert))
3083 (list 'l "td=" '(s td) '(p "<length [1m]>: " l 'noinsert)))
3084 '(just-one-space)
3085 (if (and (tempo-lookup-named 'l)
3086 (not (string-equal (tempo-lookup-named 'l) "")))
3087 (list 'l "l=" '(s l)))
3088 '(just-one-space)
3089 (if (and (tempo-lookup-named 'freq)
3090 (not (string-equal (tempo-lookup-named 'freq) "")))
3091 (list 'l "f=" '(s freq) '(p "<normalized length [0.25]>: " nrmlen 'noinsert)))
3092 '(just-one-space)
3093 (if (and (tempo-lookup-named 'nrmlen)
3094 (not (string-equal (tempo-lookup-named 'nrmlen) "")))
3095 (list 'l "nl=" '(s nrmlen)))
3096 '(just-one-space)
3097 (p "<initial cond (voltage port1, current port1, voltage port2, current port2)>: " ic 'noinsert)
3098 (if (string-equal (tempo-lookup-named 'ic) "")
3099 () (list 'l "ic=" '(s ic)))
3101 ;;"hspice lossless transmission line"
3102 "TH"
3103 "tempo template for hspice lossless transmission line"
3104 'spice-tempo-tags)
3107 ;; lossy transmission lines
3108 (tempo-define-template
3109 "spice-spice2g6-lossy-transmission"
3110 '("O"
3111 (p "[name]: ") '(just-one-space)
3112 (p "[out port1]: ") '(just-one-space)
3113 (p "[ref port1]: ") '(just-one-space)
3114 (p "[out port2]: ") '(just-one-space)
3115 (p "[ref port2]: ") '(just-one-space)
3116 (p "[mname]: ") '(just-one-space)
3118 ;;"spice2g6 lossy transmission line"
3120 "tempo template for spice2g6 lossy transmission line"
3121 'spice-tempo-tags)
3124 (tempo-define-template
3125 "spice-spice3-rcline"
3126 '("U"
3127 (p "[name]: ") '(just-one-space)
3128 (p "[in port]: ") '(just-one-space)
3129 (p "[out port]: ") '(just-one-space)
3130 (p "[ref port]: ") '(just-one-space)
3131 (p "[mname]: ") '(just-one-space)
3132 "L="
3133 (p "[length (m)]: ") '(just-one-space)
3134 (p "<lumps>: " lumps 'noinsert)
3135 (if (string-equal (tempo-lookup-named 'lumps) "")
3136 () (list 'l "N=" '(s lumps)))
3137 '(just-one-space)
3139 ;;"spice3 lossy transmission line"
3140 "RCLS"
3141 "tempo template for spice2g6 lossy transmission line"
3142 'spice-tempo-tags)
3145 (tempo-define-template
3146 "spice-eldo-rcline"
3147 '("R"
3148 (p "[name]: ") '(just-one-space)
3149 (p "[pos node]: ") '(just-one-space)
3150 (p "[neg node]: ") '(just-one-space)
3151 (p "[mname]: " mname) '(just-one-space)
3152 (p "<res>: " r 'noinsert)
3153 (if (string-equal (tempo-lookup-named 'r) "")
3154 () (list 'l "R=" '(s r)))
3155 '(just-one-space)
3156 (p "<temp coef 1>: " tc1 'noinsert)
3157 (if (string-equal (tempo-lookup-named 'tc1) "") ()
3158 (list 'l "TC1=" '(s tc1) '(p "<temp coef 2>: " tc2 'noinsert)))
3159 '(just-one-space)
3160 (if (and (tempo-lookup-named 'tc2)
3161 (not (string-equal (tempo-lookup-named 'tc2) "")))
3162 (list 'l "TC2=" '(s tc2)))
3163 '(just-one-space)
3164 (p "<cap>: " c 'noinsert)
3165 (if (string-equal (tempo-lookup-named 'c) "")
3166 () (list 'l "C=" '(s c)))
3167 '(just-one-space)
3168 (p "<length>: " l 'noinsert)
3169 (if (string-equal (tempo-lookup-named 'l) "")
3170 () (list 'l "L=" '(s l)))
3171 '(just-one-space)
3172 (p "<width>: " w 'noinsert)
3173 (if (string-equal (tempo-lookup-named 'w) "")
3174 () (list 'l "W=" '(s w)))
3175 '(just-one-space)
3176 (p "<m>: " m 'noinsert)
3177 (if (string-equal (tempo-lookup-named 'm) "")
3178 () (list 'l "M=" '(s m)))
3179 '(just-one-space)
3180 (p "<diff temp>: " dtemp 'noinsert)
3181 (if (string-equal (tempo-lookup-named 'dtemp) "")
3182 () (list 'l "DTEMP=" '(s dtemp)))
3183 '(just-one-space)
3184 (p "<scale>: " scale 'noinsert)
3185 (if (string-equal (tempo-lookup-named 'scale) "")
3186 () (list 'l "SCALE=" '(s scale)))
3187 '(just-one-space)
3189 ;;"eldo rcline"
3190 "RCLE"
3191 "tempo template for eldo rcline"
3192 'spice-tempo-tags)
3195 ;; active elements
3197 ;; diodes
3198 (tempo-define-template
3199 "spice-spice2g6-diode"
3200 '("D"
3201 (p "[name]: ") '(just-one-space)
3202 (p "[positive node]: ") '(just-one-space)
3203 (p "[negative node]: ") '(just-one-space)
3204 (p "[mname]: ") '(just-one-space)
3205 (p "<area>: ") '(just-one-space)
3206 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3207 (if (and (tempo-lookup-named 'off)
3208 (string-equal (tempo-lookup-named 'off) "y"))
3209 (list 'l "OFF"))
3210 '(just-one-space)
3211 (p "<initial cond (diode voltage)>: " ic 'noinsert)
3212 (if (string-equal (tempo-lookup-named 'ic) "")
3213 () (list 'l "IC=" '(s ic)))
3214 '(just-one-space)
3215 (p "<temp>: " temp 'noinsert)
3216 (if (string-equal (tempo-lookup-named 'temp) "")
3217 () (list 'l "TEMP=" '(s temp)))
3218 '(just-one-space)
3220 ;;"spice2g6 diode"
3222 "tempo template for spice2g6 diode"
3223 'spice-tempo-tags)
3226 (tempo-define-template
3227 "spice-eldo-diode"
3228 '("D"
3229 (p "[name]: ") '(just-one-space)
3230 (p "[positive node]: ") '(just-one-space)
3231 (p "[negative node]: ") '(just-one-space)
3232 (p "[mname]: ") '(just-one-space)
3233 (p "<area>: " area 'noinsert) '(just-one-space)
3234 (if (string-equal (tempo-lookup-named 'area) "")
3235 () (list 'l "AREA=" '(s area)))
3236 '(just-one-space)
3237 (p "<perimeter>: " peri 'noinsert)
3238 (if (string-equal (tempo-lookup-named 'peri) "")
3239 () (list 'l "PERI=" '(s peri)))
3240 '(just-one-space)
3241 (p "<temp>: " temp 'noinsert)
3242 (if (string-equal (tempo-lookup-named 'temp) "")
3243 () (list 'l "TEMP=" '(s temp)))
3244 '(just-one-space)
3245 (p "<off [y/n]>: " off 'noinsert)
3246 (if (and (tempo-lookup-named 'off)
3247 (string-equal (tempo-lookup-named 'off) "y"))
3248 (list 'l "OFF"))
3249 '(just-one-space)
3250 (p "<nonoise [y/n]>: " nonoise 'noinsert)
3251 (if (and (tempo-lookup-named 'nonoise)
3252 (string-equal (tempo-lookup-named 'nonoise) "y"))
3253 (list 'l "NONOISE"))
3254 '(just-one-space)
3256 ;;"eldo diode"
3257 "DE"
3258 "tempo template for eldo diode"
3259 'spice-tempo-tags)
3262 (tempo-define-template
3263 "spice-hspice-diode"
3264 '("D"
3265 (p "[name]: ") '(just-one-space)
3266 (p "[positive node]: ") '(just-one-space)
3267 (p "[negative node]: ") '(just-one-space)
3268 (p "[mname]: ") '(just-one-space)
3269 (p "<area>: " area 'noinsert) '(just-one-space)
3270 (if (string-equal (tempo-lookup-named 'area) "")
3271 (list 'l '(p "<width>: " w 'noinsert))
3272 (list 'l "AREA=" '(s area) '(p "<perimeter>: " peri 'noinsert)))
3273 '(just-one-space)
3274 (if (and (tempo-lookup-named 'peri)
3275 (not (string-equal (tempo-lookup-named 'peri) "")))
3276 (list 'l "PJ=" '(s peri)))
3277 '(just-one-space)
3278 (if (string-equal (tempo-lookup-named 'area) "")
3279 (list 'l '(p "<length>: " l 'noinsert)))
3280 '(just-one-space)
3281 (if (and (tempo-lookup-named 'l)
3282 (not (string-equal (tempo-lookup-named 'l) "")))
3283 () (list 'l "L=" '(s l)))
3284 '(just-one-space)
3285 (p "<width poly cap>: " wp 'noinsert)
3286 (if (string-equal (tempo-lookup-named 'wp) "")
3287 () (list 'l "WP=" '(s wp)))
3288 '(just-one-space)
3289 (p "<length poly cap>: " lp 'noinsert)
3290 (if (string-equal (tempo-lookup-named 'lp) "")
3291 () (list 'l "LP=" '(s lp)))
3292 '(just-one-space)
3293 (p "<width metal cap>: " wm 'noinsert)
3294 (if (string-equal (tempo-lookup-named 'wm) "")
3295 () (list 'l "WM=" '(s wm)))
3296 '(just-one-space)
3297 (p "<length metal cap>: " lm 'noinsert)
3298 (if (string-equal (tempo-lookup-named 'lm) "")
3299 () (list 'l "LM=" '(s lm)))
3300 '(just-one-space)
3301 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3302 (if (and (tempo-lookup-named 'off)
3303 (string-equal (tempo-lookup-named 'off) "y"))
3304 (list 'l "OFF"))
3305 '(just-one-space)
3306 (p "<initial cond (voltage)>: " ic 'noinsert)
3307 (if (string-equal (tempo-lookup-named 'ic) "")
3308 () (list 'l "IC=" '(s ic)))
3309 '(just-one-space)
3310 (p "<m>: " m 'noinsert)
3311 (if (string-equal (tempo-lookup-named 'm) "")
3312 () (list 'l "M=" '(s m)))
3313 '(just-one-space)
3314 (p "<diff temp>: " dtemp 'noinsert)
3315 (if (string-equal (tempo-lookup-named 'dtemp) "")
3316 () (list 'l "DTEMP=" '(s dtemp)))
3317 '(just-one-space)
3319 ;;"hspice diode"
3320 "DH"
3321 "tempo template for hspice diode"
3322 'spice-tempo-tags)
3325 (tempo-define-template
3326 "spice-layla-diode"
3327 '("D"
3328 (p "[name]: ") '(just-one-space)
3329 (p "[positive node]: ") '(just-one-space)
3330 (p "[negative node]: ") '(just-one-space)
3331 ; (p "<mname>: ") '(just-one-space)
3332 (p "[area]: ") '(just-one-space)
3333 (p "<units_ver>: " units_ver 'noinsert)
3334 (if (string-equal (tempo-lookup-named 'units_ver) "")
3335 () (list 'l "units_ver=" '(s units_ver)))
3336 '(just-one-space)
3337 (p "<units_hor>: " units_hor 'noinsert)
3338 (if (string-equal (tempo-lookup-named 'units_hor) "")
3339 () (list 'l "units_hor=" '(s units_hor)))
3340 '(just-one-space)
3341 "\n+ type=\""
3342 (p "[type (no quotes)]: ") "\""
3343 '(just-one-space)
3344 (p "<symmetry (no quotes)>: " symmetry 'noinsert)
3345 (if (string-equal (tempo-lookup-named 'symmetry) "")
3346 () (list 'l "symmetry=\"" '(s symmetry) "\""))
3347 '(just-one-space)
3348 (p "<matching (no quotes)>: " matching 'noinsert)
3349 (if (string-equal (tempo-lookup-named 'matching) "")
3350 () (list 'l "matching=\"" '(s matching) "\""))
3351 '(just-one-space)
3352 (p "<couple>: " couple 'noinsert)
3353 (if (string-equal (tempo-lookup-named 'couple) "")
3354 () (list 'l "couple=" '(s couple)))
3355 '(just-one-space)
3356 (p "<array (no quotes)>: " array 'noinsert)
3357 (if (string-equal (tempo-lookup-named 'array) "")
3358 () (list 'l "array=\"" '(s array) "\""))
3359 '(just-one-space)
3360 (p "<orientations (no quotes)>: " orientations 'noinsert)
3361 (if (string-equal (tempo-lookup-named 'orientations) "")
3362 () (list 'l "orientations=\"" '(s orientations) "\""))
3363 '(just-one-space)
3364 (p "<unit_value>: " unit_value 'noinsert)
3365 (if (string-equal (tempo-lookup-named 'unit_value) "")
3366 () (list 'l "unit_value=" '(s unit_value)))
3367 '(just-one-space)
3368 (p "<current>: " current 'noinsert)
3369 (if (string-equal (tempo-lookup-named 'current) "")
3370 () (list 'l "current=" '(s current)))
3371 '(just-one-space)
3372 (p "<power>: " power 'noinsert)
3373 (if (string-equal (tempo-lookup-named 'power) "")
3374 () (list 'l "power=" '(s power)))
3375 '(just-one-space)
3376 (p "<min_ar>: " min_ar 'noinsert)
3377 (if (string-equal (tempo-lookup-named 'min_ar) "")
3378 () (list 'l "min_ar=" '(s min_ar)))
3379 '(just-one-space)
3380 (p "<max_ar>: " max_ar 'noinsert)
3381 (if (string-equal (tempo-lookup-named 'max_ar) "")
3382 () (list 'l "max_ar=" '(s max_ar)))
3383 '(just-one-space)
3384 (p "<routing_space>: " routing_space 'noinsert)
3385 (if (string-equal (tempo-lookup-named 'routing_space) "")
3386 () (list 'l "routing_space=" '(s routing_space)))
3387 '(just-one-space)
3389 ;;"layla diode"
3390 "DL"
3391 "tempo template for layla diode"
3392 'spice-tempo-tags)
3395 ;; bipolars
3396 (tempo-define-template
3397 "spice-spice2g6-bipolar"
3398 '("Q"
3399 (p "[name]: ") '(just-one-space)
3400 (p "[collector node]: ") '(just-one-space)
3401 (p "[base node]: ") '(just-one-space)
3402 (p "[emitter node]: ") '(just-one-space)
3403 (p "<substrate node>: ") '(just-one-space)
3404 (p "[mname]: ") '(just-one-space)
3405 (p "<area>: ") '(just-one-space)
3406 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3407 (if (and (tempo-lookup-named 'off)
3408 (string-equal (tempo-lookup-named 'off) "y"))
3409 (list 'l "OFF"))
3410 '(just-one-space)
3411 (p "<initial cond (vbe, vce)>: " ic 'noinsert)
3412 (if (string-equal (tempo-lookup-named 'ic) "")
3413 () (list 'l "IC=" '(s ic)))
3414 '(just-one-space)
3415 (p "<temp>: " temp 'noinsert)
3416 (if (string-equal (tempo-lookup-named 'temp) "")
3417 () (list 'l "TEMP=" '(s temp)))
3418 '(just-one-space)
3420 ;;"spice2g6 bipolar"
3422 "tempo template for spice2g6 bipolar"
3423 'spice-tempo-tags)
3426 (tempo-define-template
3427 "spice-eldo-bipolar"
3428 '("Q"
3429 (p "[name]: ") '(just-one-space)
3430 (p "[collector node]: ") '(just-one-space)
3431 (p "[base node]: ") '(just-one-space)
3432 (p "[emitter node]: ") '(just-one-space)
3433 (p "<substrate node>: ") '(just-one-space)
3434 (p "[mname]: ") '(just-one-space)
3435 (p "<area>: " area 'noinsert) '(just-one-space)
3436 (if (string-equal (tempo-lookup-named 'area) "")
3437 () (list 'l "AREA=" '(s area)))
3438 '(just-one-space)
3439 (p "<rel base area>: " areab 'noinsert)
3440 (if (string-equal (tempo-lookup-named 'areab) "")
3441 () (list 'l "AREAB=" '(s areab)))
3442 '(just-one-space)
3443 (p "<rel collector area>: " areac 'noinsert)
3444 (if (string-equal (tempo-lookup-named 'areac) "")
3445 () (list 'l "AREAC=" '(s areac)))
3446 '(just-one-space)
3447 (p "<temp>: " temp 'noinsert)
3448 (if (string-equal (tempo-lookup-named 'temp) "")
3449 () (list 'l "T=" '(s temp)))
3450 '(just-one-space)
3451 (p "<m>: " m 'noinsert)
3452 (if (string-equal (tempo-lookup-named 'm) "")
3453 () (list 'l "M=" '(s m)))
3454 '(just-one-space)
3455 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3456 (if (and (tempo-lookup-named 'off)
3457 (string-equal (tempo-lookup-named 'off) "y"))
3458 (list 'l "OFF"))
3459 '(just-one-space)
3460 (p "<nonoise [y/n]>: " nonoise 'noinsert)
3461 (if (and (tempo-lookup-named 'nonoise)
3462 (string-equal (tempo-lookup-named 'nonoise) "y"))
3463 (list 'l "NONOISE"))
3464 '(just-one-space)
3466 ;;"eldo bipolar"
3467 "QE"
3468 "tempo template for eldo bipolar"
3469 'spice-tempo-tags)
3472 (tempo-define-template
3473 "spice-hspice-bipolar"
3474 '("Q"
3475 (p "[name]: ") '(just-one-space)
3476 (p "[collector node]: ") '(just-one-space)
3477 (p "[base node]: ") '(just-one-space)
3478 (p "[emitter node]: ") '(just-one-space)
3479 (p "<substrate node>: ") '(just-one-space)
3480 (p "[mname]: ") '(just-one-space)
3481 (p "<area>: " area 'noinsert) '(just-one-space)
3482 (if (string-equal (tempo-lookup-named 'area) "")
3483 () (list 'l "AREA=" '(s area)))
3484 '(just-one-space)
3485 (p "<rel base area>: " areab 'noinsert)
3486 (if (string-equal (tempo-lookup-named 'areab) "")
3487 () (list 'l "AREAB=" '(s areab)))
3488 '(just-one-space)
3489 (p "<rel collector area>: " areac 'noinsert)
3490 (if (string-equal (tempo-lookup-named 'areac) "")
3491 () (list 'l "AREAC=" '(s areac)))
3492 '(just-one-space)
3493 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3494 (if (and (tempo-lookup-named 'off)
3495 (string-equal (tempo-lookup-named 'off) "y"))
3496 (list 'l "OFF"))
3497 '(just-one-space)
3498 (p "<init vbe>: " vbe 'noinsert)
3499 (if (string-equal (tempo-lookup-named 'vbe) "")
3500 () (list 'l "VBE=" '(s vbe)))
3501 '(just-one-space)
3502 (p "<init vce>: " vce 'noinsert)
3503 (if (string-equal (tempo-lookup-named 'vce) "")
3504 () (list 'l "VCE=" '(s vce)))
3505 '(just-one-space)
3506 (p "<m>: " m 'noinsert)
3507 (if (string-equal (tempo-lookup-named 'm) "")
3508 () (list 'l "M=" '(s m)))
3509 '(just-one-space)
3510 (p "<diff temp>: " dtemp 'noinsert)
3511 (if (string-equal (tempo-lookup-named 'dtemp) "")
3512 () (list 'l "DTEMP=" '(s dtemp)))
3513 '(just-one-space)
3515 ;;"hspice bipolar"
3516 "QH"
3517 "tempo template for hspice bipolar"
3518 'spice-tempo-tags)
3521 ;; jfets
3522 (tempo-define-template
3523 "spice-spice2g6-jfet"
3524 '("J"
3525 (p "[name]: ") '(just-one-space)
3526 (p "[drain node]: ") '(just-one-space)
3527 (p "[gate node]: ") '(just-one-space)
3528 (p "[source node]: ") '(just-one-space)
3529 (p "[mname]: ") '(just-one-space)
3530 (p "<area>: ") '(just-one-space)
3531 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3532 (if (and (tempo-lookup-named 'off)
3533 (string-equal (tempo-lookup-named 'off) "y"))
3534 (list 'l "OFF"))
3535 '(just-one-space)
3536 (p "<initial cond (vds, vgs)>: " ic 'noinsert)
3537 (if (string-equal (tempo-lookup-named 'ic) "")
3538 () (list 'l "IC=" '(s ic)))
3539 '(just-one-space)
3540 (p "<temp>: " temp 'noinsert)
3541 (if (string-equal (tempo-lookup-named 'temp) "")
3542 () (list 'l "TEMP=" '(s temp)))
3543 '(just-one-space)
3545 ;;"spice2g6 jfet"
3547 "tempo template for spice2g6 jfet"
3548 'spice-tempo-tags)
3551 (tempo-define-template
3552 "spice-eldo-jfet"
3553 '("J"
3554 (p "[name]: ") '(just-one-space)
3555 (p "[drain node]: ") '(just-one-space)
3556 (p "[gate node]: ") '(just-one-space)
3557 (p "[source node]: ") '(just-one-space)
3558 (p "[mname]: ") '(just-one-space)
3559 (p "<area>: " area 'noinsert) '(just-one-space)
3560 (if (string-equal (tempo-lookup-named 'area) "")
3561 () (list 'l "AREA=" '(s area)))
3562 '(just-one-space)
3563 (p "<length>: " l 'noinsert)
3564 (if (string-equal (tempo-lookup-named 'l) "")
3565 () (list 'l "L=" '(s l)))
3566 '(just-one-space)
3567 (p "<width>: " w 'noinsert)
3568 (if (string-equal (tempo-lookup-named 'w) "")
3569 () (list 'l "W=" '(s w)))
3570 '(just-one-space)
3571 (p "<temp>: " temp 'noinsert)
3572 (if (string-equal (tempo-lookup-named 'temp) "")
3573 () (list 'l "T=" '(s temp)))
3574 '(just-one-space)
3575 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3576 (if (and (tempo-lookup-named 'off)
3577 (string-equal (tempo-lookup-named 'off) "y"))
3578 (list 'l "OFF"))
3579 '(just-one-space)
3580 (p "<nonoise [y/n]>: " nonoise 'noinsert)
3581 (if (and (tempo-lookup-named 'nonoise)
3582 (string-equal (tempo-lookup-named 'nonoise) "y"))
3583 (list 'l "NONOISE"))
3584 '(just-one-space)
3586 ;;"eldo jfet"
3587 "JE"
3588 "tempo template for eldo jfet"
3589 'spice-tempo-tags)
3592 (tempo-define-template
3593 "spice-hspice-jfet"
3594 '("J"
3595 (p "[name]: ") '(just-one-space)
3596 (p "[drain node]: ") '(just-one-space)
3597 (p "[gate node]: ") '(just-one-space)
3598 (p "[source node]: ") '(just-one-space)
3599 (p "[mname]: ") '(just-one-space)
3600 (p "<area>: " area 'noinsert)
3601 (if (string-equal (tempo-lookup-named 'area) "")
3602 (list 'l '(p "<length>: " l 'noinsert) '(p "<width>: " w 'noinsert))
3603 (list 'l "AREA=" '(s area)))
3604 '(just-one-space)
3605 (if (and (tempo-lookup-named 'l)
3606 (not (string-equal (tempo-lookup-named 'l) "")))
3607 (list 'l "L=" '(s l)))
3608 '(just-one-space)
3609 (if (and (tempo-lookup-named 'w)
3610 (not (string-equal (tempo-lookup-named 'w) "")))
3611 (list 'l "W=" '(s w)))
3612 '(just-one-space)
3613 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3614 (if (and (tempo-lookup-named 'off)
3615 (string-equal (tempo-lookup-named 'off) "y"))
3616 (list 'l "OFF"))
3617 '(just-one-space)
3618 (p "<initial cond (vds,vgs)>: " ic 'noinsert)
3619 (if (string-equal (tempo-lookup-named 'ic) "")
3620 () (list 'l "IC=" '(s ic)))
3621 '(just-one-space)
3622 (p "<m>: " m 'noinsert)
3623 (if (string-equal (tempo-lookup-named 'm) "")
3624 () (list 'l "M=" '(s m)))
3625 '(just-one-space)
3626 (p "<diff temp>: " dtemp 'noinsert)
3627 (if (string-equal (tempo-lookup-named 'dtemp) "")
3628 () (list 'l "DTEMP=" '(s dtemp)))
3629 '(just-one-space)
3631 ;;"hspice jfet"
3632 "JH"
3633 "tempo template for hspice jfet"
3634 'spice-tempo-tags)
3637 ;; mosfets
3638 (tempo-define-template
3639 "spice-spice2g6-mosfet"
3640 '("M"
3641 (p "[name]: ") '(just-one-space)
3642 (p "[drain node]: ") '(just-one-space)
3643 (p "[gate node]: ") '(just-one-space)
3644 (p "[source node]: ") '(just-one-space)
3645 (p "[bulk node]: ") '(just-one-space)
3646 (p "[mname]: ") '(just-one-space)
3647 (p "<length>: " l 'noinsert)
3648 (if (string-equal (tempo-lookup-named 'l) "")
3649 () (list 'l "L=" '(s l)))
3650 '(just-one-space)
3651 (p "<width>: " w 'noinsert)
3652 (if (string-equal (tempo-lookup-named 'w) "")
3653 () (list 'l "W=" '(s w)))
3654 '(just-one-space)
3655 (p "<area drain>: " ad 'noinsert)
3656 (if (string-equal (tempo-lookup-named 'ad) "")
3657 () (list 'l "AD=" '(s ad)))
3658 '(just-one-space)
3659 (p "<area source>: " as 'noinsert)
3660 (if (string-equal (tempo-lookup-named 'as) "")
3661 () (list 'l "AS=" '(s as)))
3662 '(just-one-space)
3663 (p "<perimeter drain>: " pd 'noinsert)
3664 (if (string-equal (tempo-lookup-named 'pd) "")
3665 () (list 'l "PD=" '(s pd)))
3666 '(just-one-space)
3667 (p "<perimeter source>: " ps 'noinsert)
3668 (if (string-equal (tempo-lookup-named 'ps) "")
3669 () (list 'l "PS=" '(s ps)))
3670 '(just-one-space)
3671 (p "<number of drain contacts>: " nrd 'noinsert)
3672 (if (string-equal (tempo-lookup-named 'nrd) "")
3673 () (list 'l "NRD=" '(s nrd)))
3674 '(just-one-space)
3675 (p "<number of source contacts>: " nrs 'noinsert)
3676 (if (string-equal (tempo-lookup-named 'nrs) "")
3677 () (list 'l "NRS=" '(s nrs)))
3678 '(just-one-space)
3679 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3680 (if (and (tempo-lookup-named 'off)
3681 (string-equal (tempo-lookup-named 'off) "y"))
3682 (list 'l "OFF"))
3683 '(just-one-space)
3684 (p "<initial cond (vds, vgs, vgs)>: " ic 'noinsert)
3685 (if (string-equal (tempo-lookup-named 'ic) "")
3686 () (list 'l "IC=" '(s ic)))
3687 '(just-one-space)
3689 ;;"spice2g6 mosfet"
3691 "tempo template for spice2g6 mosfet"
3692 'spice-tempo-tags)
3695 (tempo-define-template
3696 "spice-eldo-mosfet"
3697 '("M"
3698 (p "[name]: ") '(just-one-space)
3699 (p "[drain node]: ") '(just-one-space)
3700 (p "[gate node]: ") '(just-one-space)
3701 (p "[source node]: ") '(just-one-space)
3702 (p "[bulk node]: ") '(just-one-space)
3703 (p "<optional nodes>: ") '(just-one-space)
3704 "MOD="
3705 (p "[mname]: ") '(just-one-space)
3706 (p "<length>: " l 'noinsert)
3707 (if (string-equal (tempo-lookup-named 'l) "")
3708 () (list 'l "L=" '(s l)))
3709 '(just-one-space)
3710 (p "<width>: " w 'noinsert)
3711 (if (string-equal (tempo-lookup-named 'w) "")
3712 () (list 'l "W=" '(s w)))
3713 '(just-one-space)
3714 (p "<area drain>: " ad 'noinsert)
3715 (if (string-equal (tempo-lookup-named 'ad) "")
3716 () (list 'l "AD=" '(s ad)))
3717 '(just-one-space)
3718 (p "<area source>: " as 'noinsert)
3719 (if (string-equal (tempo-lookup-named 'as) "")
3720 () (list 'l "AS=" '(s as)))
3721 '(just-one-space)
3722 (p "<perimeter drain>: " pd 'noinsert)
3723 (if (string-equal (tempo-lookup-named 'pd) "")
3724 () (list 'l "PD=" '(s pd)))
3725 '(just-one-space)
3726 (p "<perimeter source>: " ps 'noinsert)
3727 (if (string-equal (tempo-lookup-named 'ps) "")
3728 () (list 'l "PS=" '(s ps)))
3729 '(just-one-space)
3730 (p "<geometry model>: " geo 'noinsert)
3731 (if (string-equal (tempo-lookup-named 'geo) "")
3732 () (list 'l "GEO=" '(s geo)))
3733 '(just-one-space)
3734 (p "<number of drain contacts>: " nrd 'noinsert)
3735 (if (string-equal (tempo-lookup-named 'nrd) "")
3736 () (list 'l "NRD=" '(s nrd)))
3737 '(just-one-space)
3738 (p "<number of source contacts>: " nrs 'noinsert)
3739 (if (string-equal (tempo-lookup-named 'nrs) "")
3740 () (list 'l "NRS=" '(s nrs)))
3741 '(just-one-space)
3742 (p "<m>: " m 'noinsert)
3743 (if (string-equal (tempo-lookup-named 'm) "")
3744 () (list 'l "M=" '(s m)))
3745 '(just-one-space)
3746 (p "<extra drain contact resistance>: " rdc 'noinsert)
3747 (if (string-equal (tempo-lookup-named 'rdc) "")
3748 () (list 'l "RDC=" '(s rdc)))
3749 '(just-one-space)
3750 (p "<extra source contact resistance>: " rsc 'noinsert)
3751 (if (string-equal (tempo-lookup-named 'rsc) "")
3752 () (list 'l "RSC=" '(s rsc)))
3753 '(just-one-space)
3754 (p "<temp>: " temp 'noinsert)
3755 (if (string-equal (tempo-lookup-named 'temp) "")
3756 () (list 'l "T=" '(s temp)))
3757 '(just-one-space)
3758 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3759 (if (and (tempo-lookup-named 'off)
3760 (string-equal (tempo-lookup-named 'off) "y"))
3761 (list 'l "OFF"))
3762 '(just-one-space)
3763 (p "<nonoise [y/n]>: " nonoise 'noinsert)
3764 (if (and (tempo-lookup-named 'nonoise)
3765 (string-equal (tempo-lookup-named 'nonoise) "y"))
3766 (list 'l "NONOISE"))
3767 '(just-one-space)
3769 ;;"eldo mosfet"
3770 "ME"
3771 "tempo template for eldo mosfet"
3772 'spice-tempo-tags)
3775 (tempo-define-template
3776 "spice-hspice-mosfet"
3777 '("M"
3778 (p "[name]: ") '(just-one-space)
3779 (p "[drain node]: ") '(just-one-space)
3780 (p "[gate node]: ") '(just-one-space)
3781 (p "[source node]: ") '(just-one-space)
3782 (p "[bulk node]: ") '(just-one-space)
3783 (p "[mname]: ") '(just-one-space)
3784 (p "<length>: " l 'noinsert)
3785 (if (string-equal (tempo-lookup-named 'l) "")
3786 () (list 'l "L=" '(s l)))
3787 '(just-one-space)
3788 (p "<width>: " w 'noinsert)
3789 (if (string-equal (tempo-lookup-named 'w) "")
3790 () (list 'l "W=" '(s w)))
3791 '(just-one-space)
3792 (p "<area drain>: " ad 'noinsert)
3793 (if (string-equal (tempo-lookup-named 'ad) "")
3794 () (list 'l "AD=" '(s ad)))
3795 '(just-one-space)
3796 (p "<area source>: " as 'noinsert)
3797 (if (string-equal (tempo-lookup-named 'as) "")
3798 () (list 'l "AS=" '(s as)))
3799 '(just-one-space)
3800 (p "<perimeter drain>: " pd 'noinsert)
3801 (if (string-equal (tempo-lookup-named 'pd) "")
3802 () (list 'l "PD=" '(s pd)))
3803 '(just-one-space)
3804 (p "<perimeter source>: " ps 'noinsert)
3805 (if (string-equal (tempo-lookup-named 'ps) "")
3806 () (list 'l "PS=" '(s ps)))
3807 '(just-one-space)
3808 (p "<number of drain contacts>: " nrd 'noinsert)
3809 (if (string-equal (tempo-lookup-named 'nrd) "")
3810 () (list 'l "NRD=" '(s nrd)))
3811 '(just-one-space)
3812 (p "<number of source contacts>: " nrs 'noinsert)
3813 (if (string-equal (tempo-lookup-named 'nrs) "")
3814 () (list 'l "NRS=" '(s nrs)))
3815 '(just-one-space)
3816 (p "<extra drain contact resistance>: " rdc 'noinsert)
3817 (if (string-equal (tempo-lookup-named 'rdc) "")
3818 () (list 'l "RDC=" '(s rdc)))
3819 '(just-one-space)
3820 (p "<extra source contact resistance>: " rsc 'noinsert)
3821 (if (string-equal (tempo-lookup-named 'rsc) "")
3822 () (list 'l "RSC=" '(s rsc)))
3823 '(just-one-space)
3824 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3825 (if (and (tempo-lookup-named 'off)
3826 (string-equal (tempo-lookup-named 'off) "y"))
3827 (list 'l "OFF"))
3828 '(just-one-space)
3829 (p "<init cond (vds,vgs,vbs)>: " ic 'noinsert)
3830 (if (string-equal (tempo-lookup-named 'ic) "")
3831 () (list 'l "IC=" '(s ic)))
3832 '(just-one-space)
3833 (p "<diff temp>: " dtemp 'noinsert)
3834 (if (string-equal (tempo-lookup-named 'dtemp) "")
3835 () (list 'l "DTEMP=" '(s dtemp)))
3836 '(just-one-space)
3837 (p "<geometry model>: " geo 'noinsert)
3838 (if (string-equal (tempo-lookup-named 'geo) "")
3839 () (list 'l "GEO=" '(s geo)))
3840 '(just-one-space)
3841 (p "<m>: " m 'noinsert)
3842 (if (string-equal (tempo-lookup-named 'm) "")
3843 () (list 'l "M=" '(s m)))
3844 '(just-one-space)
3845 (p "<delvto>: " delvto 'noinsert)
3846 (if (string-equal (tempo-lookup-named 'delvto) "")
3847 () (list 'l "DELVTO=" '(s delvto)))
3848 '(just-one-space)
3850 ;;"hspice mosfet"
3851 "MH"
3852 "tempo template for hspice mosfet"
3853 'spice-tempo-tags)
3856 (tempo-define-template
3857 "spice-layla-mosfet"
3858 '("M"
3859 (p "[name]: ") '(just-one-space)
3860 (p "[drain node]: ") '(just-one-space)
3861 (p "[gate node]: ") '(just-one-space)
3862 (p "[source node]: ") '(just-one-space)
3863 (p "[bulk node]: ") '(just-one-space)
3864 (p "[mname]: ") '(just-one-space)
3865 (p "<length>: " l 'noinsert)
3866 (if (string-equal (tempo-lookup-named 'l) "")
3867 () (list 'l "L=" '(s l)))
3868 '(just-one-space)
3869 (p "<width>: " w 'noinsert)
3870 (if (string-equal (tempo-lookup-named 'w) "")
3871 () (list 'l "W=" '(s w)))
3872 '(just-one-space)
3873 "\n+ type=\""
3874 (p "[type (no quotes)]: ") "\""
3875 '(just-one-space)
3876 (p "<symmetry (no quotes)>: " symmetry 'noinsert)
3877 (if (string-equal (tempo-lookup-named 'symmetry) "")
3878 () (list 'l "symmetry=\"" '(s symmetry) "\""))
3879 '(just-one-space)
3880 (p "<matching (no quotes)>: " matching 'noinsert)
3881 (if (string-equal (tempo-lookup-named 'matching) "")
3882 () (list 'l "matching=\"" '(s matching) "\""))
3883 '(just-one-space)
3884 (p "<couple>: " couple 'noinsert)
3885 (if (string-equal (tempo-lookup-named 'couple) "")
3886 () (list 'l "couple=" '(s couple)))
3887 '(just-one-space)
3888 (p "<array (no quotes)>: " array 'noinsert)
3889 (if (string-equal (tempo-lookup-named 'array) "")
3890 () (list 'l "array=\"" '(s array) "\""))
3891 '(just-one-space)
3892 (p "<orientations (no quotes)>: " orientations 'noinsert)
3893 (if (string-equal (tempo-lookup-named 'orientations) "")
3894 () (list 'l "orientations=\"" '(s orientations) "\""))
3895 '(just-one-space)
3896 (p "<unit_value>: " unit_value 'noinsert)
3897 (if (string-equal (tempo-lookup-named 'unit_value) "")
3898 () (list 'l "unit_value=" '(s unit_value)))
3899 '(just-one-space)
3900 (p "<current>: " current 'noinsert)
3901 (if (string-equal (tempo-lookup-named 'current) "")
3902 () (list 'l "current=" '(s current)))
3903 '(just-one-space)
3904 (p "<power>: " power 'noinsert)
3905 (if (string-equal (tempo-lookup-named 'power) "")
3906 () (list 'l "power=" '(s power)))
3907 '(just-one-space)
3908 (p "<min_ar>: " min_ar 'noinsert)
3909 (if (string-equal (tempo-lookup-named 'min_ar) "")
3910 () (list 'l "min_ar=" '(s min_ar)))
3911 '(just-one-space)
3912 (p "<max_ar>: " max_ar 'noinsert)
3913 (if (string-equal (tempo-lookup-named 'max_ar) "")
3914 () (list 'l "max_ar=" '(s max_ar)))
3915 '(just-one-space)
3916 (p "<routing_space>: " routing_space 'noinsert)
3917 (if (string-equal (tempo-lookup-named 'routing_space) "")
3918 () (list 'l "routing_space=" '(s routing_space)))
3919 '(just-one-space)
3921 ;;"layla mosfet"
3922 "ML"
3923 "tempo template for layla mosfet"
3924 'spice-tempo-tags)
3927 ;; mesfets
3928 (tempo-define-template
3929 "spice-spice2g6-mesfet"
3930 '("Z"
3931 (p "[name]: ") '(just-one-space)
3932 (p "[drain node]: ") '(just-one-space)
3933 (p "[gate node]: ") '(just-one-space)
3934 (p "[source node]: ") '(just-one-space)
3935 (p "[mname]: ") '(just-one-space)
3936 (p "<area>: ") '(just-one-space)
3937 (p "<off [y/n]>: " off 'noinsert) '(just-one-space)
3938 (if (and (tempo-lookup-named 'off)
3939 (string-equal (tempo-lookup-named 'off) "y"))
3940 (list 'l "OFF"))
3941 '(just-one-space)
3942 (p "<initial cond (vds, vgs)>: " ic 'noinsert)
3943 (if (string-equal (tempo-lookup-named 'ic) "")
3944 () (list 'l "IC=" '(s ic)))
3945 '(just-one-space)
3947 ;;"spice2g6 mesfet"
3949 "tempo template for spice2g6 mesfet"
3950 'spice-tempo-tags)
3953 ;; subcircuit defs
3954 (tempo-define-template
3955 "spice-spice2g6-subckt"
3956 '(".subckt "
3957 (p "[subckt name]: " lname) 'r 'n 'n
3958 ".ends " (s lname) '>)
3959 "SUB"
3960 "template for inserting a subckt definition"
3961 'spice-tempo-tags)
3964 ;; Controlled sources
3966 ;; Voltage sources
3968 (tempo-define-template
3969 "spice-spice2g6-vcvs"
3970 '("E"
3971 (p "[name]: ") '(just-one-space)
3972 (p "[positive node]: ") '(just-one-space)
3973 (p "[negative node]: ") '(just-one-space)
3974 (p "[positive controling node]: ") '(just-one-space)
3975 (p "[negative controling node]: ") '(just-one-space)
3976 (p "[gain]: ") '(just-one-space)
3978 "VCVS"
3979 "template for inserting a voltage controled voltage source"
3980 'spice-tempo-tags)
3982 (tempo-define-template
3983 "spice-spice2g6-ccvs"
3984 '("H"
3985 (p "[name]: ") '(just-one-space)
3986 (p "[positive node]: ") '(just-one-space)
3987 (p "[negative node]: ") '(just-one-space)
3988 (p "[voltage source]: ") '(just-one-space)
3989 (p "[gain]: ") '(just-one-space)
3991 "CCVS"
3992 "template for inserting a current controled voltage source"
3993 'spice-tempo-tags)
3996 ;; Current sources
3998 (tempo-define-template
3999 "spice-spice2g6-vccs"
4000 '("G"
4001 (p "[name]: ") '(just-one-space)
4002 (p "[positive node]: ") '(just-one-space)
4003 (p "[negative node]: ") '(just-one-space)
4004 (p "[positive controling node]: ") '(just-one-space)
4005 (p "[negative controling node]: ") '(just-one-space)
4006 (p "[transadmitance]: ") '(just-one-space)
4008 "VCCS"
4009 "template for inserting a voltage controled current source"
4010 'spice-tempo-tags)
4012 (tempo-define-template
4013 "spice-spice2g6-cccs"
4014 '("F"
4015 (p "[name]: ") '(just-one-space)
4016 (p "[positive node]: ") '(just-one-space)
4017 (p "[negative node]: ") '(just-one-space)
4018 (p "[voltage source]: ") '(just-one-space)
4019 (p "[gain]: ") '(just-one-space)
4021 "CCCS"
4022 "template for inserting a current controled current source"
4023 'spice-tempo-tags)
4026 ;; Waveforms
4028 (tempo-define-template
4029 "spice-pulse"
4030 '("pulse("
4031 (p "[start value]: ") " "
4032 (p "[pulsed value]: ") " "
4033 (p "[delay]: ") " "
4034 (p "[rise time]: ") " "
4035 (p "[fall time]: ") " "
4036 (p "[pulse duration]: ") " "
4037 (p "[period]: ")
4038 ")"'n)
4039 "PU"
4040 "template for inserting an Pulse waveform"
4041 'spice-tempo-tags)
4043 (tempo-define-template
4044 "spice-sine"
4045 '("sin("
4046 (p "[Offset]: ") " "
4047 (p "[Amplitude]: ") " "
4048 (p "[Frequency]: ") " "
4049 (p "[Delay]: ") " "
4050 (p "[Damping factor]: ")
4051 (p "[Phase delay]: ") '(just-one-space)
4052 ")"'n)
4053 "sin"
4054 "template for inserting a Sine function"
4055 'spice-tempo-tags)
4057 (tempo-define-template
4058 "spice-exp"
4059 '("exp("
4060 (p "[start value]: ") " "
4061 (p "[target value]: ") " "
4062 (p "[rise delay]: ") " "
4063 (p "[tau1]: ") " "
4064 (p "[fall delay]: ") " "
4065 (p "[tau2]: ")
4066 ")"'n)
4067 "exp"
4068 "template for inserting an EXP waveform"
4069 'spice-tempo-tags)
4071 ;;(tempo-define-template
4072 ;; "spice-pwl"
4073 ;; '("pwl("
4074 ;; (p "[start time]: ") " "
4075 ;; (p "[start value]: ") " "
4076 ;; ")"'n)
4077 ;; "pwl"
4078 ;; "template for inserting an PWL waveform")
4080 (load "skeleton")
4081 (define-skeleton spice-pwl
4082 "Skeleton for Piece Wise Linear waveform"
4083 "Time/value doublet: "
4084 "pwl(" str
4085 ( "Next doublet: (%s) "
4086 " "str )
4087 resume:
4089 'spice-tempo-tags)
4092 (tempo-define-template
4093 "hspice-sffm"
4094 '("sffm("
4095 (p "[offset value]: ") " "
4096 (p "[amplitude value]: ") " "
4097 (p "[carrier frequency]: ") " "
4098 (p "[modulation index]: ") " "
4099 (p "[signal frequency]: ")
4100 ")"'n)
4101 "sffm"
4102 "template for inserting an HSPICE SFFM waveform"
4103 'spice-tempo-tags)
4105 (tempo-define-template
4106 "hspice-am"
4107 '("am("
4108 (p "[signal amplitude]: ") " "
4109 (p "[offset constant]: ") " "
4110 (p "[modulation frequency]: ") " "
4111 (p "[carrier frequency]: ") " "
4112 (p "[delay time]: ")
4113 ")"'n)
4114 "am"
4115 "template for inserting an HSPICE AM waveform"
4116 'spice-tempo-tags)
4118 (tempo-define-template
4119 "spice-ac"
4120 '("ac("
4121 (p "[magnitude]: ") " "
4122 (p "[phase]: ")
4123 ")"'n)
4124 "ac"
4125 "template for inserting an AC waveform"
4126 'spice-tempo-tags)
4128 (tempo-define-template
4129 "spice-eldo-pattern"
4130 '("pattern "
4131 (p "[Vhi]: ") " "
4132 (p "[Vlo]: ") " "
4133 (p "[delay]: ") " "
4134 (p "[rise time]: ") " "
4135 (p "[fall time]: ") " "
4136 (p "[Bit duration]: ") " "
4137 (p "[Bits]: ")
4139 "eldo-pattern"
4140 "template for inserting an ELDO Pattern function"
4141 'spice-tempo-tags)
4143 (tempo-define-template
4144 "spice-eldo-noise"
4145 '("noise("
4146 (p "[White noise level]: ") " "
4147 (p "[Flicker noise level]: ") " "
4148 (p "[Alpha]: ") " "
4149 (p "[Cut-off freq]: ") " "
4150 (p "[Filter order]: ")
4151 ")"'n)
4152 "noise"
4153 "template for inserting an ELDO NOISE waveform"
4154 'spice-tempo-tags)
4156 (tempo-define-template
4157 "spice-eldorf-fpulse"
4158 '("fpulse("
4159 (p "[initial value]: ") " "
4160 (p "[pulse value]: ") " "
4161 (p "[delay time]: ") " "
4162 (p "[rise time]: ") " "
4163 (p "[fall time]: ") " "
4164 (p "[pulse duration]: ") " "
4165 (p "[FUND1|FUND2|FUND3 (of .sst)]: ")
4166 ")"'n)
4167 "eldorf-fpulse"
4168 "template for inserting an Eldo-RF fpulse waveform"
4169 'spice-tempo-tags)
4171 (tempo-define-template
4172 "spice-eldorf-four"
4173 '("four" '(just-one-space)
4174 (p "[FUND1]: ")
4175 (p "<FUND2>: " fund2 'noinsert)
4176 (if (string-equal (tempo-lookup-named 'fund2) "")
4178 (list 'l " " '(s fund2) '(p "<FUND3>: " fund3 'noinsert)))
4179 (if (string-equal (tempo-lookup-named 'fund3) "")
4181 (list 'l " " '(s fund3)))
4182 '(just-one-space)
4183 (p "[MA|RI|DB|PMA|PDB|PDBM]: ") '(just-one-space)
4185 (p "[int_val1]: ")
4186 (p "<int_val2>: " int_val2 'noinsert)
4187 (if (string-equal (tempo-lookup-named 'int_val2) "")
4189 (list 'l "," '(s int_val2) '(p "<int_val3>: " int_val3 'noinsert)))
4190 (if (string-equal (tempo-lookup-named 'int_val3) "")
4192 (list 'l "," '(s int_val3)))
4193 ")" '(just-one-space)
4194 (p "[real_val1]: ") '(just-one-space)
4195 (p "[real_val2]: ") '(just-one-space)
4197 "eldorf-four"
4198 "template for inserting an Eldo-RF Fpulse waveform"
4199 'spice-tempo-tags)
4201 ;; Eldo Extracts
4203 (tempo-define-template
4204 "spice-eldo-phmag"
4205 '(".EXTRACT AC label=\"Phase margin\" xycond(vp("
4206 (p "[Node]: " lname)
4207 "),vdb(" (s lname) ")<0.0)+180 "
4209 "phmag"
4210 "template for extracting the phase margin"
4211 'spice-tempo-tags)
4213 (tempo-define-template
4214 "spice-eldo-gmag"
4215 '(".EXTRACT AC label=\"Gain margin\" -xycond(vdb("
4216 (p "[Node]: " lname)
4217 "),vp(" (s lname) ")<-180) "
4219 "gmag"
4220 "template for extracting the gain margin"
4221 'spice-tempo-tags)
4223 (tempo-define-template
4224 "spice-eldo-fc"
4225 '(".EXTRACT AC label=\"Cut freq\" xdown(vdb("
4226 (p "[Node]: " lname)
4227 "),yval(vdb(" (s lname) "),1)-3) "
4229 "fc"
4230 "template for extracting the cut frequency"
4231 'spice-tempo-tags)
4233 (tempo-define-template
4234 "spice-eldo-ugfc"
4235 '(".EXTRACT AC label=\"Unity gain freq\" xdown(vdb("
4236 (p "[Node]: " lname)
4237 "),0) "
4239 "ugfc"
4240 "template for extracting the unity gain frequency"
4241 'spice-tempo-tags)
4243 (tempo-define-template
4244 "spice-eldo-period"
4245 '(".EXTRACT TRAN xdown(v("
4246 (p "[Node]: " lname)
4247 "),"
4248 (p "[threshold]: " vth)
4250 (p "[estimation time]: " t)
4251 ",end)"
4252 "-xdown(v(" (s lname) "),"(s vth) ","(s t) ",start) !period"
4254 "period"
4255 "template for extracting the period of a signal"
4256 'spice-tempo-tags)
4258 (tempo-define-template
4259 "spice-eldo-period-macro"
4260 '(".DEFMAC period(a,th,time)=xdown(a,th,time,end)"
4261 "-xdown(a,th,time,start)"
4263 "period"
4264 "macro for extracting the period of signal a"
4265 'spice-tempo-tags)
4267 (tempo-define-template
4268 "spice-eldo-duty-macro"
4269 '(".DEFMAC duty_cycle(a,th,time)=(xdown(a,th,time,end)"
4270 "-xup(a,th,time,end))/(xdown(a,th,time,end)-xdown(a,th,time,start))*100"
4272 "duty"
4273 "macro for extracting the duty cycle of signal a"
4274 'spice-tempo-tags)
4276 (tempo-define-template
4277 "spice-eldo-settling-macro"
4278 '(".DEFMAC settling(xaxis,a,ratio,Tstart,Tfinal)=xycond(xaxis,(a>(yval(a,Tfinal)*(1+ratio)))"
4279 " || (a<(yval(a,Tfinal)*(1-ratio))),Tfinal,Tstart) - Tstart"
4281 "settling"
4282 "macro for extracting the settling cycle of signal A, within ±ratio of value of A at time Tfinal"
4283 'spice-tempo-tags)
4286 ;; Eldo Macromodels
4288 (tempo-define-template
4289 "spice-eldo-comp"
4290 '("COMP"
4291 (p "[Instance name]: ") " "
4292 (p "[Positive input]: ") " "
4293 (p "[Negative input]: ") " "
4294 (p "[Output]: ") " "
4295 (p "[Model name]: ") " "
4296 (p "<Vhigh>: " vhi 'noinsert)
4297 (if (string-equal (tempo-lookup-named 'vhi) "")
4298 (list 'l "VHI=5.0") ;; default value
4299 (list 'l "VHI=" '(s vhi)))
4300 '(just-one-space)
4301 (p "<Vlow>: " vlo 'noinsert)
4302 (if (string-equal (tempo-lookup-named 'vlo) "")
4303 (list 'l "VLO=0.0") ;; default value
4304 (list 'l "VLO=" '(s vlo)))
4305 '(just-one-space)
4306 (p "<Input offset>: " voff 'noinsert)
4307 (if (string-equal (tempo-lookup-named 'voff) "")
4308 (list 'l "VOFF=0.0") ;; default value
4309 (list 'l "VOFF=" '(s voff)))
4310 '(just-one-space)
4311 (p "<Hysteresis voltage>: " vdef 'noinsert)
4312 (if (string-equal (tempo-lookup-named 'vdef) "")
4313 (list 'l "VDEF=0.0") ;; default value
4314 (list 'l "VDEF=" '(s vdef)))
4315 '(just-one-space)
4316 (p "<Commutation time>: " tcom 'noinsert)
4317 (if (string-equal (tempo-lookup-named 'tcom) "")
4318 (list 'l "TCOM=1ns") ;; default value
4319 (list 'l "TCOM=" '(s tcom)))
4320 '(just-one-space)
4321 (p "<Transit time>: " tpd 'noinsert)
4322 (if (string-equal (tempo-lookup-named 'tpd) "")
4323 (list 'l "TPD=0.0") ;; default value
4324 (list 'l "TPD=" '(s tpd)))
4325 '(just-one-space)
4327 "comp"
4328 "template for inserting an ELDO Single output comparator"
4329 'spice-tempo-tags)
4331 (tempo-define-template
4332 "spice-eldo-compd"
4333 '("COMPD"
4334 (p "[Instance name]: ") " "
4335 (p "[Positive input]: ") " "
4336 (p "[Negative input]: ") " "
4337 (p "[Positive Output]: ") " "
4338 (p "[Negative Output]: ") " "
4339 (p "[Model name]: ") " "
4340 (p "<Vhigh>: " vhi 'noinsert)
4341 (if (string-equal (tempo-lookup-named 'vhi) "")
4342 (list 'l "VHI=5.0") ;; default value
4343 (list 'l "VHI=" '(s vhi)))
4344 '(just-one-space)
4345 (p "<Vlow>: " vlo 'noinsert)
4346 (if (string-equal (tempo-lookup-named 'vlo) "")
4347 (list 'l "VLO=0.0") ;; default value
4348 (list 'l "VLO=" '(s vlo)))
4349 '(just-one-space)
4350 (p "<Input offset>: " voff 'noinsert)
4351 (if (string-equal (tempo-lookup-named 'voff) "")
4352 (list 'l "VOFF=0.0") ;; default value
4353 (list 'l "VOFF=" '(s voff)))
4354 '(just-one-space)
4355 (p "<Hysteresis voltage>: " vdef 'noinsert)
4356 (if (string-equal (tempo-lookup-named 'vdef) "")
4357 (list 'l "VDEF=0.0") ;; default value
4358 (list 'l "VDEF=" '(s vdef)))
4359 '(just-one-space)
4360 (p "<Commutation time>: " tcom 'noinsert)
4361 (if (string-equal (tempo-lookup-named 'tcom) "")
4362 (list 'l "TCOM=1ns") ;; default value
4363 (list 'l "TCOM=" '(s tcom)))
4364 '(just-one-space)
4365 (p "<Transit time>: " tpd 'noinsert)
4366 (if (string-equal (tempo-lookup-named 'tpd) "")
4367 (list 'l "TPD=0.0") ;; default value
4368 (list 'l "TPD=" '(s tpd)))
4369 '(just-one-space)
4371 "compd"
4372 "template for inserting an ELDO Differential output comparator"
4373 'spice-tempo-tags)
4375 (tempo-define-template
4376 "spice-eldo-linear-opa0"
4377 '("Y"
4378 (p "[Instance name]: ") " OPAMP0 "
4379 (p "[Positive input]: ") " "
4380 (p "[Negative input]: ") " "
4381 (p "[Output]: ") " "
4382 (p "[Ground]: ") " param: "
4383 (p "<Gain>: " gain 'noinsert)
4384 (if (string-equal (tempo-lookup-named 'gain) "")
4385 (list 'l "GAIN=1e5") ;; default value
4386 (list 'l "GAIN=" '(s gain)))
4387 '(just-one-space)
4388 (p "<Input impedance>: " rin 'noinsert)
4389 (if (string-equal (tempo-lookup-named 'rin) "")
4390 (list 'l "RIN=1e7") ;; default value
4391 (list 'l "RIN=" '(s rin)))
4392 '(just-one-space)
4394 "opa0"
4395 "template for inserting an ELDO single output linear opamp"
4396 'spice-tempo-tags)
4398 (tempo-define-template
4399 "spice-eldo-linear-opa0d"
4400 '("Y"
4401 (p "[Instance name]: ") " OPAMP0D "
4402 (p "[Positive input]: ") " "
4403 (p "[Negative input]: ") " "
4404 (p "[Positive Output]: ") " "
4405 (p "[Negative Output]: ") " "
4406 (p "[Ground]: ") " param: "
4407 (p "<Gain>: " gain 'noinsert)
4408 (if (string-equal (tempo-lookup-named 'gain) "")
4409 (list 'l "GAIN=1e5") ;; default value
4410 (list 'l "GAIN=" '(s gain)))
4411 '(just-one-space)
4412 (p "<Input impedance>: " rin 'noinsert)
4413 (if (string-equal (tempo-lookup-named 'rin) "")
4414 (list 'l "RIN=1e7") ;; default value
4415 (list 'l "RIN=" '(s rin)))
4416 '(just-one-space)
4418 "opa0d"
4419 "template for inserting an ELDO differential output linear opamp"
4420 'spice-tempo-tags)
4423 (tempo-define-template
4424 "spice-eldo-linear-opa1"
4425 '("Y"
4426 (p "[Instance name]: ") " OPAMP1 "
4427 (p "[Positive input]: ") " "
4428 (p "[Negative input]: ") " "
4429 (p "[Output]: ") " "
4430 (p "[Ground]: ") " param: "
4431 (p "<Gain>: " gain 'noinsert)
4432 (if (string-equal (tempo-lookup-named 'gain) "")
4433 (list 'l "GAIN=1e5") ;; default value
4434 (list 'l "GAIN=" '(s gain)))
4435 '(just-one-space)
4436 (p "<Input offset>: " voff 'noinsert)
4437 (if (string-equal (tempo-lookup-named 'voff) "")
4438 (list 'l "VOFF=0.0") ;; default value
4439 (list 'l "VOFF=" '(s voff)))
4440 '(just-one-space)
4441 (p "<Dominant pole>: " p1 'noinsert)
4442 (if (string-equal (tempo-lookup-named 'p1) "")
4443 (list 'l "P1=100") ;; default value
4444 (list 'l "P1=" '(s p1)))
4445 '(just-one-space)
4446 (p "<Input impedance>: " rin 'noinsert)
4447 (if (string-equal (tempo-lookup-named 'rin) "")
4448 (list 'l "RIN=1e7") ;; default value
4449 (list 'l "RIN=" '(s rin)))
4450 '(just-one-space)
4452 "opa1"
4453 "template for inserting an ELDO single output 1-pole linear opamp"
4454 'spice-tempo-tags)
4456 (tempo-define-template
4457 "spice-eldo-linear-opa1d"
4458 '("Y"
4459 (p "[Instance name]: ") " OPAMP1D "
4460 (p "[Positive input]: ") " "
4461 (p "[Negative input]: ") " "
4462 (p "[Positive Output]: ") " "
4463 (p "[Negative Output]: ") " "
4464 (p "[Ground]: ") " param: "
4465 (p "<Gain>: " gain 'noinsert)
4466 (if (string-equal (tempo-lookup-named 'gain) "")
4467 (list 'l "GAIN=1e5") ;; default value
4468 (list 'l "GAIN=" '(s gain)))
4469 '(just-one-space)
4470 (p "<Input offset>: " voff 'noinsert)
4471 (if (string-equal (tempo-lookup-named 'voff) "")
4472 (list 'l "VOFF=0.0") ;; default value
4473 (list 'l "VOFF=" '(s voff)))
4474 '(just-one-space)
4475 (p "<Dominant pole>: " p1 'noinsert)
4476 (if (string-equal (tempo-lookup-named 'p1) "")
4477 (list 'l "P1=100") ;; default value
4478 (list 'l "P1=" '(s p1)))
4479 '(just-one-space)
4480 (p "<Input impedance>: " rin 'noinsert)
4481 (if (string-equal (tempo-lookup-named 'rin) "")
4482 (list 'l "RIN=1e7") ;; default value
4483 (list 'l "RIN=" '(s rin)))
4484 '(just-one-space)
4485 (p "<Common mode rejection ratio>: " cmrr 'noinsert)
4486 (if (string-equal (tempo-lookup-named 'cmrr) "")
4487 (list 'l "CMRR=0.0") ;; default value
4488 (list 'l "CMRR=" '(s cmrr)))
4489 '(just-one-space)
4491 "opa1d"
4492 "template for inserting an ELDO differential output 1-pole linear opamp"
4493 'spice-tempo-tags)
4495 (tempo-define-template
4496 "spice-eldo-linear-opa2"
4497 '("Y"
4498 (p "[Instance name]: ") " OPAMP2 "
4499 (p "[Positive input]: ") " "
4500 (p "[Negative input]: ") " "
4501 (p "[Output]: ") " "
4502 (p "[Ground]: ") " param: "
4503 (p "<Gain>: " gain 'noinsert)
4504 (if (string-equal (tempo-lookup-named 'gain) "")
4505 (list 'l "GAIN=1e5") ;; default value
4506 (list 'l "GAIN=" '(s gain)))
4507 '(just-one-space)
4508 (p "<Input offset>: " voff 'noinsert)
4509 (if (string-equal (tempo-lookup-named 'voff) "")
4510 (list 'l "VOFF=0.0") ;; default value
4511 (list 'l "VOFF=" '(s voff)))
4512 '(just-one-space)
4513 (p "<Dominant pole>: " p1 'noinsert)
4514 (if (string-equal (tempo-lookup-named 'p1) "")
4515 (list 'l "P1=100") ;; default value
4516 (list 'l "P1=" '(s p1)))
4517 '(just-one-space)
4518 (p "<Non-dominant pole>: " p2 'noinsert)
4519 (if (string-equal (tempo-lookup-named 'p2) "")
4520 (list 'l "P2=1e6") ;; default value
4521 (list 'l "P2=" '(s p2)))
4522 '(just-one-space)
4523 (p "<Input impedance>: " rin 'noinsert)
4524 (if (string-equal (tempo-lookup-named 'rin) "")
4525 (list 'l "RIN=1e7") ;; default value
4526 (list 'l "RIN=" '(s rin)))
4527 '(just-one-space)
4529 "opa2"
4530 "template for inserting an ELDO single output 2-pole linear opamp"
4531 'spice-tempo-tags)
4533 (tempo-define-template
4534 "spice-eldo-linear-opa2d"
4535 '("Y"
4536 (p "[Instance name]: ") " OPAMP2D "
4537 (p "[Positive input]: ") " "
4538 (p "[Negative input]: ") " "
4539 (p "[Positive Output]: ") " "
4540 (p "[Negative Output]: ") " "
4541 (p "[Ground]: ") " param: "
4542 (p "<Gain>: " gain 'noinsert)
4543 (if (string-equal (tempo-lookup-named 'gain) "")
4544 (list 'l "GAIN=1e5") ;; default value
4545 (list 'l "GAIN=" '(s gain)))
4546 '(just-one-space)
4547 (p "<Input offset>: " voff 'noinsert)
4548 (if (string-equal (tempo-lookup-named 'voff) "")
4549 (list 'l "VOFF=0.0") ;; default value
4550 (list 'l "VOFF=" '(s voff)))
4551 '(just-one-space)
4552 (p "<Dominant pole>: " p1 'noinsert)
4553 (if (string-equal (tempo-lookup-named 'p1) "")
4554 (list 'l "P1=100") ;; default value
4555 (list 'l "P1=" '(s p1)))
4556 '(just-one-space)
4557 (p "<Non-dominant pole>: " p2 'noinsert)
4558 (if (string-equal (tempo-lookup-named 'p2) "")
4559 (list 'l "P2=1e6") ;; default value
4560 (list 'l "P2=" '(s p2)))
4561 '(just-one-space)
4562 (p "<Input impedance>: " rin 'noinsert)
4563 (if (string-equal (tempo-lookup-named 'rin) "")
4564 (list 'l "RIN=1e7") ;; default value
4565 (list 'l "RIN=" '(s rin)))
4566 '(just-one-space)
4567 (p "<Common mode rejection ratio>: " cmrr 'noinsert)
4568 (if (string-equal (tempo-lookup-named 'cmrr) "")
4569 (list 'l "CMRR=0.0") ;; default value
4570 (list 'l "CMRR=" '(s cmrr)))
4571 '(just-one-space)
4573 "opa2d"
4574 "template for inserting an ELDO differential output 2-pole linear opamp"
4575 'spice-tempo-tags)
4578 (tempo-define-template
4579 "spice-eldo-delay"
4580 '("DEL"
4581 (p "[Instance name]: ") " "
4582 (p "[Input]: ") " "
4583 (p "[Output]: ") " "
4584 (p "[Delay value]: ") " "
4586 "del"
4587 "template for inserting an ELDO delay"
4588 'spice-tempo-tags)
4590 (tempo-define-template
4591 "spice-eldo-satr"
4592 '("Y"
4593 (p "[Instance name]: ") " SATR "
4594 (p "[Input]: ") " "
4595 (p "[Output]: ") " param: "
4596 (p "<Value of resistance>: " r 'noinsert)
4597 (if (string-equal (tempo-lookup-named 'r) "")
4598 (list 'l "R=1") ;; default value
4599 (list 'l "R=" '(s r)))
4600 '(just-one-space)
4601 (p "<Max current>: " imax 'noinsert)
4602 (if (string-equal (tempo-lookup-named 'imax) "")
4603 (list 'l "IMAX=1") ;; default value
4604 (list 'l "IMAX=" '(s imax)))
4605 '(just-one-space)
4606 (p "<Slew rate(V/µs)>: " sr 'noinsert)
4607 (if (string-equal (tempo-lookup-named 'sr) "")
4608 (list 'l "SR=0") ;; default value
4609 (list 'l "SR=" '(s sr)))
4610 '(just-one-space)
4611 (p "<Dominant pole>: " p1 'noinsert)
4612 (if (string-equal (tempo-lookup-named 'p1) "")
4613 (list 'l "P1=1e6") ;; default value
4614 (list 'l "P1=" '(s p1)))
4615 '(just-one-space)
4616 (p "<resistance of low-pass filter>: " r1 'noinsert)
4617 (if (string-equal (tempo-lookup-named 'r1) "")
4618 (list 'l "R1=30") ;; default value
4619 (list 'l "R1=" '(s r1)))
4621 "satr"
4622 "template for inserting an ELDO saturating resistor"
4623 'spice-tempo-tags)
4625 (tempo-define-template
4626 "spice-eldo-satv"
4627 '("Y"
4628 (p "[Instance name]: ") " SATV "
4629 (p "[Positive input]: ") " "
4630 (p "[Negative input]: ") " "
4631 (p "[Positive Output]: ") " "
4632 (p "[Negative Output]: ") " param: "
4633 (p "<VMax>: " vmax 'noinsert)
4634 (if (string-equal (tempo-lookup-named 'vmax) "")
4635 (list 'l "VMAX=5.0") ;; default value
4636 (list 'l "VMAX=" '(s vmax)))
4637 '(just-one-space)
4638 (p "<VMin>: " vmin 'noinsert)
4639 (if (string-equal (tempo-lookup-named 'vmin) "")
4640 (list 'l "VMIN=-5.0") ;; default value
4641 (list 'l "VMIN=" '(s vmin)))
4642 '(just-one-space)
4643 (p "<Positive saturation voltage>: " vsatp 'noinsert)
4644 (if (string-equal (tempo-lookup-named 'vsatp) "")
4645 (list 'l "VSATP=4.75") ;; default value
4646 (list 'l "VSATP=" '(s vsatp)))
4647 '(just-one-space)
4648 (p "<Negative saturation voltage>: " vsatn 'noinsert)
4649 (if (string-equal (tempo-lookup-named 'vsatn) "")
4650 (list 'l "VSATN=-4.75") ;; default value
4651 (list 'l "VSATN=" '(s vsatn)))
4652 '(just-one-space)
4653 (p "<Slope at VSATP>: " pslope 'noinsert)
4654 (if (string-equal (tempo-lookup-named 'pslope) "")
4655 (list 'l "PSLOPE=0.25") ;; default value
4656 (list 'l "PSLOPE=" '(s pslope)))
4657 '(just-one-space)
4658 (p "<Slope at VSATN>: " nslope 'noinsert)
4659 (if (string-equal (tempo-lookup-named 'nslope) "")
4660 (list 'l "NSLOPE=0.25") ;; default value
4661 (list 'l "NSLOPE=" '(s nslope)))
4663 "satv"
4664 "template for inserting an ELDO voltage limitor"
4665 'spice-tempo-tags)
4667 (tempo-define-template
4668 "spice-eldo-vswitch"
4669 '("Y"
4670 (p "[Instance name]: ") " VSWITCH "
4671 (p "[Input]: ") " "
4672 (p "[Output]: ") " "
4673 (p "[Positive controlling node]: ") " "
4674 (p "[Negative controlling node]: ") " param: "
4675 (p "<Level (1/2)>: " level 'noinsert)
4676 (if (string-equal (tempo-lookup-named 'level) "")
4677 (list 'l "LEVEL=1") ;; default value
4678 (list 'l "LEVEL=2" ))
4679 '(just-one-space)
4680 (p "<Voltage for 'ON' state>: " von 'noinsert)
4681 (if (string-equal (tempo-lookup-named 'von) "")
4682 (list 'l "VON=0.95") ;; default value
4683 (list 'l "VON=" '(s von)))
4684 '(just-one-space)
4685 (p "<Voltage for 'OFF' state>: " voff 'noinsert)
4686 (if (string-equal (tempo-lookup-named 'voff) "")
4687 (list 'l "VOFF=0.05") ;; default value
4688 (list 'l "VOFF=" '(s voff)))
4689 '(just-one-space)
4690 (p "<RON resistance>: " ron 'noinsert)
4691 (if (string-equal (tempo-lookup-named 'ron) "")
4692 (list 'l "RON=1e-2") ;; default value
4693 (list 'l "RON=" '(s ron)))
4694 '(just-one-space)
4695 (p "<ROFF resistance>: " roff 'noinsert)
4696 (if (string-equal (tempo-lookup-named 'roff) "")
4697 (list 'l "ROFF=1e10") ;; default value
4698 (list 'l "ROFF=" '(s roff)))
4700 "vswitch"
4701 "template for inserting an ELDO voltage controled switch"
4702 'spice-tempo-tags)
4704 (tempo-define-template
4705 "spice-eldo-cswitch"
4706 '("Y"
4707 (p "[Instance name]: ") " CSWITCH "
4708 (p "[Input]: ") " "
4709 (p "[Output]: ") " IC: "
4710 (p "[Controlling current]: ") " param: "
4711 (p "<Level (1/2)>: " level 'noinsert)
4712 (if (string-equal (tempo-lookup-named 'level) "")
4713 (list 'l "LEVEL=1") ;; default value
4714 (list 'l "LEVEL=2" ))
4715 '(just-one-space)
4716 (p "<Current for 'ON' state>: " ion 'noinsert)
4717 (if (string-equal (tempo-lookup-named 'ion) "")
4718 (list 'l "ION=0.95") ;; default value
4719 (list 'l "ION=" '(s ion)))
4720 '(just-one-space)
4721 (p "<Current for 'OFF' state>: " ioff 'noinsert)
4722 (if (string-equal (tempo-lookup-named 'ioff) "")
4723 (list 'l "IOFF=0.05") ;; default value
4724 (list 'l "IOFF=" '(s ioff)))
4725 '(just-one-space)
4726 (p "<RON resistance>: " ron 'noinsert)
4727 (if (string-equal (tempo-lookup-named 'ron) "")
4728 (list 'l "RON=1e-2") ;; default value
4729 (list 'l "RON=" '(s ron)))
4730 '(just-one-space)
4731 (p "<ROFF resistance>: " roff 'noinsert)
4732 (if (string-equal (tempo-lookup-named 'roff) "")
4733 (list 'l "ROFF=1e10") ;; default value
4734 (list 'l "ROFF=" '(s roff)))
4736 "cswitch"
4737 "template for inserting an ELDO current controled switch"
4738 'spice-tempo-tags)
4740 (tempo-define-template
4741 "spice-eldo-tri2sin"
4742 '("Y"
4743 (p "[Instance name]: ") " TRI2SIN "
4744 (p "[Positive input]: ") " "
4745 (p "[Negative input]: ") " "
4746 (p "[Positive output]: ") " "
4747 (p "[Negative output]: ") " param: "
4748 (p "<Level (1/2)>: " level 'noinsert)
4749 (if (string-equal (tempo-lookup-named 'level) "")
4750 (list 'l "LEVEL=1") ;; default value
4751 (list 'l "LEVEL=" '(s level)))
4752 '(just-one-space)
4753 (p "<Gain>: " gain 'noinsert)
4754 (if (string-equal (tempo-lookup-named 'gain) "")
4755 (list 'l "GAIN=1e5") ;; default value
4756 (list 'l "GAIN=" '(s gain)))
4757 '(just-one-space)
4758 (p "<Input offset>: " voff 'noinsert)
4759 (if (string-equal (tempo-lookup-named 'voff) "")
4760 (list 'l "VOFF=0.0") ;; default value
4761 (list 'l "VOFF=" '(s voff)))
4762 '(just-one-space)
4763 (p "<Upper input voltage limit >: " vu 'noinsert)
4764 (if (string-equal (tempo-lookup-named 'vu) "")
4765 (list 'l "VU=1") ;; default value
4766 (list 'l "VU=" '(s vu)))
4767 '(just-one-space)
4768 (p "<Lower input voltage limit >: " vl 'noinsert)
4769 (if (string-equal (tempo-lookup-named 'vl) "")
4770 (list 'l "VL=1") ;; default value
4771 (list 'l "VL=" '(s vl)))
4773 "tri2sin"
4774 "template for inserting an ELDO triangular to sine wave converter"
4775 'spice-tempo-tags)
4777 (tempo-define-template
4778 "spice-eldo-stairgen"
4779 '("Y"
4780 (p "[Instance name]: ") " STAIRGEN "
4781 (p "[Positive input]: ") " "
4782 (p "[Negative input]: ") " param: "
4783 (p "<Start voltage>: " vstart 'noinsert)
4784 (if (string-equal (tempo-lookup-named 'vstart) "")
4785 (list 'l "VSTART=0.0") ;; default value
4786 (list 'l "VSTART=" '(s vstart)))
4787 '(just-one-space)
4788 (p "<Step voltage>: " vdelta 'noinsert)
4789 (if (string-equal (tempo-lookup-named 'vdelta) "")
4790 (list 'l "VDELTA=0.1") ;; default value
4791 (list 'l "VDELTA=" '(s vdelta)))
4792 '(just-one-space)
4793 (p "<Number of steps>: " nstep 'noinsert)
4794 (if (string-equal (tempo-lookup-named 'nstep) "")
4795 (list 'l "NSTEP=10") ;; default value
4796 (list 'l "NSTEP=" '(s nstep)))
4797 '(just-one-space)
4798 (p "<Period>: " tdu 'noinsert)
4799 (if (string-equal (tempo-lookup-named 'tdu) "")
4800 (list 'l "TDU=1e-4") ;; default value
4801 (list 'l "TDU=" '(s tdu)))
4802 '(just-one-space)
4803 (p "<Slew rate (V/µs)>: " slr 'noinsert)
4804 (if (string-equal (tempo-lookup-named 'slr) "")
4805 (list 'l "SLR=1") ;; default value
4806 (list 'l "SLR=" '(s slr)))
4808 "stairgen"
4809 "template for inserting an ELDO staircase waveform generator"
4810 'spice-tempo-tags)
4812 (tempo-define-template
4813 "spice-eldo-sawgen"
4814 '("Y"
4815 (p "[Instance name]: ") " SAWGEN "
4816 (p "[Positive input]: ") " "
4817 (p "[Negative input]: ") " param: "
4818 (p "<Start voltage>: " v0 'noinsert)
4819 (if (string-equal (tempo-lookup-named 'v0) "")
4820 (list 'l "V0=0.0") ;; default value
4821 (list 'l "V0=" '(s v0)))
4822 '(just-one-space)
4823 (p "<Voltage magnitude>: " v1 'noinsert)
4824 (if (string-equal (tempo-lookup-named 'v1) "")
4825 (list 'l "V1=5.0") ;; default value
4826 (list 'l "V1=" '(s v1)))
4827 '(just-one-space)
4828 (p "<Period>: " tdu 'noinsert)
4829 (if (string-equal (tempo-lookup-named 'tdu) "")
4830 (list 'l "TDU=1e-4") ;; default value
4831 (list 'l "TDU=" '(s tdu)))
4832 '(just-one-space)
4833 (p "<Delay>: " tdel 'noinsert)
4834 (if (string-equal (tempo-lookup-named 'tdel) "")
4835 (list 'l "TDEL=0.0") ;; default value
4836 (list 'l "TDEL=" '(s tdel)))
4838 "sawgen"
4839 "template for inserting an ELDO sawtooth waveform generator"
4840 'spice-tempo-tags)
4842 (tempo-define-template
4843 "spice-eldo-trigen"
4844 '("Y"
4845 (p "[Instance name]: ") " TRIGEN "
4846 (p "[Positive input]: ") " "
4847 (p "[Negative input]: ") " param: "
4848 (p "<Start voltage>: " v0 'noinsert)
4849 (if (string-equal (tempo-lookup-named 'v0) "")
4850 (list 'l "V0=0.0") ;; default value
4851 (list 'l "V0=" '(s v0)))
4852 '(just-one-space)
4853 (p "<Voltage magnitude>: " v1 'noinsert)
4854 (if (string-equal (tempo-lookup-named 'v1) "")
4855 (list 'l "V1=5.0") ;; default value
4856 (list 'l "V1=" '(s v1)))
4857 '(just-one-space)
4858 (p "<First edge duration>: " rdu 'noinsert)
4859 (if (string-equal (tempo-lookup-named 'rdu) "")
4860 (list 'l "RDU=1e-4") ;; default value
4861 (list 'l "RDU=" '(s rdu)))
4862 '(just-one-space)
4863 (p "<Second edge duration>: " fdu 'noinsert)
4864 (if (string-equal (tempo-lookup-named 'fdu) "")
4865 (list 'l "FDU=1e-4") ;; default value
4866 (list 'l "FDU=" '(s fdu)))
4867 '(just-one-space)
4868 (p "<Delay>: " tdel 'noinsert)
4869 (if (string-equal (tempo-lookup-named 'tdel) "")
4870 (list 'l "TDEL=0.0") ;; default value
4871 (list 'l "TDEL=" '(s tdel)))
4873 "trigen"
4874 "template for inserting an ELDO triangular waveform generator"
4875 'spice-tempo-tags)
4877 (tempo-define-template
4878 "spice-eldo-amm"
4879 '("Y"
4880 (p "[Instance name]: ") " AMM "
4881 (p "[Positive input]: ") " "
4882 (p "[Negative input]: ") " "
4883 (p "[Positive Output]: ") " "
4884 (p "[Negative Output]: ") " param: "
4885 (p "<Level (1/2)>: " level 'noinsert)
4886 (if (string-equal (tempo-lookup-named 'level) "")
4887 (list 'l "LEVEL=1") ;; default value
4888 (list 'l "LEVEL=" '(s level)))
4889 '(just-one-space)
4890 (p "<Slewrate (V/µs)>: " slr 'noinsert)
4891 (if (string-equal (tempo-lookup-named 'slr) "")
4892 (list 'l "SLR=10") ;; default value
4893 (list 'l "SLR=" '(s slr)))
4894 '(just-one-space)
4895 (p "<Offset voltage>: " voff 'noinsert)
4896 (if (string-equal (tempo-lookup-named 'voff) "")
4897 (list 'l "VOFF=0.0") ;; default value
4898 (list 'l "VOFF=" '(s voff)))
4899 '(just-one-space)
4900 (p "<Carrier frequency>: " fc 'noinsert)
4901 (if (string-equal (tempo-lookup-named 'fc) "")
4902 (list 'l "FC=1e6") ;; default value
4903 (list 'l "FC=" '(s fc)))
4904 '(just-one-space)
4905 (p "<Minimal number of sampling points per period>: " nsam 'noinsert)
4906 (if (string-equal (tempo-lookup-named 'nsam) "")
4907 (list 'l "NSAM=10") ;; default value
4908 (list 'l "NSAM=" '(s nsam)))
4910 "amm"
4911 "template for inserting an ELDO amplitude modulator"
4912 'spice-tempo-tags)
4914 (tempo-define-template
4915 "spice-eldo-pam"
4916 '("Y"
4917 (p "[Instance name]: ") " PAM "
4918 (p "[Positive input]: ") " "
4919 (p "[Negative input]: ") " "
4920 (p "[Positive Output]: ") " "
4921 (p "[Negative Output]: ") " param: "
4922 (p "<Level (1/2)>: " level 'noinsert)
4923 (if (string-equal (tempo-lookup-named 'level) "")
4924 (list 'l "LEVEL=1") ;; default value
4925 (list 'l "LEVEL=" '(s level)))
4926 '(just-one-space)
4927 (p "<Slewrate (V/µs)>: " slr 'noinsert)
4928 (if (string-equal (tempo-lookup-named 'slr) "")
4929 (list 'l "SLR=10") ;; default value
4930 (list 'l "SLR=" '(s slr)))
4931 '(just-one-space)
4932 (p "<Offset voltage>: " voff 'noinsert)
4933 (if (string-equal (tempo-lookup-named 'voff) "")
4934 (list 'l "VOFF=0.0") ;; default value
4935 (list 'l "VOFF=" '(s voff)))
4936 '(just-one-space)
4937 (p "<Carrier frequency>: " fc 'noinsert)
4938 (if (string-equal (tempo-lookup-named 'fc) "")
4939 (list 'l "FC=1e6") ;; default value
4940 (list 'l "FC=" '(s fc)))
4941 '(just-one-space)
4942 (p "<Minimal number of sampling points per period>: " nsam 'noinsert)
4943 (if (string-equal (tempo-lookup-named 'nsam) "")
4944 (list 'l "NSAM=10") ;; default value
4945 (list 'l "NSAM=" '(s nsam)))
4947 "pam"
4948 "template for inserting an ELDO pulse amplitude modulator"
4949 'spice-tempo-tags)
4952 (tempo-define-template
4953 "spice-eldo-saho"
4954 '("Y"
4955 (p "[Instance name]: ") " SA_HO "
4956 (p "[Positive input]: ") " "
4957 (p "[Negative input]: ") " "
4958 (p "[Positive Output]: ") " "
4959 (p "[Negative Output]: ") " param: "
4960 (p "<Sampling frequency>: " fs 'noinsert)
4961 (if (string-equal (tempo-lookup-named 'fs) "")
4962 (list 'l "FS=1e6") ;; default value
4963 (list 'l "FS=" '(s fs)))
4964 '(just-one-space)
4965 (p "<Acquisition time>: " tacq 'noinsert)
4966 (if (string-equal (tempo-lookup-named 'tacq) "")
4967 (list 'l "TACQ=1e-9") ;; default value
4968 (list 'l "TACQ=" '(s tacq)))
4969 '(just-one-space)
4970 (p "<Droop voltage>: " dv 'noinsert)
4971 (if (string-equal (tempo-lookup-named 'dv) "")
4972 (list 'l "DV=20mv") ;; default value
4973 (list 'l "DV=" '(s dv)))
4974 '(just-one-space)
4976 "saho"
4977 "template for inserting an ELDO sample&hold"
4978 'spice-tempo-tags)
4980 (tempo-define-template
4981 "spice-eldo-trho"
4982 '("Y"
4983 (p "[Instance name]: ") " TR_HO "
4984 (p "[Positive input]: ") " "
4985 (p "[Negative input]: ") " "
4986 (p "[Positive Output]: ") " "
4987 (p "[Negative Output]: ") " "
4988 (p "[Controlling node]: ") " param: "
4989 (p "<Threshold voltage for CRT>: " vth 'noinsert)
4990 (if (string-equal (tempo-lookup-named 'vth) "")
4991 (list 'l "VTH=0.5") ;; default value
4992 (list 'l "VTH=" '(s vth)))
4993 '(just-one-space)
4994 (p "<Acquisition time>: " tacq 'noinsert)
4995 (if (string-equal (tempo-lookup-named 'tacq) "")
4996 (list 'l "TACQ=1e-9") ;; default value
4997 (list 'l "TACQ=" '(s tacq)))
4999 "trho"
5000 "template for inserting an ELDO track&hold"
5001 'spice-tempo-tags)
5004 (tempo-define-template
5005 "spice-eldo-peakd"
5006 '("Y"
5007 (p "[Instance name]: ") " PEAK_D "
5008 (p "[Positive input]: ") " "
5009 (p "[Negative input]: ") " "
5010 (p "[Positive Output]: ") " "
5011 (p "[Negative Output]: ") " "
5012 (p "[Controlling node]: ") " param: "
5013 (p "<Level (1/2)>: " level 'noinsert)
5014 (if (string-equal (tempo-lookup-named 'level) "")
5015 (list 'l "LEVEL=1") ;; default value
5016 (list 'l "LEVEL=2" ))
5017 '(just-one-space)
5018 (p "<Threshold voltage for CRT>: " vth 'noinsert)
5019 (if (string-equal (tempo-lookup-named 'vth) "")
5020 (list 'l "VTH=0.5") ;; default value
5021 (list 'l "VTH=" '(s vth)))
5022 '(just-one-space)
5023 (p "<Threshold voltage for reset on output>: " res 'noinsert)
5024 (if (string-equal (tempo-lookup-named 'res) "")
5025 (list 'l "RES=0.5") ;; default value
5026 (list 'l "RES=" '(s res)))
5027 '(just-one-space)
5028 (p "<Output slewrate (V/µs)>: " slr 'noinsert)
5029 (if (string-equal (tempo-lookup-named 'slr) "")
5030 (list 'l "SLR=1.0") ;; default value
5031 (list 'l "SLR=" '(s slr)))
5032 '(just-one-space)
5033 (p "<Output slewrate on reset>: " rslr 'noinsert)
5034 (if (string-equal (tempo-lookup-named 'rslr) "")
5035 (list 'l "RSLR=1.0") ;; default value
5036 (list 'l "RSLR=" '(s rslr)))
5038 "peakd"
5039 "template for inserting an ELDO peak detector"
5040 'spice-tempo-tags)
5043 (tempo-define-template
5044 "spice-eldo-levdso"
5045 '("Y"
5046 (p "[Instance name]: ") " LEV_D "
5047 (p "[Positive input]: ") " "
5048 (p "[Negative input]: ") " "
5049 (p "[Positive Output]: ") " "
5050 (p "[Negative Output]: ") " param: "
5051 (p "<Rise time (µs)>: " tr 'noinsert)
5052 (if (string-equal (tempo-lookup-named 'tr) "")
5053 (list 'l "TR=1.0") ;; default value
5054 (list 'l "TR=" '(s tr)))
5055 '(just-one-space)
5056 (p "<Fall time (µs)>: " tf 'noinsert)
5057 (if (string-equal (tempo-lookup-named 'tf) "")
5058 (list 'l "TF=1.0") ;; default value
5059 (list 'l "TF=" '(s tf)))
5060 '(just-one-space)
5061 (p "<Transit time (s)>: " tpd 'noinsert)
5062 (if (string-equal (tempo-lookup-named 'tpd) "")
5063 (list 'l "TPD=0.0") ;; default value
5064 (list 'l "TPD=" '(s tpd)))
5065 '(just-one-space)
5066 (p "<Lower voltage level>: " v0 'noinsert)
5067 (if (string-equal (tempo-lookup-named 'v0) "")
5068 (list 'l "V0=0.0") ;; default value
5069 (list 'l "V0=" '(s v0)))
5070 '(just-one-space)
5071 (p "<Higher voltage level>: " v1 'noinsert)
5072 (if (string-equal (tempo-lookup-named 'v1) "")
5073 (list 'l "V1=1.0") ;; default value
5074 (list 'l "V1=" '(s v1)))
5075 '(just-one-space)
5076 (p "<Input offset voltage>: " voff 'noinsert)
5077 (if (string-equal (tempo-lookup-named 'voff) "")
5078 (list 'l "VOFF=0.0") ;; default value
5079 (list 'l "VOFF=" '(s voff)))
5080 '(just-one-space)
5081 (p "<Lower reference voltage>: " vrl 'noinsert)
5082 (if (string-equal (tempo-lookup-named 'vrl) "")
5083 (list 'l "VRL=-0.1") ;; default value
5084 (list 'l "VRL=" '(s vrl)))
5085 '(just-one-space)
5086 (p "<Higher reference voltage>: " vru 'noinsert)
5087 (if (string-equal (tempo-lookup-named 'vru) "")
5088 (list 'l "VRU=0.1") ;; default value
5089 (list 'l "VRU=" '(s vru)))
5091 "levdso"
5092 "template for inserting an ELDO single-output level detector"
5093 'spice-tempo-tags)
5096 (tempo-define-template
5097 "spice-eldo-levddo"
5098 '("Y"
5099 (p "[Instance name]: ") " LEV_D "
5100 (p "[Positive input]: ") " "
5101 (p "[Negative input]: ") " "
5102 (p "[Positive Output]: ") " "
5103 (p "[Negative Output]: ") " "
5104 (p "[Reference node]: ") " param: "
5105 (p "<Rise time (µs)>: " tr 'noinsert)
5106 (if (string-equal (tempo-lookup-named 'tr) "")
5107 (list 'l "TR=1.0") ;; default value
5108 (list 'l "TR=" '(s tr)))
5109 '(just-one-space)
5110 (p "<Fall time (µs)>: " tf 'noinsert)
5111 (if (string-equal (tempo-lookup-named 'tf) "")
5112 (list 'l "TF=1.0") ;; default value
5113 (list 'l "TF=" '(s tf)))
5114 '(just-one-space)
5115 (p "<Transit time (s)>: " tpd 'noinsert)
5116 (if (string-equal (tempo-lookup-named 'tpd) "")
5117 (list 'l "TPD=0.0") ;; default value
5118 (list 'l "TPD=" '(s tpd)))
5119 '(just-one-space)
5120 (p "<Lower voltage level>: " v0 'noinsert)
5121 (if (string-equal (tempo-lookup-named 'v0) "")
5122 (list 'l "V0=0.0") ;; default value
5123 (list 'l "V0=" '(s v0)))
5124 '(just-one-space)
5125 (p "<Higher voltage level>: " v1 'noinsert)
5126 (if (string-equal (tempo-lookup-named 'v1) "")
5127 (list 'l "V1=1.0") ;; default value
5128 (list 'l "V1=" '(s v1)))
5129 '(just-one-space)
5130 (p "<Input offset voltage>: " voff 'noinsert)
5131 (if (string-equal (tempo-lookup-named 'voff) "")
5132 (list 'l "VOFF=0.0") ;; default value
5133 (list 'l "VOFF=" '(s voff)))
5134 '(just-one-space)
5135 (p "<Lower reference voltage>: " vrl 'noinsert)
5136 (if (string-equal (tempo-lookup-named 'vrl) "")
5137 (list 'l "VRL=-0.1") ;; default value
5138 (list 'l "VRL=" '(s vrl)))
5139 '(just-one-space)
5140 (p "<Higher reference voltage>: " vru 'noinsert)
5141 (if (string-equal (tempo-lookup-named 'vru) "")
5142 (list 'l "VRU=0.1") ;; default value
5143 (list 'l "VRU=" '(s vru)))
5145 "levddo"
5146 "template for inserting an ELDO differential-output level detector"
5147 'spice-tempo-tags)
5150 (tempo-define-template
5151 "spice-eldo-logamp"
5152 '("Y"
5153 (p "[Instance name]: ") " LOGAMP "
5154 (p "[Input]: ") " "
5155 (p "[Output]: ") " param: "
5156 (p "<Gain>: " gain 'noinsert)
5157 (if (string-equal (tempo-lookup-named 'gain) "")
5158 (list 'l "K=1.0") ;; default value
5159 (list 'l "K=" '(s gain)))
5160 '(just-one-space)
5161 (p "<Log function argument>: " e 'noinsert)
5162 (if (string-equal (tempo-lookup-named 'e) "")
5163 (list 'l "E=1") ;; default value
5164 (list 'l "E=" '(s vmin)))
5165 '(just-one-space)
5166 (p "<Vmax>: " vmax 'noinsert)
5167 (if (string-equal (tempo-lookup-named 'vmax) "")
5168 (list 'l "VMAX=5.0") ;; default value
5169 (list 'l "VMAX=" '(s vmax)))
5170 '(just-one-space)
5171 (p "<Vmin>: " vmin 'noinsert)
5172 (if (string-equal (tempo-lookup-named 'vmin) "")
5173 (list 'l "VMIN=-5.0") ;; default value
5174 (list 'l "VMIN=" '(s vmin)))
5175 '(just-one-space)
5176 (p "<Positive saturation voltage>: " vsatp 'noinsert)
5177 (if (string-equal (tempo-lookup-named 'vsatp) "")
5178 (list 'l "VSATP=4.75") ;; default value
5179 (list 'l "VSATP=" '(s vsatp)))
5180 '(just-one-space)
5181 (p "<Negative saturation voltage>: " vsatn 'noinsert)
5182 (if (string-equal (tempo-lookup-named 'vsatn) "")
5183 (list 'l "VSATN=-4.75") ;; default value
5184 (list 'l "VSATN=" '(s vsatn)))
5185 '(just-one-space)
5186 (p "<Slope at VSATP>: " pslope 'noinsert)
5187 (if (string-equal (tempo-lookup-named 'pslope) "")
5188 (list 'l "PSLOPE=0.25") ;; default value
5189 (list 'l "PSLOPE=" '(s pslope)))
5190 '(just-one-space)
5191 (p "<Slope at VSATN>: " nslope 'noinsert)
5192 (if (string-equal (tempo-lookup-named 'nslope) "")
5193 (list 'l "NSLOPE=0.25") ;; default value
5194 (list 'l "NSLOPE=" '(s nslope)))
5196 "logamp"
5197 "template for inserting an ELDO logarithmic amplifier"
5198 'spice-tempo-tags)
5200 (tempo-define-template
5201 "spice-eldo-antilog"
5202 '("Y"
5203 (p "[Instance name]: ") " EXPAMP "
5204 (p "[Input]: ") " "
5205 (p "[Output]: ") " param: "
5206 (p "<Gain>: " k 'noinsert)
5207 (if (string-equal (tempo-lookup-named 'k) "")
5208 (list 'l "K=1.0") ;; default value
5209 (list 'l "K=" '(s k)))
5210 '(just-one-space)
5211 (p "<Exp function argument>: " e 'noinsert)
5212 (if (string-equal (tempo-lookup-named 'e) "")
5213 (list 'l "E=1") ;; default value
5214 (list 'l "E=" '(s vmin)))
5215 '(just-one-space)
5216 (p "<Base of power function>: " base 'noinsert)
5217 (if (string-equal (tempo-lookup-named 'base) "")
5218 (list 'l "BASE={EXP(1)}") ;; default value
5219 (list 'l "BASE=" '(s base)))
5220 '(just-one-space)
5221 (p "<Vmax>: " vmax 'noinsert)
5222 (if (string-equal (tempo-lookup-named 'vmax) "")
5223 (list 'l "VMAX=5.0") ;; default value
5224 (list 'l "VMAX=" '(s vmax)))
5225 '(just-one-space)
5226 (p "<Vmin>: " vmin 'noinsert)
5227 (if (string-equal (tempo-lookup-named 'vmin) "")
5228 (list 'l "VMIN=-5.0") ;; default value
5229 (list 'l "VMIN=" '(s vmin)))
5230 '(just-one-space)
5231 (p "<Positive saturation voltage>: " vsatp 'noinsert)
5232 (if (string-equal (tempo-lookup-named 'vsatp) "")
5233 (list 'l "VSATP=4.75") ;; default value
5234 (list 'l "VSATP=" '(s vsatp)))
5235 '(just-one-space)
5236 (p "<Negative saturation voltage>: " vsatn 'noinsert)
5237 (if (string-equal (tempo-lookup-named 'vsatn) "")
5238 (list 'l "VSATN=-4.75") ;; default value
5239 (list 'l "VSATN=" '(s vsatn)))
5240 '(just-one-space)
5241 (p "<Slope at VSATP>: " pslope 'noinsert)
5242 (if (string-equal (tempo-lookup-named 'pslope) "")
5243 (list 'l "PSLOPE=0.25") ;; default value
5244 (list 'l "PSLOPE=" '(s pslope)))
5245 '(just-one-space)
5246 (p "<Slope at VSATN>: " nslope 'noinsert)
5247 (if (string-equal (tempo-lookup-named 'nslope) "")
5248 (list 'l "NSLOPE=0.25") ;; default value
5249 (list 'l "NSLOPE=" '(s nslope)))
5251 "expamp"
5252 "template for inserting an ELDO anti-logarithmic amplifier"
5253 'spice-tempo-tags)
5255 (tempo-define-template
5256 "spice-eldo-diff"
5257 '("Y"
5258 (p "[Instance name]: ") " DIFF "
5259 (p "[Input]: ") " "
5260 (p "[Output]: ") " param: "
5261 (p "<Time constant>: " k 'noinsert)
5262 (if (string-equal (tempo-lookup-named 'k) "")
5263 (list 'l "K=1") ;; default value
5264 (list 'l "K=" '(s k)))
5265 '(just-one-space)
5266 (p "<DC value>: " c0 'noinsert)
5267 (if (string-equal (tempo-lookup-named 'c0) "")
5268 (list 'l "C0=1") ;; default value
5269 (list 'l "C0=" '(s c0)))
5270 '(just-one-space)
5271 (p "<Slewrate (V/s)>: " slr 'noinsert)
5272 (if (string-equal (tempo-lookup-named 'slr) "")
5273 (list 'l "SLR=1e9") ;; default value
5274 (list 'l "SLR=" '(s slr)))
5276 "diff"
5277 "template for inserting an ELDO differentiator"
5278 'spice-tempo-tags)
5280 (tempo-define-template
5281 "spice-eldo-integ"
5282 '("Y"
5283 (p "[Instance name]: ") " INTEG "
5284 (p "[Input]: ") " "
5285 (p "[Output]: ") " param: "
5286 (p "<Time constant>: " k 'noinsert)
5287 (if (string-equal (tempo-lookup-named 'k) "")
5288 (list 'l "K=1") ;; default value
5289 (list 'l "K=" '(s k)))
5290 '(just-one-space)
5291 (p "<DC value>: " c0 'noinsert)
5292 (if (string-equal (tempo-lookup-named 'c0) "")
5293 (list 'l "C0=1") ;; default value
5294 (list 'l "C0=" '(s c0)))
5296 "integ"
5297 "template for inserting an ELDO integrator"
5298 'spice-tempo-tags)
5300 (tempo-define-template
5301 "spice-eldo-adder"
5302 '("Y"
5303 (p "[Instance name]: ") " "
5304 (p "<ADD/SUB/MULT/DIV>: ") " "
5305 (p "[Input 2]: ") " "
5306 (p "[Output]: ") " param: "
5307 (p "<Vmax>: " vmax 'noinsert)
5308 (if (string-equal (tempo-lookup-named 'vmax) "")
5309 (list 'l "VMAX=5.0") ;; default value
5310 (list 'l "VMAX=" '(s vmax)))
5311 '(just-one-space)
5312 (p "<Vmin>: " vmin 'noinsert)
5313 (if (string-equal (tempo-lookup-named 'vmin) "")
5314 (list 'l "VMIN=-5.0") ;; default value
5315 (list 'l "VMIN=" '(s vmin)))
5316 '(just-one-space)
5317 (p "<Positive saturation voltage>: " vsatp 'noinsert)
5318 (if (string-equal (tempo-lookup-named 'vsatp) "")
5319 (list 'l "VSATP=4.75") ;; default value
5320 (list 'l "VSATP=" '(s vsatp)))
5321 '(just-one-space)
5322 (p "<Negative saturation voltage>: " vsatn 'noinsert)
5323 (if (string-equal (tempo-lookup-named 'vsatn) "")
5324 (list 'l "VSATN=-4.75") ;; default value
5325 (list 'l "VSATN=" '(s vsatn)))
5326 '(just-one-space)
5327 (p "<Slope at VSATP>: " pslope 'noinsert)
5328 (if (string-equal (tempo-lookup-named 'pslope) "")
5329 (list 'l "PSLOPE=0.25") ;; default value
5330 (list 'l "PSLOPE=" '(s pslope)))
5331 '(just-one-space)
5332 (p "<Slope at VSATN>: " nslope 'noinsert)
5333 (if (string-equal (tempo-lookup-named 'nslope) "")
5334 (list 'l "NSLOPE=0.25") ;; default value
5335 (list 'l "NSLOPE=" '(s nslope)))
5337 "add"
5338 "template for inserting an ELDO adder/subtrator/multiplier/divider"
5339 'spice-tempo-tags)
5341 ;; -------------------
5342 ;; Digital Macromodels
5343 ;; -------------------
5345 (tempo-define-template
5346 "spice-eldo-inv"
5347 '("INV"
5348 (p "[Instance name]: ") " "
5349 (p "[First input]: ") " "
5350 (p "[Second input]: ") " "
5351 (p "[Output]: ") " "
5352 (p "[Model name]: ") " "
5353 (p "<Vhigh>: " vhi 'noinsert)
5354 (if (string-equal (tempo-lookup-named 'vhi) "")
5355 (list 'l "VHI=5.0") ;; default value
5356 (list 'l "VHI=" '(s vhi)))
5357 '(just-one-space)
5358 (p "<Vlow>: " vlo 'noinsert)
5359 (if (string-equal (tempo-lookup-named 'vlo) "")
5360 (list 'l "VLO=0.0") ;; default value
5361 (list 'l "VLO=" '(s vlo)))
5362 '(just-one-space)
5363 (p "<Threshold input voltage>: " vth 'noinsert)
5364 (if (string-equal (tempo-lookup-named 'vth) "")
5365 (list 'l "VTH=2.5") ;; default value
5366 (list 'l "VTH=" '(s vth)))
5367 '(just-one-space)
5368 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5369 (if (string-equal (tempo-lookup-named 'vthi) "")
5370 (list 'l "") ;; default value
5371 (list 'l "VTHI=" '(s vthi)))
5372 '(just-one-space)
5373 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5374 (if (string-equal (tempo-lookup-named 'vtlo) "")
5375 (list 'l "") ;; default value
5376 (list 'l "VTLO=" '(s vtlo)))
5377 '(just-one-space)
5378 (p "<Transit time>: " tpd 'noinsert)
5379 (if (string-equal (tempo-lookup-named 'tpd) "")
5380 (list 'l "TPD=1.0ns") ;; default value
5381 (list 'l "TPD=" '(s tpd)))
5382 '(just-one-space)
5383 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5384 (if (string-equal (tempo-lookup-named 'tpdup) "")
5385 (list 'l "") ;; default value
5386 (list 'l "TPDUP=" '(s tpdup)))
5387 '(just-one-space)
5388 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5389 (if (string-equal (tempo-lookup-named 'tpdown) "")
5390 (list 'l "") ;; default value
5391 (list 'l "TPDOWN=" '(s tpdown)))
5392 '(just-one-space)
5393 (p "<Input capacitance>: " cin 'noinsert)
5394 (if (string-equal (tempo-lookup-named 'cin) "")
5395 (list 'l "CIN=0.0") ;; default value
5396 (list 'l "CIN=" '(s cin)))
5397 '(just-one-space)
5399 "inv"
5400 "template for inserting an ELDO INVERTER gate macromodel"
5401 'spice-tempo-tags)
5403 (tempo-define-template
5404 "spice-eldo-xor"
5405 '("XOR"
5406 (p "[Instance name]: ") " "
5407 (p "[First input]: ") " "
5408 (p "[Second input]: ") " "
5409 (p "[Output]: ") " "
5410 (p "[Model name]: ") " "
5411 (p "<Vhigh>: " vhi 'noinsert)
5412 (if (string-equal (tempo-lookup-named 'vhi) "")
5413 (list 'l "VHI=5.0") ;; default value
5414 (list 'l "VHI=" '(s vhi)))
5415 '(just-one-space)
5416 (p "<Vlow>: " vlo 'noinsert)
5417 (if (string-equal (tempo-lookup-named 'vlo) "")
5418 (list 'l "VLO=0.0") ;; default value
5419 (list 'l "VLO=" '(s vlo)))
5420 '(just-one-space)
5421 (p "<Threshold input voltage>: " vth 'noinsert)
5422 (if (string-equal (tempo-lookup-named 'vth) "")
5423 (list 'l "VTH=2.5") ;; default value
5424 (list 'l "VTH=" '(s vth)))
5425 '(just-one-space)
5426 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5427 (if (string-equal (tempo-lookup-named 'vthi) "")
5428 (list 'l "") ;; default value
5429 (list 'l "VTHI=" '(s vthi)))
5430 '(just-one-space)
5431 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5432 (if (string-equal (tempo-lookup-named 'vtlo) "")
5433 (list 'l "") ;; default value
5434 (list 'l "VTLO=" '(s vtlo)))
5435 '(just-one-space)
5436 (p "<Transit time>: " tpd 'noinsert)
5437 (if (string-equal (tempo-lookup-named 'tpd) "")
5438 (list 'l "TPD=1.0ns") ;; default value
5439 (list 'l "TPD=" '(s tpd)))
5440 '(just-one-space)
5441 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5442 (if (string-equal (tempo-lookup-named 'tpdup) "")
5443 (list 'l "") ;; default value
5444 (list 'l "TPDUP=" '(s tpdup)))
5445 '(just-one-space)
5446 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5447 (if (string-equal (tempo-lookup-named 'tpdown) "")
5448 (list 'l "") ;; default value
5449 (list 'l "TPDOWN=" '(s tpdown)))
5450 '(just-one-space)
5451 (p "<Input capacitance>: " cin 'noinsert)
5452 (if (string-equal (tempo-lookup-named 'cin) "")
5453 (list 'l "CIN=0.0") ;; default value
5454 (list 'l "CIN=" '(s cin)))
5455 '(just-one-space)
5457 "xor"
5458 "template for inserting an ELDO Exclusive-OR gate macromodel"
5459 'spice-tempo-tags)
5461 (tempo-define-template
5462 "spice-eldo-and2"
5463 '("AND"
5464 (p "[Instance name]: ") " "
5465 (p "[First input]: ") " "
5466 (p "[Second input]: ") " "
5467 (p "[Output]: ") " "
5468 (p "[Model name]: ") " "
5469 (p "<Vhigh>: " vhi 'noinsert)
5470 (if (string-equal (tempo-lookup-named 'vhi) "")
5471 (list 'l "VHI=5.0") ;; default value
5472 (list 'l "VHI=" '(s vhi)))
5473 '(just-one-space)
5474 (p "<Vlow>: " vlo 'noinsert)
5475 (if (string-equal (tempo-lookup-named 'vlo) "")
5476 (list 'l "VLO=0.0") ;; default value
5477 (list 'l "VLO=" '(s vlo)))
5478 '(just-one-space)
5479 (p "<Threshold input voltage>: " vth 'noinsert)
5480 (if (string-equal (tempo-lookup-named 'vth) "")
5481 (list 'l "VTH=2.5") ;; default value
5482 (list 'l "VTH=" '(s vth)))
5483 '(just-one-space)
5484 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5485 (if (string-equal (tempo-lookup-named 'vthi) "")
5486 (list 'l "") ;; default value
5487 (list 'l "VTHI=" '(s vthi)))
5488 '(just-one-space)
5489 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5490 (if (string-equal (tempo-lookup-named 'vtlo) "")
5491 (list 'l "") ;; default value
5492 (list 'l "VTLO=" '(s vtlo)))
5493 '(just-one-space)
5494 (p "<Transit time>: " tpd 'noinsert)
5495 (if (string-equal (tempo-lookup-named 'tpd) "")
5496 (list 'l "TPD=1.0ns") ;; default value
5497 (list 'l "TPD=" '(s tpd)))
5498 '(just-one-space)
5499 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5500 (if (string-equal (tempo-lookup-named 'tpdup) "")
5501 (list 'l "") ;; default value
5502 (list 'l "TPDUP=" '(s tpdup)))
5503 '(just-one-space)
5504 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5505 (if (string-equal (tempo-lookup-named 'tpdown) "")
5506 (list 'l "") ;; default value
5507 (list 'l "TPDOWN=" '(s tpdown)))
5508 '(just-one-space)
5509 (p "<Input capacitance>: " cin 'noinsert)
5510 (if (string-equal (tempo-lookup-named 'cin) "")
5511 (list 'l "CIN=0.0") ;; default value
5512 (list 'l "CIN=" '(s cin)))
5513 '(just-one-space)
5515 "and"
5516 "template for inserting an ELDO 2 input AND gate macromodel"
5517 'spice-tempo-tags)
5520 (tempo-define-template
5521 "spice-eldo-nand2"
5522 '("NAND"
5523 (p "[Instance name]: ") " "
5524 (p "[First input]: ") " "
5525 (p "[Second input]: ") " "
5526 (p "[Output]: ") " "
5527 (p "[Model name]: ") " "
5528 (p "<Vhigh>: " vhi 'noinsert)
5529 (if (string-equal (tempo-lookup-named 'vhi) "")
5530 (list 'l "VHI=5.0") ;; default value
5531 (list 'l "VHI=" '(s vhi)))
5532 '(just-one-space)
5533 (p "<Vlow>: " vlo 'noinsert)
5534 (if (string-equal (tempo-lookup-named 'vlo) "")
5535 (list 'l "VLO=0.0") ;; default value
5536 (list 'l "VLO=" '(s vlo)))
5537 '(just-one-space)
5538 (p "<Threshold input voltage>: " vth 'noinsert)
5539 (if (string-equal (tempo-lookup-named 'vth) "")
5540 (list 'l "VTH=2.5") ;; default value
5541 (list 'l "VTH=" '(s vth)))
5542 '(just-one-space)
5543 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5544 (if (string-equal (tempo-lookup-named 'vthi) "")
5545 (list 'l "") ;; default value
5546 (list 'l "VTHI=" '(s vthi)))
5547 '(just-one-space)
5548 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5549 (if (string-equal (tempo-lookup-named 'vtlo) "")
5550 (list 'l "") ;; default value
5551 (list 'l "VTLO=" '(s vtlo)))
5552 '(just-one-space)
5553 (p "<Transit time>: " tpd 'noinsert)
5554 (if (string-equal (tempo-lookup-named 'tpd) "")
5555 (list 'l "TPD=1.0ns") ;; default value
5556 (list 'l "TPD=" '(s tpd)))
5557 '(just-one-space)
5558 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5559 (if (string-equal (tempo-lookup-named 'tpdup) "")
5560 (list 'l "") ;; default value
5561 (list 'l "TPDUP=" '(s tpdup)))
5562 '(just-one-space)
5563 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5564 (if (string-equal (tempo-lookup-named 'tpdown) "")
5565 (list 'l "") ;; default value
5566 (list 'l "TPDOWN=" '(s tpdown)))
5567 '(just-one-space)
5568 (p "<Input capacitance>: " cin 'noinsert)
5569 (if (string-equal (tempo-lookup-named 'cin) "")
5570 (list 'l "CIN=0.0") ;; default value
5571 (list 'l "CIN=" '(s cin)))
5572 '(just-one-space)
5574 "nand"
5575 "template for inserting an ELDO 2 input NAND gate macromodel"
5576 'spice-tempo-tags)
5578 (tempo-define-template
5579 "spice-eldo-or2"
5580 '("OR"
5581 (p "[Instance name]: ") " "
5582 (p "[First input]: ") " "
5583 (p "[Second input]: ") " "
5584 (p "[Output]: ") " "
5585 (p "[Model name]: ") " "
5586 (p "<Vhigh>: " vhi 'noinsert)
5587 (if (string-equal (tempo-lookup-named 'vhi) "")
5588 (list 'l "VHI=5.0") ;; default value
5589 (list 'l "VHI=" '(s vhi)))
5590 '(just-one-space)
5591 (p "<Vlow>: " vlo 'noinsert)
5592 (if (string-equal (tempo-lookup-named 'vlo) "")
5593 (list 'l "VLO=0.0") ;; default value
5594 (list 'l "VLO=" '(s vlo)))
5595 '(just-one-space)
5596 (p "<Threshold input voltage>: " vth 'noinsert)
5597 (if (string-equal (tempo-lookup-named 'vth) "")
5598 (list 'l "VTH=2.5") ;; default value
5599 (list 'l "VTH=" '(s vth)))
5600 '(just-one-space)
5601 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5602 (if (string-equal (tempo-lookup-named 'vthi) "")
5603 (list 'l "") ;; default value
5604 (list 'l "VTHI=" '(s vthi)))
5605 '(just-one-space)
5606 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5607 (if (string-equal (tempo-lookup-named 'vtlo) "")
5608 (list 'l "") ;; default value
5609 (list 'l "VTLO=" '(s vtlo)))
5610 '(just-one-space)
5611 (p "<Transit time>: " tpd 'noinsert)
5612 (if (string-equal (tempo-lookup-named 'tpd) "")
5613 (list 'l "TPD=1.0ns") ;; default value
5614 (list 'l "TPD=" '(s tpd)))
5615 '(just-one-space)
5616 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5617 (if (string-equal (tempo-lookup-named 'tpdup) "")
5618 (list 'l "") ;; default value
5619 (list 'l "TPDUP=" '(s tpdup)))
5620 '(just-one-space)
5621 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5622 (if (string-equal (tempo-lookup-named 'tpdown) "")
5623 (list 'l "") ;; default value
5624 (list 'l "TPDOWN=" '(s tpdown)))
5625 '(just-one-space)
5626 (p "<Input capacitance>: " cin 'noinsert)
5627 (if (string-equal (tempo-lookup-named 'cin) "")
5628 (list 'l "CIN=0.0") ;; default value
5629 (list 'l "CIN=" '(s cin)))
5630 '(just-one-space)
5632 "or"
5633 "template for inserting an ELDO 2 input OR gate macromodel"
5634 'spice-tempo-tags)
5636 (tempo-define-template
5637 "spice-eldo-nor2"
5638 '("NOR"
5639 (p "[Instance name]: ") " "
5640 (p "[First input]: ") " "
5641 (p "[Second input]: ") " "
5642 (p "[Output]: ") " "
5643 (p "[Model name]: ") " "
5644 (p "<Vhigh>: " vhi 'noinsert)
5645 (if (string-equal (tempo-lookup-named 'vhi) "")
5646 (list 'l "VHI=5.0") ;; default value
5647 (list 'l "VHI=" '(s vhi)))
5648 '(just-one-space)
5649 (p "<Vlow>: " vlo 'noinsert)
5650 (if (string-equal (tempo-lookup-named 'vlo) "")
5651 (list 'l "VLO=0.0") ;; default value
5652 (list 'l "VLO=" '(s vlo)))
5653 '(just-one-space)
5654 (p "<Threshold input voltage>: " vth 'noinsert)
5655 (if (string-equal (tempo-lookup-named 'vth) "")
5656 (list 'l "VTH=2.5") ;; default value
5657 (list 'l "VTH=" '(s vth)))
5658 '(just-one-space)
5659 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5660 (if (string-equal (tempo-lookup-named 'vthi) "")
5661 (list 'l "") ;; default value
5662 (list 'l "VTHI=" '(s vthi)))
5663 '(just-one-space)
5664 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5665 (if (string-equal (tempo-lookup-named 'vtlo) "")
5666 (list 'l "") ;; default value
5667 (list 'l "VTLO=" '(s vtlo)))
5668 '(just-one-space)
5669 (p "<Transit time>: " tpd 'noinsert)
5670 (if (string-equal (tempo-lookup-named 'tpd) "")
5671 (list 'l "TPD=1.0ns") ;; default value
5672 (list 'l "TPD=" '(s tpd)))
5673 '(just-one-space)
5674 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5675 (if (string-equal (tempo-lookup-named 'tpdup) "")
5676 (list 'l "") ;; default value
5677 (list 'l "TPDUP=" '(s tpdup)))
5678 '(just-one-space)
5679 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5680 (if (string-equal (tempo-lookup-named 'tpdown) "")
5681 (list 'l "") ;; default value
5682 (list 'l "TPDOWN=" '(s tpdown)))
5683 '(just-one-space)
5684 (p "<Input capacitance>: " cin 'noinsert)
5685 (if (string-equal (tempo-lookup-named 'cin) "")
5686 (list 'l "CIN=0.0") ;; default value
5687 (list 'l "CIN=" '(s cin)))
5688 '(just-one-space)
5690 "nor"
5691 "template for inserting an ELDO 2 input NOR gate macromodel"
5692 'spice-tempo-tags)
5695 (tempo-define-template
5696 "spice-eldo-and3"
5697 '("AND3"
5698 (p "[Instance name]: ") " "
5699 (p "[First input]: ") " "
5700 (p "[Second input]: ") " "
5701 (p "[Output]: ") " "
5702 (p "[Model name]: ") " "
5703 (p "<Vhigh>: " vhi 'noinsert)
5704 (if (string-equal (tempo-lookup-named 'vhi) "")
5705 (list 'l "VHI=5.0") ;; default value
5706 (list 'l "VHI=" '(s vhi)))
5707 '(just-one-space)
5708 (p "<Vlow>: " vlo 'noinsert)
5709 (if (string-equal (tempo-lookup-named 'vlo) "")
5710 (list 'l "VLO=0.0") ;; default value
5711 (list 'l "VLO=" '(s vlo)))
5712 '(just-one-space)
5713 (p "<Threshold input voltage>: " vth 'noinsert)
5714 (if (string-equal (tempo-lookup-named 'vth) "")
5715 (list 'l "VTH=2.5") ;; default value
5716 (list 'l "VTH=" '(s vth)))
5717 '(just-one-space)
5718 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5719 (if (string-equal (tempo-lookup-named 'vthi) "")
5720 (list 'l "") ;; default value
5721 (list 'l "VTHI=" '(s vthi)))
5722 '(just-one-space)
5723 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5724 (if (string-equal (tempo-lookup-named 'vtlo) "")
5725 (list 'l "") ;; default value
5726 (list 'l "VTLO=" '(s vtlo)))
5727 '(just-one-space)
5728 (p "<Transit time>: " tpd 'noinsert)
5729 (if (string-equal (tempo-lookup-named 'tpd) "")
5730 (list 'l "TPD=1.0ns") ;; default value
5731 (list 'l "TPD=" '(s tpd)))
5732 '(just-one-space)
5733 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5734 (if (string-equal (tempo-lookup-named 'tpdup) "")
5735 (list 'l "") ;; default value
5736 (list 'l "TPDUP=" '(s tpdup)))
5737 '(just-one-space)
5738 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5739 (if (string-equal (tempo-lookup-named 'tpdown) "")
5740 (list 'l "") ;; default value
5741 (list 'l "TPDOWN=" '(s tpdown)))
5742 '(just-one-space)
5743 (p "<Input capacitance>: " cin 'noinsert)
5744 (if (string-equal (tempo-lookup-named 'cin) "")
5745 (list 'l "CIN=0.0") ;; default value
5746 (list 'l "CIN=" '(s cin)))
5747 '(just-one-space)
5749 "and3"
5750 "template for inserting an ELDO 3 input AND gate macromodel"
5751 'spice-tempo-tags)
5754 (tempo-define-template
5755 "spice-eldo-nand3"
5756 '("NAND3"
5757 (p "[Instance name]: ") " "
5758 (p "[First input]: ") " "
5759 (p "[Second input]: ") " "
5760 (p "[Output]: ") " "
5761 (p "[Model name]: ") " "
5762 (p "<Vhigh>: " vhi 'noinsert)
5763 (if (string-equal (tempo-lookup-named 'vhi) "")
5764 (list 'l "VHI=5.0") ;; default value
5765 (list 'l "VHI=" '(s vhi)))
5766 '(just-one-space)
5767 (p "<Vlow>: " vlo 'noinsert)
5768 (if (string-equal (tempo-lookup-named 'vlo) "")
5769 (list 'l "VLO=0.0") ;; default value
5770 (list 'l "VLO=" '(s vlo)))
5771 '(just-one-space)
5772 (p "<Threshold input voltage>: " vth 'noinsert)
5773 (if (string-equal (tempo-lookup-named 'vth) "")
5774 (list 'l "VTH=2.5") ;; default value
5775 (list 'l "VTH=" '(s vth)))
5776 '(just-one-space)
5777 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5778 (if (string-equal (tempo-lookup-named 'vthi) "")
5779 (list 'l "") ;; default value
5780 (list 'l "VTHI=" '(s vthi)))
5781 '(just-one-space)
5782 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5783 (if (string-equal (tempo-lookup-named 'vtlo) "")
5784 (list 'l "") ;; default value
5785 (list 'l "VTLO=" '(s vtlo)))
5786 '(just-one-space)
5787 (p "<Transit time>: " tpd 'noinsert)
5788 (if (string-equal (tempo-lookup-named 'tpd) "")
5789 (list 'l "TPD=1.0ns") ;; default value
5790 (list 'l "TPD=" '(s tpd)))
5791 '(just-one-space)
5792 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5793 (if (string-equal (tempo-lookup-named 'tpdup) "")
5794 (list 'l "") ;; default value
5795 (list 'l "TPDUP=" '(s tpdup)))
5796 '(just-one-space)
5797 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5798 (if (string-equal (tempo-lookup-named 'tpdown) "")
5799 (list 'l "") ;; default value
5800 (list 'l "TPDOWN=" '(s tpdown)))
5801 '(just-one-space)
5802 (p "<Input capacitance>: " cin 'noinsert)
5803 (if (string-equal (tempo-lookup-named 'cin) "")
5804 (list 'l "CIN=0.0") ;; default value
5805 (list 'l "CIN=" '(s cin)))
5806 '(just-one-space)
5808 "nand3"
5809 "template for inserting an ELDO 3 input NAND gate macromodel"
5810 'spice-tempo-tags)
5812 (tempo-define-template
5813 "spice-eldo-or3"
5814 '("OR3"
5815 (p "[Instance name]: ") " "
5816 (p "[First input]: ") " "
5817 (p "[Second input]: ") " "
5818 (p "[Output]: ") " "
5819 (p "[Model name]: ") " "
5820 (p "<Vhigh>: " vhi 'noinsert)
5821 (if (string-equal (tempo-lookup-named 'vhi) "")
5822 (list 'l "VHI=5.0") ;; default value
5823 (list 'l "VHI=" '(s vhi)))
5824 '(just-one-space)
5825 (p "<Vlow>: " vlo 'noinsert)
5826 (if (string-equal (tempo-lookup-named 'vlo) "")
5827 (list 'l "VLO=0.0") ;; default value
5828 (list 'l "VLO=" '(s vlo)))
5829 '(just-one-space)
5830 (p "<Threshold input voltage>: " vth 'noinsert)
5831 (if (string-equal (tempo-lookup-named 'vth) "")
5832 (list 'l "VTH=2.5") ;; default value
5833 (list 'l "VTH=" '(s vth)))
5834 '(just-one-space)
5835 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5836 (if (string-equal (tempo-lookup-named 'vthi) "")
5837 (list 'l "") ;; default value
5838 (list 'l "VTHI=" '(s vthi)))
5839 '(just-one-space)
5840 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5841 (if (string-equal (tempo-lookup-named 'vtlo) "")
5842 (list 'l "") ;; default value
5843 (list 'l "VTLO=" '(s vtlo)))
5844 '(just-one-space)
5845 (p "<Transit time>: " tpd 'noinsert)
5846 (if (string-equal (tempo-lookup-named 'tpd) "")
5847 (list 'l "TPD=1.0ns") ;; default value
5848 (list 'l "TPD=" '(s tpd)))
5849 '(just-one-space)
5850 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5851 (if (string-equal (tempo-lookup-named 'tpdup) "")
5852 (list 'l "") ;; default value
5853 (list 'l "TPDUP=" '(s tpdup)))
5854 '(just-one-space)
5855 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5856 (if (string-equal (tempo-lookup-named 'tpdown) "")
5857 (list 'l "") ;; default value
5858 (list 'l "TPDOWN=" '(s tpdown)))
5859 '(just-one-space)
5860 (p "<Input capacitance>: " cin 'noinsert)
5861 (if (string-equal (tempo-lookup-named 'cin) "")
5862 (list 'l "CIN=0.0") ;; default value
5863 (list 'l "CIN=" '(s cin)))
5864 '(just-one-space)
5866 "or3"
5867 "template for inserting an ELDO 3 input OR gate macromodel"
5868 'spice-tempo-tags)
5870 (tempo-define-template
5871 "spice-eldo-nor3"
5872 '("NOR3"
5873 (p "[Instance name]: ") " "
5874 (p "[First input]: ") " "
5875 (p "[Second input]: ") " "
5876 (p "[Output]: ") " "
5877 (p "[Model name]: ") " "
5878 (p "<Vhigh>: " vhi 'noinsert)
5879 (if (string-equal (tempo-lookup-named 'vhi) "")
5880 (list 'l "VHI=5.0") ;; default value
5881 (list 'l "VHI=" '(s vhi)))
5882 '(just-one-space)
5883 (p "<Vlow>: " vlo 'noinsert)
5884 (if (string-equal (tempo-lookup-named 'vlo) "")
5885 (list 'l "VLO=0.0") ;; default value
5886 (list 'l "VLO=" '(s vlo)))
5887 '(just-one-space)
5888 (p "<Threshold input voltage>: " vth 'noinsert)
5889 (if (string-equal (tempo-lookup-named 'vth) "")
5890 (list 'l "VTH=2.5") ;; default value
5891 (list 'l "VTH=" '(s vth)))
5892 '(just-one-space)
5893 (p "<Threshold input voltage rising edge>: " vthi 'noinsert)
5894 (if (string-equal (tempo-lookup-named 'vthi) "")
5895 (list 'l "") ;; default value
5896 (list 'l "VTHI=" '(s vthi)))
5897 '(just-one-space)
5898 (p "<Threshold input voltage falling edge>: " vtlo 'noinsert)
5899 (if (string-equal (tempo-lookup-named 'vtlo) "")
5900 (list 'l "") ;; default value
5901 (list 'l "VTLO=" '(s vtlo)))
5902 '(just-one-space)
5903 (p "<Transit time>: " tpd 'noinsert)
5904 (if (string-equal (tempo-lookup-named 'tpd) "")
5905 (list 'l "TPD=1.0ns") ;; default value
5906 (list 'l "TPD=" '(s tpd)))
5907 '(just-one-space)
5908 (p "<Transit time for output to reach VTHI>: " tpdup 'noinsert)
5909 (if (string-equal (tempo-lookup-named 'tpdup) "")
5910 (list 'l "") ;; default value
5911 (list 'l "TPDUP=" '(s tpdup)))
5912 '(just-one-space)
5913 (p "<Transit time for output to reach VTLO>: " tpdown 'noinsert)
5914 (if (string-equal (tempo-lookup-named 'tpdown) "")
5915 (list 'l "") ;; default value
5916 (list 'l "TPDOWN=" '(s tpdown)))
5917 '(just-one-space)
5918 (p "<Input capacitance>: " cin 'noinsert)
5919 (if (string-equal (tempo-lookup-named 'cin) "")
5920 (list 'l "CIN=0.0") ;; default value
5921 (list 'l "CIN=" '(s cin)))
5922 '(just-one-space)
5924 "nor3"
5925 "template for inserting an ELDO 3 input NOR gate macromodel"
5926 'spice-tempo-tags)
5928 ;; -------------------------
5929 ;; Mixed signal Macromodels
5930 ;; -------------------------
5932 (tempo-define-template
5933 "spice-eldo-adc"
5934 '("ADC"
5935 (p "[Instance name]: ") " "
5936 (p "[Clock]: ") " "
5937 (p "[Analog input]: ") " "
5938 (p "[Digital Outputs from MSB to LSB]: ") " "
5939 (p "<Edge (1/-1)>: " edge 'noinsert)
5940 (if (string-equal (tempo-lookup-named 'edge) "")
5941 (list 'l "EDGE=1") ;; default value
5942 (list 'l "EDGE=-1"))
5943 '(just-one-space)
5944 (p "<Threshold clock voltage>: " vth 'noinsert)
5945 (if (string-equal (tempo-lookup-named 'vth) "")
5946 (list 'l "VTH=2.5") ;; default value
5947 (list 'l "VTH=" '(s vth)))
5948 '(just-one-space)
5949 (p "<Vhigh>: " vhi 'noinsert)
5950 (if (string-equal (tempo-lookup-named 'vhi) "")
5951 (list 'l "VHI=5.0") ;; default value
5952 (list 'l "VHI=" '(s vhi)))
5953 '(just-one-space)
5954 (p "<Vlow>: " vlo 'noinsert)
5955 (if (string-equal (tempo-lookup-named 'vlo) "")
5956 (list 'l "VLO=0.0") ;; default value
5957 (list 'l "VLO=" '(s vlo)))
5958 '(just-one-space)
5959 (p "<Analog input lower voltage>: " vinf 'noinsert)
5960 (if (string-equal (tempo-lookup-named 'vinf) "")
5961 (list 'l "VINF=0.0") ;; default value
5962 (list 'l "VTHI=" '(s vinf)))
5963 '(just-one-space)
5964 (p "<Analog input higher voltage>: " vsup 'noinsert)
5965 (if (string-equal (tempo-lookup-named 'vsup) "")
5966 (list 'l "VSUP=5.0") ;; default value
5967 (list 'l "VSUP=" '(s vsup)))
5968 '(just-one-space)
5969 (p "<Output bits commutation time>: " tcom 'noinsert)
5970 (if (string-equal (tempo-lookup-named 'tcom) "")
5971 (list 'l "TCOM=1.0ns") ;; default value
5972 (list 'l "TCOM=" '(s tcom)))
5973 '(just-one-space)
5974 (p "<Transit time>: " tpd 'noinsert)
5975 (if (string-equal (tempo-lookup-named 'tpd) "")
5976 (list 'l "TPD=10ns") ;; default value
5977 (list 'l "TPD=" '(s tpd)))
5978 '(just-one-space)
5980 "adc"
5981 "template for inserting an ELDO Analog to Digital Converter macromodel"
5982 'spice-tempo-tags)
5984 (tempo-define-template
5985 "spice-eldo-dac"
5986 '("DAC"
5987 (p "[Instance name]: ") " "
5988 (p "[Clock]: ") " "
5989 (p "[Digital inputs from MSB to LSB]: ") " "
5990 (p "[Analog output]: ") " "
5991 (p "<Edge (1/-1)>: " edge 'noinsert)
5992 (if (string-equal (tempo-lookup-named 'edge) "")
5993 (list 'l "EDGE=1") ;; default value
5994 (list 'l "EDGE=-1"))
5995 '(just-one-space)
5996 (p "<Threshold clock voltage>: " vth 'noinsert)
5997 (if (string-equal (tempo-lookup-named 'vth) "")
5998 (list 'l "VTH=2.5") ;; default value
5999 (list 'l "VTH=" '(s vth)))
6000 '(just-one-space)
6001 (p "<Threshold input voltage>: " vtin 'noinsert)
6002 (if (string-equal (tempo-lookup-named 'vtin) "")
6003 (list 'l "VTIN=2.5") ;; default value
6004 (list 'l "VTIN=" '(s vtin)))
6005 '(just-one-space)
6006 (p "<Analog Output Vhigh>: " vhi 'noinsert)
6007 (if (string-equal (tempo-lookup-named 'vhi) "")
6008 (list 'l "VHI=5.0") ;; default value
6009 (list 'l "VHI=" '(s vhi)))
6010 '(just-one-space)
6011 (p "<Analog Output Vlow>: " vlo 'noinsert)
6012 (if (string-equal (tempo-lookup-named 'vlo) "")
6013 (list 'l "VLO=0.0") ;; default value
6014 (list 'l "VLO=" '(s vlo)))
6015 '(just-one-space)
6016 (p "<Transit time>: " tpd 'noinsert)
6017 (if (string-equal (tempo-lookup-named 'tpd) "")
6018 (list 'l "TPD=10ns") ;; default value
6019 (list 'l "TPD=" '(s tpd)))
6020 '(just-one-space)
6021 (p "<Output slope (V/s)>: " sl 'noinsert)
6022 (if (string-equal (tempo-lookup-named 'sl) "")
6023 (list 'l "SL=10e8") ;; default value
6024 (list 'l "SL=" '(s tcom)))
6025 '(just-one-space)
6027 "DAC"
6028 "template for inserting an ELDO Digital to Analog Converter macromodel"
6029 'spice-tempo-tags)
6031 ;; -------------------------
6032 ;; Switched cap Macromodels
6033 ;; -------------------------
6035 (tempo-define-template
6036 "spice-eldo-switchcap-opa"
6037 '("OPA"
6038 (p "[Instance name]: ") " "
6039 (p "[Positive input]: ") " "
6040 (p "[Negative input]: ") " "
6041 (p "[Positive Output]: ") " "
6042 (p "[Negative Output]: ") " "
6043 (p "[Model name]: ") " "
6044 (p "<Input offset>: " voff 'noinsert)
6045 (if (string-equal (tempo-lookup-named 'voff) "")
6046 (list 'l "VOFF=0.0") ;; default value
6047 (list 'l "VOFF=" '(s voff)))
6048 '(just-one-space)
6049 (p "<Slew rate (V/s)>: " sl 'noinsert)
6050 (if (string-equal (tempo-lookup-named 'sl) "")
6051 (list 'l "SL=1e6") ;; default value
6052 (list 'l "SL=" '(s voff)))
6053 '(just-one-space)
6054 (p "<Gain>: " gain 'noinsert)
6055 (if (string-equal (tempo-lookup-named 'gain) "")
6056 (list 'l "GAIN=1e5") ;; default value
6057 (list 'l "GAIN=" '(s gain)))
6058 '(just-one-space)
6059 (p "<Input capacitance>: " cin 'noinsert)
6060 (if (string-equal (tempo-lookup-named 'cin) "")
6061 (list 'l "CIN=0") ;; default value
6062 (list 'l "CIN=" '(s cin)))
6063 '(just-one-space)
6064 (p "<Output resistance>: " rs 'noinsert)
6065 (if (string-equal (tempo-lookup-named 'rs) "")
6066 (list 'l "RS=10e6") ;; default value
6067 (list 'l "RS=" '(s rs)))
6068 '(just-one-space)
6069 (p "<Symmetrical saturation voltage>: " vsat 'noinsert)
6070 (if (string-equal (tempo-lookup-named 'vsat) "")
6071 (list 'l "VSAT=5.0") ;; default value
6072 (list 'l "VSAT=" '(s vsat)))
6073 '(just-one-space)
6074 (p "<Asymmetrical saturation voltage>: " vsatm 'noinsert)
6075 (if (string-equal (tempo-lookup-named 'vsatm) "")
6076 (list 'l "VSATM=5.0") ;; default value
6077 (list 'l "VSATM=" '(s vsatm)))
6078 '(just-one-space)
6079 (p "<Cutoff frequency (double stage only)>: " fc 'noinsert)
6080 (if (string-equal (tempo-lookup-named 'fc) "")
6081 (list 'l "FC=1k") ;; default value
6082 (list 'l "FC=" '(s fc)))
6083 '(just-one-space)
6084 (p "<Non-dominant pole (single stage only)>: " fndp 'noinsert)
6085 (if (string-equal (tempo-lookup-named 'fndp) "")
6086 (list 'l "FNDP=1k") ;; default value
6087 (list 'l "FNDP=" '(s fndp)))
6088 '(just-one-space)
6089 (p "<Max current>: " imax 'noinsert)
6090 (if (string-equal (tempo-lookup-named 'imax) "")
6091 (list 'l "IMAX=100mA") ;; default value
6092 (list 'l "IMAX=" '(s imax)))
6093 '(just-one-space)
6094 (p "<Common mode rejection ratio>: " cmrr 'noinsert)
6095 (if (string-equal (tempo-lookup-named 'cmrr) "")
6096 (list 'l "CMRR=0.0") ;; default value
6097 (list 'l "CMRR=" '(s cmrr)))
6099 "opa"
6100 "template for inserting an ELDO differential single or double stage opamp"
6101 'spice-tempo-tags
6104 (tempo-define-template
6105 "spice-eldo-switch"
6106 '("S"
6107 (p "[Instance name]: ") " "
6108 (p "[Controlling node]: ") " "
6109 (p "[Node 1]: ") " "
6110 (p "[Node 2]: ") " "
6111 (p "[Model name]: ") " "
6112 (p "<RON resistance>: " ron 'noinsert)
6113 (if (string-equal (tempo-lookup-named 'ron) "")
6114 (list 'l "RON=1k") ;; default value
6115 (list 'l "RON=" '(s ron)))
6116 '(just-one-space)
6117 (p "<Overlap capacitance>: " crec 'noinsert)
6118 (if (string-equal (tempo-lookup-named 'crec) "")
6119 (list 'l "CREC=0") ;; default value
6120 (list 'l "CREC=" '(s crec)))
6122 "switch"
6123 "template for inserting an ELDO switch macromodel"
6124 'spice-tempo-tags
6128 ;; Layla constructs
6130 (tempo-define-template
6131 "layla-port"
6132 '(".port "
6133 (p "[Name of port]: ") " "
6134 (p "[Name of net]: ") " "
6136 "layla-port"
6137 "template for inserting a Layla port"
6138 'spice-tempo-tags)
6140 (tempo-define-template
6141 "layla-performance"
6142 '(".performance "
6143 (p "[Name of performance]: ") " "
6144 (p "[Nominal value]: ") " \n+"
6145 (p "[Weight (alfa)]: ") " "
6146 ; (p "[Weight (alfa)]: ") " "
6148 "layla-performance"
6149 "template for inserting a Layla performance"
6150 'spice-tempo-tags)
6152 (tempo-define-template
6153 "layla-net"
6154 '(".net "
6155 (p "[Name of net]: ") " "
6157 "layla-net"
6158 "template for inserting a Layla net"
6159 'spice-tempo-tags)
6161 (tempo-define-template
6162 "layla-bus"
6163 '(".bus "
6164 (p "[Name of bus]: ") " "
6166 "layla-bus"
6167 "template for inserting a Layla bus"
6168 'spice-tempo-tags)
6170 (defmacro spice-layla-function-template (name type)
6171 "Create a layla tempo define for NAME and TYPE."
6172 `(let (p_prompt)
6173 (setq p_prompt (concat "[Name of " ,name "]: "))
6174 (tempo-define-template
6175 (concat "layla-" ,name "-" ,type)
6176 (list (concat "." ,name "_" ,type "_param(")
6177 (list 'p p_prompt) ", "
6178 '(p "[Name of parameter]: ") ", "
6179 '(p "[Value of parameter]: ") ")"
6181 (concat "layla-" ,name "-" ,type)
6182 (concat "template for inserting a " ,type " parameter for a Layla " ,name)
6183 'spice-tempo-tags)))
6185 (spice-layla-function-template "bus" "double")
6186 (spice-layla-function-template "bus" "integer")
6187 (spice-layla-function-template "bus" "string")
6188 (spice-layla-function-template "device" "double")
6189 (spice-layla-function-template "device" "integer")
6190 (spice-layla-function-template "device" "string")
6191 (spice-layla-function-template "net" "double")
6192 (spice-layla-function-template "net" "integer")
6193 (spice-layla-function-template "net" "string")
6194 (spice-layla-function-template "placement" "double")
6195 (spice-layla-function-template "placement" "integer")
6196 (spice-layla-function-template "placement" "string")
6197 (spice-layla-function-template "port" "double")
6198 (spice-layla-function-template "port" "integer")
6199 (spice-layla-function-template "port" "string")
6200 (spice-layla-function-template "symmetry" "double")
6201 (spice-layla-function-template "symmetry" "integer")
6202 (spice-layla-function-template "symmetry" "string")
6205 ;;------------------------------------------------------------
6206 ;; Abbrev hook bindings (taken from eldo-mode)
6208 (defvar spice-mode-abbrev-table nil
6209 "Abbrev table to use in `spice-mode' buffers.")
6211 ;; the table, global init inline here:
6212 (if spice-mode-abbrev-table
6214 (let ((ac abbrevs-changed))
6215 (define-abbrev-table 'spice-mode-abbrev-table ())
6216 ;; passive elements:
6218 ;; resistors
6219 (define-abbrev spice-mode-abbrev-table "r" "" 'tempo-template-spice-spice2g6-resistor)
6220 (define-abbrev spice-mode-abbrev-table "rss" "" 'tempo-template-spice-spice3-semiconductor-resistor)
6221 (define-abbrev spice-mode-abbrev-table "re" "" 'tempo-template-spice-eldo-resistor)
6222 (define-abbrev spice-mode-abbrev-table "ree" "" 'tempo-template-spice-eldo-expression-resistor)
6223 (define-abbrev spice-mode-abbrev-table "res" "" 'tempo-template-spice-eldo-semiconductor-resistor)
6224 (define-abbrev spice-mode-abbrev-table "rh" "" 'tempo-template-spice-hspice-resistor)
6225 (define-abbrev spice-mode-abbrev-table "rl" "" 'tempo-template-spice-layla-resistor)
6227 ;; capacitors
6228 (define-abbrev spice-mode-abbrev-table "c" "" 'tempo-template-spice-spice2g6-capacitor)
6229 (define-abbrev spice-mode-abbrev-table "css" "" 'tempo-template-spice-spice3-semiconductor-capacitor)
6230 (define-abbrev spice-mode-abbrev-table "ce" "" 'tempo-template-spice-eldo-capacitor)
6231 (define-abbrev spice-mode-abbrev-table "cee" "" 'tempo-template-spice-eldo-expression-capacitor)
6232 (define-abbrev spice-mode-abbrev-table "ch" "" 'tempo-template-spice-hspice-capacitor)
6233 (define-abbrev spice-mode-abbrev-table "cl" "" 'tempo-template-spice-layla-capacitor)
6235 ;; inductors
6236 (define-abbrev spice-mode-abbrev-table "l" "" 'tempo-template-spice-spice2g6-inductor)
6237 (define-abbrev spice-mode-abbrev-table "le" "" 'tempo-template-spice-eldo-inductor)
6238 (define-abbrev spice-mode-abbrev-table "lee" "" 'tempo-template-spice-eldo-expression-inductor)
6239 (define-abbrev spice-mode-abbrev-table "lh" "" 'tempo-template-spice-hspice-inductor)
6240 (define-abbrev spice-mode-abbrev-table "ll" "" 'tempo-template-spice-layla-inductor)
6242 ;; coupled inductors
6243 (define-abbrev spice-mode-abbrev-table "k" "" 'tempo-template-spice-spice2g6-coupled-inductors)
6245 ;; lossless transmission lines
6246 (define-abbrev spice-mode-abbrev-table "t" "" 'tempo-template-spice-spice2g6-lossless-transmission)
6247 (define-abbrev spice-mode-abbrev-table "te" "" 'tempo-template-spice-spice2g6-lossless-transmission)
6248 (define-abbrev spice-mode-abbrev-table "th" "" 'tempo-template-spice-hspice-lossless-transmission)
6250 ;; lossy transmission lines
6251 (define-abbrev spice-mode-abbrev-table "o" "" 'tempo-template-spice-spice2g6-lossy-transmission)
6252 ; spice3 rcline
6253 (define-abbrev spice-mode-abbrev-table "rcls" "" 'tempo-template-spice-spice3-rcline)
6254 ; eldo rc-line
6255 (define-abbrev spice-mode-abbrev-table "rcle" "" 'tempo-template-spice-eldo-rcline)
6256 ; eldo lossy transmission line
6257 ; not implemented
6259 ;; active elements:
6261 ;; diodes
6262 (define-abbrev spice-mode-abbrev-table "d" "" 'tempo-template-spice-spice2g6-diode)
6263 (define-abbrev spice-mode-abbrev-table "de" "" 'tempo-template-spice-eldo-diode)
6264 (define-abbrev spice-mode-abbrev-table "dh" "" 'tempo-template-spice-hspice-diode)
6265 (define-abbrev spice-mode-abbrev-table "dl" "" 'tempo-template-spice-layla-diode)
6267 ;; bipolars
6268 (define-abbrev spice-mode-abbrev-table "q" "" 'tempo-template-spice-spice2g6-bipolar)
6269 (define-abbrev spice-mode-abbrev-table "qe" "" 'tempo-template-spice-eldo-bipolar)
6270 (define-abbrev spice-mode-abbrev-table "qh" "" 'tempo-template-spice-hspice-bipolar)
6273 ;; jfets
6274 (define-abbrev spice-mode-abbrev-table "j" "" 'tempo-template-spice-spice2g6-jfet)
6275 (define-abbrev spice-mode-abbrev-table "je" "" 'tempo-template-spice-eldo-jfet)
6276 (define-abbrev spice-mode-abbrev-table "jh" "" 'tempo-template-spice-hspice-jfet)
6279 ;; mosfets
6280 (define-abbrev spice-mode-abbrev-table "m" "" 'tempo-template-spice-spice2g6-mosfet)
6281 (define-abbrev spice-mode-abbrev-table "me" "" 'tempo-template-spice-eldo-mosfet)
6282 (define-abbrev spice-mode-abbrev-table "mh" "" 'tempo-template-spice-hspice-mosfet)
6283 (define-abbrev spice-mode-abbrev-table "ml" "" 'tempo-template-spice-layla-mosfet)
6286 ;; mesfets
6287 (define-abbrev spice-mode-abbrev-table "z" "" 'tempo-template-spice-spice2g6-mesfet)
6289 ;; subcircuits
6290 (define-abbrev spice-mode-abbrev-table "sub" "" 'tempo-template-spice-spice2g6-subckt)
6292 ;; controlled sources
6293 (define-abbrev spice-mode-abbrev-table "vcvs" "" 'tempo-template-spice-spice2g6-vcvs)
6294 (define-abbrev spice-mode-abbrev-table "e" "" 'tempo-template-spice-spice2g6-vcvs)
6295 (define-abbrev spice-mode-abbrev-table "ccvs" "" 'tempo-template-spice-spice2g6-ccvs)
6296 (define-abbrev spice-mode-abbrev-table "h" "" 'tempo-template-spice-spice2g6-ccvs)
6297 (define-abbrev spice-mode-abbrev-table "vccs" "" 'tempo-template-spice-spice2g6-vccs)
6298 (define-abbrev spice-mode-abbrev-table "g" "" 'tempo-template-spice-spice2g6-vccs)
6299 (define-abbrev spice-mode-abbrev-table "cccs" "" 'tempo-template-spice-spice2g6-cccs)
6300 (define-abbrev spice-mode-abbrev-table "f" "" 'tempo-template-spice-spice2g6-cccs)
6302 ;; transient signals
6303 (define-abbrev spice-mode-abbrev-table "pwl" "" '(spice-pwl))
6304 (define-abbrev spice-mode-abbrev-table "pu" "" 'tempo-template-spice-pulse)
6305 ;(define-abbrev spice-mode-abbrev-table "'su" "" 'tempo-template-spice-subckt)
6306 ;(define-abbrev spice-mode-abbrev-table "'ac" "" 'tempo-template-spice-ac)
6307 (define-abbrev spice-mode-abbrev-table "sin" "" 'tempo-template-spice-sine)
6308 ;(define-abbrev spice-mode-abbrev-table "'sffm" "" 'tempo-template-spice-hspice-sffm)
6309 (define-abbrev spice-mode-abbrev-table "exp" "" 'tempo-template-spice-exp)
6310 (define-abbrev spice-mode-abbrev-table "noi" "" 'tempo-template-spice-eldo-noise)
6311 (define-abbrev spice-mode-abbrev-table "pat" "" 'tempo-template-spice-eldo-pattern)
6313 ;; behavioral models
6314 ;; eldo
6315 (define-abbrev spice-mode-abbrev-table "comp" "" 'tempo-template-spice-eldo-comp)
6316 (define-abbrev spice-mode-abbrev-table "compd" "" 'tempo-template-spice-eldo-compd)
6317 (define-abbrev spice-mode-abbrev-table "opa0" "" 'tempo-template-spice-eldo-linear-opa0)
6318 (define-abbrev spice-mode-abbrev-table "opa0d" "" 'tempo-template-spice-eldo-linear-opa0d)
6319 (define-abbrev spice-mode-abbrev-table "opa1" "" 'tempo-template-spice-eldo-linear-opa0)
6320 (define-abbrev spice-mode-abbrev-table "opa1d" "" 'tempo-template-spice-eldo-linear-opa0d)
6321 (define-abbrev spice-mode-abbrev-table "opa2" "" 'tempo-template-spice-eldo-linear-opa0)
6322 (define-abbrev spice-mode-abbrev-table "opa2d" "" 'tempo-template-spice-eldo-linear-opa0d)
6324 ;; extracts
6325 (define-abbrev spice-mode-abbrev-table "phmag" "" 'tempo-template-spice-eldo-phmag)
6326 (define-abbrev spice-mode-abbrev-table "gmag" "" 'tempo-template-spice-eldo-gmag)
6327 (define-abbrev spice-mode-abbrev-table "fc" "" 'tempo-template-spice-eldo-fc)
6328 (define-abbrev spice-mode-abbrev-table "ugfc" "" 'tempo-template-spice-eldo-ugfc)
6329 (define-abbrev spice-mode-abbrev-table "tf" "" 'tempo-template-spice-eldo-period)
6330 (define-abbrev spice-mode-abbrev-table "tfm" "" 'tempo-template-spice-eldo-period-macro)
6331 (define-abbrev spice-mode-abbrev-table "dc" "" 'tempo-template-spice-eldo-duty-macro)
6332 (define-abbrev spice-mode-abbrev-table "he" "" 'tempo-template-spice-eldo-circuit-header)
6333 (setq abbrevs-changed ac)))
6336 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6337 ;;; Menus
6338 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6340 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6341 ;; Spice menu (using `easy-menu.el')
6343 (defun spice-create-mode-menu ()
6344 "Create Spice Mode menu."
6345 (append
6346 (list
6347 "Spice"
6348 '("Edit"
6349 ["Comment Region" comment-region (and (mark) (not buffer-read-only))]
6350 ["Uncomment Region" spice-uncomment-region (and (mark) (not buffer-read-only))]
6351 ["Comment bar" (spice-comment-bar 't) (not buffer-read-only)]
6352 ["Fill Paragraph (Break Line)" fill-paragraph (not buffer-read-only)]
6353 ["Join line" spice-delete-indentation (not buffer-read-only)]
6354 "--"
6355 ["Fontify..." font-lock-flush t]
6356 "--"
6357 ["(Re)activate File links..." spice-colorize-libraries-buffer t]
6358 ["Load include/lib files..." spice-load-include-files (assoc spice-imenu-libraries-submenu-name imenu--index-alist)]
6359 ["Load output file" spice-load-output-file (spice-output-file-p)]
6360 ["Unload all other spice files" spice-unload-other-decks t]
6361 "--"
6362 ["Replace with .guess stats" spice-replace-with-guess-statements (and (mark) (not buffer-read-only))]
6363 ["Replace with .nodeset stats" spice-replace-with-nodeset-statements (and (mark) (not buffer-read-only))]
6364 "--"
6365 ["Hide Comment Regions" spice-hide-all-comments (spice-hide-all-comments-p)]
6366 ["Unhide Comment Regions" spice-unhide-all-comments spice-some-comment-regions-are-hidden]
6367 "--"
6368 ["Search .subckt def" spice-search-subckt t]
6369 "--"
6370 ["Add Changelog Entry" spice-add-changelog-entry (not buffer-read-only)]
6372 (list
6373 "Simulate"
6374 ;; ["Simulate" compile t]
6375 ["Simulate" spice-compile (and buffer-file-name (not (spice-output-p)))]
6376 ["Stop Simulation" kill-compilation (condition-case ()
6377 (get-buffer-process
6378 (compilation-find-buffer))
6379 (error nil))]
6380 "--"
6381 ["Next Error..." spice-next-error t]
6382 ["Previous Error..." spice-previous-error t]
6383 "--"
6384 (append
6385 '("Simulator")
6386 ;; example code taken literally from vhdl-mode.el !
6387 ;; add menu entries for defined simulators
6388 (let ((simu-alist spice-simulator-alist) menu-alist name)
6389 (while simu-alist
6390 (setq name (car (car simu-alist)))
6391 (setq menu-alist (cons (vector name
6392 (list 'spice-set-simulator name)
6393 :style 'radio :selected
6394 ; (list 'equal 'spice-simulator name)
6395 (list 'equal '(spice-get-simulator) name)
6397 menu-alist))
6398 (setq simu-alist (cdr simu-alist)))
6399 (setq menu-alist
6400 (cons '["Add Simulator..."
6401 (customize-variable 'spice-simulator-alist) t]
6402 (cons "--" menu-alist)))
6403 (nreverse menu-alist))))
6404 (list
6405 "Waveform viewer"
6406 ["View" spice-run-waveform-viewer
6407 (and spice-waveform-viewer-alist-entry
6408 buffer-file-name)]
6409 ["Kill Waveform Viewer" spice-kill-waveform-viewer
6410 (condition-case ()
6411 (get-buffer-process
6412 (spice-waveform-buffer-name-function nil))
6413 (error nil))]
6414 "--"
6415 (append
6416 '("Waveform Viewer")
6417 ;; example code taken literally from vhdl-mode.el !
6418 ;; add menu entries for defined simulators
6419 (let ((wave-alist spice-waveform-viewer-alist) menu-alist name)
6420 (while wave-alist
6421 (setq name (car (car wave-alist)))
6422 (setq menu-alist (cons (vector name
6423 (list 'spice-set-waveform-viewer name)
6424 :style 'radio :selected
6425 ;(list 'equal 'spice-simulator name)
6426 (list 'equal
6427 '(spice-get-waveform-viewer)
6428 name))
6429 menu-alist))
6430 (setq wave-alist (cdr wave-alist)))
6431 (setq menu-alist
6432 (cons '["Add Waveform Viewer..."
6433 (customize-variable 'spice-waveform-viewer-alist) t]
6434 (cons "--" menu-alist)))
6435 (nreverse menu-alist))))
6436 "--"
6437 '("Passive Elements"
6438 ("Resistors"
6439 ["Spice2g6 Resistor" tempo-template-spice-spice2g6-resistor t]
6440 ["Spice3 Silicon Resistor" tempo-template-spice-spice3-semiconductor-resistor t]
6441 ["Eldo Resistor" tempo-template-spice-eldo-resistor (spice-standard-p 'eldo)]
6442 ["Eldo Expression Resistor" tempo-template-spice-eldo-expression-resistor (spice-standard-p 'eldo)]
6443 ["Eldo Silicon Resistor" tempo-template-spice-eldo-semiconductor-resistor (spice-standard-p 'eldo)]
6444 ["Hspice Resistor" tempo-template-spice-hspice-resistor (spice-standard-p 'hspice)]
6445 ["Layla Resistor" tempo-template-spice-layla-resistor (spice-standard-p 'layla)]
6447 ("Capacitors"
6448 ["Spice2g6 Capacitor" tempo-template-spice-spice2g6-capacitor t]
6449 ["Spice3 Silicon Capacitor" tempo-template-spice-spice3-semiconductor-capacitor t]
6450 ["Eldo Capacitor" tempo-template-spice-eldo-capacitor (spice-standard-p 'eldo)]
6451 ["Eldo Expression Capacitor" tempo-template-spice-eldo-expression-capacitor (spice-standard-p 'eldo)]
6452 ["Hspice Capacitor" tempo-template-spice-hspice-capacitor (spice-standard-p 'hspice)]
6453 ["Layla Capacitor" tempo-template-spice-layla-capacitor (spice-standard-p 'layla)]
6455 ("Inductors"
6456 ["Spice2g6 Inductor" tempo-template-spice-spice2g6-inductor t]
6457 ["Spice2g6 Coupled Inductors" tempo-template-spice-spice2g6-coupled-inductors t]
6458 ["Eldo Inductor" tempo-template-spice-eldo-inductor (spice-standard-p 'eldo)]
6459 ["Eldo Expression Inductor" tempo-template-spice-eldo-expression-inductor (spice-standard-p 'eldo)]
6460 ["Hspice Inductor" tempo-template-spice-hspice-inductor (spice-standard-p 'hspice)]
6461 ["Layla Inductor" tempo-template-spice-layla-inductor (spice-standard-p 'layla)]
6463 ("Transmission lines"
6464 ["Spice2g6 Lossless" tempo-template-spice-spice2g6-lossless-transmission t]
6465 ["Eldo Lossless" tempo-template-spice-eldo-lossless-transmission (spice-standard-p 'eldo)]
6466 ["Hspice Lossless" tempo-template-spice-hspice-lossless-transmission (spice-standard-p 'hspice)]
6467 ["Spice2g6 Lossy" tempo-template-spice-spice2g6-lossy-transmission t]
6468 ["Spice3 RC line" tempo-template-spice-spice3-rcline t]
6469 ["Eldo RC line" tempo-template-spice-eldo-rcline (spice-standard-p 'eldo)]
6472 '("Active Elements"
6473 ("Diodes"
6474 ["Spice2g6 Diode" tempo-template-spice-spice2g6-diode t]
6475 ["Eldo Diode" tempo-template-spice-eldo-diode (spice-standard-p 'eldo)]
6476 ["Hspice Diode" tempo-template-spice-hspice-diode (spice-standard-p 'hspice)]
6477 ["Layla Diode" tempo-template-spice-layla-diode (spice-standard-p 'layla)]
6479 ("Bipolars"
6480 ["Spice2g6 Bipolar" tempo-template-spice-spice2g6-bipolar t]
6481 ["Eldo Bipolar" tempo-template-spice-eldo-bipolar (spice-standard-p 'eldo)]
6482 ["Hspice Bipolar" tempo-template-spice-hspice-bipolar (spice-standard-p 'hspice)]
6484 ("Jfets & Mesfets"
6485 ["Spice2g6 Jfet" tempo-template-spice-spice2g6-jfet t]
6486 ["Spice2g6 Mesfet" tempo-template-spice-spice2g6-mesfet t]
6487 ["Eldo Jfet" tempo-template-spice-eldo-jfet (spice-standard-p 'eldo)]
6488 ["Hspice Jfet" tempo-template-spice-hspice-jfet (spice-standard-p 'hspice)]
6490 ("Mosfets"
6491 ["Spice2g6 Mosfet" tempo-template-spice-spice2g6-mosfet t]
6492 ["Eldo Mosfet" tempo-template-spice-eldo-mosfet (spice-standard-p 'eldo)]
6493 ["Hspice Mosfet" tempo-template-spice-hspice-mosfet (spice-standard-p 'hspice)]
6494 ["Layla Mosfet" tempo-template-spice-hspice-mosfet (spice-standard-p 'layla)]
6497 '("Controlled Sources"
6498 ["Spice2g6 VCVS" tempo-template-spice-spice2g6-vcvs t]
6499 ["Spice2g6 CCVS" tempo-template-spice-spice2g6-ccvs t]
6500 ["Spice2g6 VCCS" tempo-template-spice-spice2g6-vccs t]
6501 ["Spice2g6 CCCS" tempo-template-spice-spice2g6-ccvs t]
6503 '("Waveforms"
6504 ["PWL" (spice-pwl) t]
6505 ["pulse" tempo-template-spice-pulse t]
6506 ; ["ac" tempo-template-eldo-ac t]
6507 ["sine" tempo-template-spice-sine t]
6508 ["exp" tempo-template-spice-exp t]
6509 ["hspice sffm" tempo-template-spice-hspice-sffm (spice-standard-p 'hspice)]
6510 ["hspice am" tempo-template-spice-hspice-am (spice-standard-p 'hspice)]
6511 ["eldo pattern" tempo-template-spice-eldo-pattern (spice-standard-p 'eldo)]
6512 ["eldo noise" tempo-template-spice-eldo-noise (spice-standard-p 'eldo)]
6513 ["eldoRF four" tempo-template-spice-eldorf-four (spice-standard-p 'eldorf)]
6514 ["eldoRF fpulse" tempo-template-spice-eldorf-fpulse (spice-standard-p 'eldorf)]
6516 "--"
6517 '("Eldo Macromodels"
6518 ("Analog"
6519 ["SO Comparator" tempo-template-spice-eldo-comp (spice-standard-p 'eldo)]
6520 ["DO Comparator" tempo-template-spice-eldo-compd (spice-standard-p 'eldo)]
6521 ["SO Linear Opamp" tempo-template-spice-eldo-linear-opa0 (spice-standard-p 'eldo)]
6522 ["DO Linear Opamp" tempo-template-spice-eldo-linear-opa0d (spice-standard-p 'eldo)]
6523 ["SO Linear 1-pole Opamp" tempo-template-spice-eldo-linear-opa1 (spice-standard-p 'eldo)]
6524 ["DO Linear 1-pole Opamp" tempo-template-spice-eldo-linear-opa1d (spice-standard-p 'eldo)]
6525 ["SO Linear 2-pole Opamp" tempo-template-spice-eldo-linear-opa2 (spice-standard-p 'eldo)]
6526 ["DO Linear 2-pole Opamp" tempo-template-spice-eldo-linear-opa2d (spice-standard-p 'eldo)]
6527 ["Delay" tempo-template-spice-eldo-delay (spice-standard-p 'eldo)]
6528 ["Saturating Resistor" tempo-template-spice-eldo-satr (spice-standard-p 'eldo)]
6529 ["Voltage Limiter" tempo-template-spice-eldo-satv (spice-standard-p 'eldo)]
6530 ["Voltage cont. switch" tempo-template-spice-eldo-vswitch (spice-standard-p 'eldo)]
6531 ["Current cont. switch" tempo-template-spice-eldo-cswitch (spice-standard-p 'eldo)]
6532 ["Triangular to sine converter" tempo-template-spice-eldo-tri2sin (spice-standard-p 'eldo)]
6533 ["Staircase generator" tempo-template-spice-eldo-stairgen (spice-standard-p 'eldo)]
6534 ["Sawtooth generator" tempo-template-spice-eldo-sawgen (spice-standard-p 'eldo)]
6535 ["Triangle generator" tempo-template-spice-eldo-trigen (spice-standard-p 'eldo)]
6536 ["Amplitude modulator" tempo-template-spice-eldo-amm (spice-standard-p 'eldo)]
6537 ["Pulse amplitude modulator" tempo-template-spice-eldo-pam (spice-standard-p 'eldo)]
6538 ["Sample&Hold" tempo-template-spice-eldo-saho (spice-standard-p 'eldo)]
6539 ["Track&Hold" tempo-template-spice-eldo-trho (spice-standard-p 'eldo)]
6540 ["Peak Detector" tempo-template-spice-eldo-peakd (spice-standard-p 'eldo)]
6541 ["SO Level Detector" tempo-template-spice-eldo-levdso (spice-standard-p 'eldo)]
6542 ["DO Level Detector" tempo-template-spice-eldo-levddo (spice-standard-p 'eldo)]
6543 ["Log Amplifier" tempo-template-spice-eldo-logamp (spice-standard-p 'eldo)]
6544 ["Antilog Amplifier" tempo-template-spice-eldo-antilog (spice-standard-p 'eldo)]
6545 ["Differentiator" tempo-template-spice-eldo-diff (spice-standard-p 'eldo)]
6546 ["Integrator" tempo-template-spice-eldo-integ (spice-standard-p 'eldo)]
6547 ["Add/Sub/Mult/Div" tempo-template-spice-eldo-adder (spice-standard-p 'eldo)]
6549 ("Digital"
6550 ["Delay" tempo-template-spice-eldo-delay (spice-standard-p 'eldo)]
6551 ["Inverter" tempo-template-spice-eldo-inv (spice-standard-p 'eldo)]
6552 ["XOR gate" tempo-template-spice-eldo-xor (spice-standard-p 'eldo)]
6553 ["2 input AND gate" tempo-template-spice-eldo-and2 (spice-standard-p 'eldo)]
6554 ["2 input NAND gate" tempo-template-spice-eldo-nand2 (spice-standard-p 'eldo)]
6555 ["2 input OR gate" tempo-template-spice-eldo-or2 (spice-standard-p 'eldo)]
6556 ["2 input NOR gate" tempo-template-spice-eldo-nor2 (spice-standard-p 'eldo)]
6557 ["3 input AND gate" tempo-template-spice-eldo-and3 (spice-standard-p 'eldo)]
6558 ["3 input NAND gate" tempo-template-spice-eldo-nand3 (spice-standard-p 'eldo)]
6559 ["3 input OR gate" tempo-template-spice-eldo-or3 (spice-standard-p 'eldo)]
6560 ["3 input NOR gate" tempo-template-spice-eldo-nor3 (spice-standard-p 'eldo)]
6562 ("Mixed Signal"
6563 ["AD Converter" tempo-template-spice-eldo-adc (spice-standard-p 'eldo)]
6564 ["DA Converter" tempo-template-spice-eldo-dac (spice-standard-p 'eldo)]
6566 ("Switched Cap"
6567 ["Opamp" tempo-template-spice-eldo-switchcap-opa (spice-standard-p 'eldo)]
6568 ["Switch" tempo-template-spice-eldo-switch (spice-standard-p 'eldo)]
6571 "--"
6572 '("Layla Objects"
6573 ["Port" tempo-template-layla-port (spice-standard-p 'layla)]
6574 ["Performance" tempo-template-layla-performance (spice-standard-p 'layla)]
6575 ["Net" tempo-template-layla-net (spice-standard-p 'layla)]
6576 ["Bus" tempo-template-layla-bus (spice-standard-p 'layla)]
6577 ; ["ac" tempo-template-eldo-ac t]
6579 '("Layla Properties"
6580 ("Port"
6581 ["Port double" tempo-template-layla-port-double (spice-standard-p 'layla)]
6582 ["Port integer" tempo-template-layla-port-integer (spice-standard-p 'layla)]
6583 ["Port string" tempo-template-layla-port-string (spice-standard-p 'layla)]
6585 ("Placement"
6586 ["Placement double" tempo-template-layla-placement-double (spice-standard-p 'layla)]
6587 ["Placement integer" tempo-template-layla-placement-integer (spice-standard-p 'layla)]
6588 ["Placement string" tempo-template-layla-placement-string (spice-standard-p 'layla)]
6590 ("Symmetry"
6591 ["Symmetry double" tempo-template-layla-symmetry-double (spice-standard-p 'layla)]
6592 ["Symmetry integer" tempo-template-layla-symmetry-integer (spice-standard-p 'layla)]
6593 ["Symmetry string" tempo-template-layla-symmetry-string (spice-standard-p 'layla)]
6595 ("Net"
6596 ["Net double" tempo-template-layla-net-double (spice-standard-p 'layla)]
6597 ["Net integer" tempo-template-layla-net-integer (spice-standard-p 'layla)]
6598 ["Net string" tempo-template-layla-net-string (spice-standard-p 'layla)]
6600 ("Device"
6601 ["Device double" tempo-template-layla-device-double (spice-standard-p 'layla)]
6602 ["Device integer" tempo-template-layla-device-integer (spice-standard-p 'layla)]
6603 ["Device string" tempo-template-layla-device-string (spice-standard-p 'layla)]
6605 ("Bus"
6606 ["Bus double" tempo-template-layla-bus-double (spice-standard-p 'layla)]
6607 ["Bus integer" tempo-template-layla-bus-integer (spice-standard-p 'layla)]
6608 ["Bus string" tempo-template-layla-bus-string (spice-standard-p 'layla)]
6611 "--"
6612 (append
6613 '("Goto Section")
6614 (let ((section-alist spice-section-alist) menu-alist name str)
6615 (setq menu-alist
6616 (cons "--"
6617 (cons '["Changelog"
6618 (spice-goto-section "changelog")
6619 ; (setq menu-sec (current-time))
6620 (spice-cache-section-p "changelog")
6621 ] menu-alist)))
6622 (while section-alist
6623 (setq name (car (car section-alist)))
6624 (setq str (downcase (car (cdr (car section-alist)))))
6625 (setq menu-alist (cons (vector name
6626 (list 'spice-goto-section str)
6627 (list 'spice-section-p str)
6629 menu-alist))
6630 (setq section-alist (cdr section-alist)))
6631 (setq menu-alist
6632 (cons '["Specify..."
6633 spice-goto-section t]
6634 (cons "--" menu-alist)))
6635 (nreverse menu-alist))
6637 (append
6638 '("Add Section Header")
6639 (let ((section-alist spice-section-alist) menu-alist name str)
6640 (setq menu-alist
6641 (cons "--"
6642 (cons '["Changelog"
6643 (spice-add-section "Changelog")
6644 (not (spice-section-p "changelog"))] menu-alist)))
6645 (while section-alist
6646 (setq name (car (car section-alist)))
6647 (setq str (car (cdr (car section-alist))))
6648 (setq menu-alist (cons (vector name
6649 (list 'spice-add-section str)
6650 (list 'not (list 'spice-section-p (downcase str)))
6652 menu-alist))
6653 (setq section-alist (cdr section-alist)))
6654 (setq menu-alist
6655 (cons '["Specify..."
6656 spice-add-section t]
6657 (cons "--" menu-alist)))
6658 (nreverse menu-alist))
6661 (spice-common-menu-tail-entries))
6665 (defun spice-create-output-mode-menu ()
6666 "Create Spice-output Mode menu."
6667 (append
6668 (list
6669 "Spice-output"
6670 '("Edit"
6671 ["Fontify..." font-lock-flush t]
6672 "--"
6673 ["Unload all other spice files" spice-unload-other-decks t]
6674 "--"
6675 ["Create <name>_guess.cir file" (spice-create-guess-nodeset-file "guess") (spice-output-p)]
6676 ["Create <name>_nodeset.cir file" (spice-create-guess-nodeset-file "nodeset") (spice-output-p)]
6679 (spice-common-menu-tail-entries))
6683 (defun spice-common-menu-tail-entries ()
6684 "Creat Common Spice and Spice-output Mode menu entries."
6685 (list
6686 "--"
6687 ;; customize sub menu
6688 '("Customize"
6689 ["Browse Spice Group" (customize-browse 'spice) t]
6690 ["Spice Standard" (customize-variable 'spice-standard) t]
6691 ["Spice Faces" (customize-group 'spice-faces) t]
6692 ["Section Header list" (customize-variable 'spice-section-alist) t]
6693 ;; "--"
6694 ;; ["Activate Customizations in Buffer" spice-activate-customizations t]
6695 ;; (not (equal spice-standard-local spice-standard))]
6697 ;; settings sub menu
6698 (append '("Settings")
6699 (when (fboundp 'speedbar)
6700 (list '["Speedbar" speedbar-frame-mode
6701 :style toggle
6702 :selected (and (boundp 'speedbar-frame)
6703 (frame-live-p speedbar-frame)
6704 (frame-visible-p speedbar-frame))]))
6705 (list
6706 '["Abbrevs" abbrev-mode :style toggle :selected abbrev-mode]
6707 '["List abbrevs" list-abbrevs abbrev-mode]
6708 '["Auto fill" auto-fill-mode :style toggle
6709 :selected auto-fill-function]))
6710 "--"
6711 ["About Spice-Mode" spice-about t]
6716 (defvar spice-menu-list nil
6717 "Spice Mode menu.") ; global variable
6719 (defvar spice-output-menu-list nil
6720 "Spice-output Mode menu.") ; global variable
6722 (require 'easymenu)
6724 (defun spice-menu-init ()
6725 "Initialize global vars for Spice menu's."
6726 (setq spice-menu-list (spice-create-mode-menu))
6727 (setq spice-output-menu-list (spice-create-output-mode-menu))
6730 (defun spice-update-mode-menu ()
6731 "Update Spice mode menu for current buffer. assumes globals have been updated."
6732 (interactive)
6733 (if (spice-output-p)
6734 (easy-menu-define spice-output-menu spice-output-mode-map
6735 "Menu keymap for Spice-output Mode." spice-output-menu-list)
6736 (easy-menu-define spice-menu spice-mode-map
6737 "Menu keymap for Spice Mode." spice-menu-list)))
6740 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6741 ;; spice mode syntax table
6743 (defvar spice-mode-syntax-table nil
6744 "Syntax table used in spice-mode buffers.")
6746 (defun spice-mode-syntax-table-init ()
6747 "Initialize syntax table from scratch."
6748 (setq spice-mode-syntax-table (make-syntax-table))
6749 (modify-syntax-entry ?$ "w" spice-mode-syntax-table)
6750 (modify-syntax-entry ?! "w" spice-mode-syntax-table)
6751 (modify-syntax-entry ?* "w" spice-mode-syntax-table) ; not < !!!!
6752 (if (spice-standard-p 'eldo)
6753 (progn (modify-syntax-entry ?# "w 13" spice-mode-syntax-table)
6754 (modify-syntax-entry ?c "w 2" spice-mode-syntax-table)
6755 (modify-syntax-entry ?e "w 4" spice-mode-syntax-table)))
6756 ;; (modify-syntax-entry ?\n "> b" spice-mode-syntax-table) ;; no no, comments are handled by spice-mode, not by syntax-table !!!
6757 (modify-syntax-entry ?\n "." spice-mode-syntax-table) ;; make it punctuation ?
6758 (modify-syntax-entry ?\" "\"" spice-mode-syntax-table) ;; font-lock prob
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 ?/ "w" spice-mode-syntax-table)
6765 ;; (modify-syntax-entry ?< "(>" spice-mode-syntax-table) ; can be in symbols
6766 ;; (modify-syntax-entry ?> ")<" spice-mode-syntax-table) ; can be in symbols
6767 ;; (modify-syntax-entry ?+ "w" spice-mode-syntax-table) ; can be in expr
6768 ;; (modify-syntax-entry ?- "w" spice-mode-syntax-table) ; can be in expr
6769 ;; (modify-syntax-entry ?= "." spice-mode-syntax-table) ; can be in expr
6774 ;;; speedbar stuff
6777 (eval-and-compile
6778 (when (fboundp 'speedbar)
6780 (require 'speedbar)
6782 (defun spice-speedbar-init ()
6783 "Initialize speedbar."
6784 ;; general settings, depends on auto-mode-alist, so should be
6785 ;; called every time auto-mode-alist is modified (set
6786 ;; (make-local-variable 'speedbar-tag-hierarchy-method) nil)
6787 ;; SPICE file extensions (extracted from `auto-mode-alist')
6788 (let ((mode-alist auto-mode-alist))
6789 (while mode-alist
6790 (when (eq (cdr (car mode-alist)) 'spice-mode)
6791 (speedbar-add-supported-extension (car (car mode-alist))))
6792 (setq mode-alist (cdr mode-alist)))))
6795 (defun spice-speedbar (&optional arg)
6796 "Open/close speedbar."
6797 (interactive)
6798 (if (not (fboundp 'speedbar))
6799 (error "WARNING: Speedbar is only available in newer Emacs versions")
6800 (condition-case () ; due to bug in `speedbar-el' v0.7.2a
6801 (speedbar-frame-mode arg)
6802 (error "WARNING: Install included `speedbar.el' patch first"))))
6806 ;;; speedbar end
6809 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6810 ;;; Imenu: S-mouse3 in emacs to find spice objects quickly
6811 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6813 (require 'imenu)
6815 (defvar spice-imenu-generic-expression nil
6816 "Imenu generic expression for spice mode. See `imenu-generic-expression'.")
6818 (defconst spice-imenu-end-submenu-name "*End*"
6819 "Label of End submenu in imenu.")
6821 (defconst spice-imenu-libraries-submenu-name "*Libraries*"
6822 "Label of Libraries submenu in imenu.")
6824 (defun spice-imenu-init ()
6825 "Initialize imenu generic expression and pass to imenu."
6826 (setq spice-imenu-generic-expression
6827 (append
6828 (list
6829 (list spice-imenu-end-submenu-name
6830 (concat
6832 "\\.\\(end\\)\\>"
6833 ) 1))
6834 (when (spice-standard-p 'layla)
6835 (list
6836 (list "*Nets*" (concat
6837 "^\\*?"
6838 "[\.]\\(net\\)\\s-+"
6839 "\\([a-z0-9]\\w*\\)\\>"
6840 ) 2)
6841 (list "*Ports*"
6842 (concat
6843 "^\\*?"
6844 "\\.\\(port\\)\\s-+"
6845 "\\([a-z0-9]\\w*\\)\\>"
6846 ) 2)
6847 (list "*Performances*"
6848 (concat
6849 "^\\*?"
6850 "\\.\\(performance\\)\\s-+"
6851 "\\([a-z]\\w*\\)\\>"
6852 ) 2)) ; list
6854 (list
6855 (list
6856 "*Misc*"
6857 (concat
6858 "^\\s-*\\.model\\s-+" spice-model-name spice-line-break
6859 "\\s-+\\("
6860 (regexp-opt spice-misc-model-type-names)
6861 "\\)\\>" )
6863 (list
6864 "*Diodes*"
6865 (concat "^\\s-*\\.model\\s-+" spice-model-name
6866 spice-line-break "\\s-+d\\>")
6868 (list
6869 "*Bipolars*"
6870 (concat "^\\s-*\\.model\\s-+" spice-model-name
6871 spice-line-break "\\s-+\\(npn\\|pnp\\)\\>")
6873 (list
6874 "*Mosfets*"
6875 (concat "^\\s-*\\.model\\s-+" spice-model-name
6876 spice-line-break "\\s-+\\(n\\|p\\)mos\\>")
6878 (list spice-imenu-libraries-submenu-name
6879 (concat spice-library-regexp-start
6880 spice-library-regexp-end)
6882 (list
6883 "*Analyses*"
6884 (concat "^\\s-*\\.\\("
6885 (regexp-opt spice-analyses)
6886 "\\)\\>")
6888 (list "*Sections*"
6889 spice-section-headings-regexp 2)
6890 (list nil
6891 (concat
6892 "^\\.\\(subckt\\s-+"
6893 (when (spice-standard-p 'eldo)
6894 "\\(lib\\s-+[^ \t\n]+\\s-+\\)?")
6895 "\\|macro\\s-+\\)"
6896 "\\([a-z]\\w*\\)\\>"
6897 ) (if (spice-standard-p 'eldo) 3 2))
6902 ;; ======================================================================
6903 ;; Support for compilation (simulation) - doesn't work 100% currently
6904 ;; and probably never will ...
6905 ;; ======================================================================
6907 (defun spice-simulation-buffer-name-function (arg)
6908 "Derive unique spice simulation buffer for simulator output."
6909 (concat "*Spice-simulation-" (buffer-name) "*"))
6912 (defun spice-get-simulator ()
6913 "Make an educated guess on what simulator a user likely wants to use."
6914 (if (and spice-simulator
6915 (assoc spice-simulator spice-simulator-alist))
6916 spice-simulator ;; is specified by user, take his choice
6917 (if (spice-standard-p 'eldo) "Eldo" ;; eldo
6918 (if (spice-standard-p 'hspice) "Hspice" ;; Hspice
6919 "Spice3")))) ;; fallback Spice3
6922 (defun spice-set-simulator-command ()
6923 "Construct a spice simulator command."
6924 (interactive)
6925 (setq compile-command
6926 (let ((commands-alist spice-simulator-alist)
6927 command)
6928 (while commands-alist
6929 (when (equal (spice-get-simulator) (nth 0 (car commands-alist)))
6930 (setq command
6931 (concat
6932 (nth 1 (car commands-alist)) " "
6933 spice-simulator-switches
6934 (unless
6935 (string-equal spice-simulator-switches "") " ")
6936 (file-name-nondirectory (if buffer-file-name
6937 buffer-file-name ""))
6938 (unless
6939 (string-equal (nth 2 (car commands-alist)) "") " ")
6940 (nth 2 (car commands-alist))
6942 (setq commands-alist (cdr commands-alist)))
6943 command)))
6945 (defun spice-set-simulator (name)
6946 "Set spice simulator NAME."
6947 (setq spice-simulator name)
6948 (spice-set-simulator-command))
6950 (require 'compile)
6952 (defvar spice-compilation-error-regexp-alist nil)
6953 (defvar spice-compilation-file-regexp-alist nil)
6955 (defun spice-compile ()
6956 "Spice wrapper function for compile."
6957 (interactive)
6958 (spice-set-simulator-command)
6959 (call-interactively 'compile nil)
6962 (defun spice-compile-variables-init ()
6963 "Build variable lists."
6964 (setq spice-compilation-error-regexp-alist
6965 (let ((commands-alist spice-simulator-alist)
6966 regexp-alist sublist)
6967 (while commands-alist
6968 (setq sublist (nth 3 (car commands-alist)))
6969 (unless (equal "" (car sublist))
6970 (setq regexp-alist
6971 (cons (append
6972 (list (nth 0 sublist)
6973 (if (= 0 (nth 1 sublist))
6975 (nth 1 sublist))
6976 (nth 2 sublist))
6977 (list (nth 3 sublist))
6978 (if (nth 4 sublist)
6979 (if (stringp (nth 4 sublist))
6980 (list (nth 4 sublist))
6981 (list (eval (nth 4 sublist))))))
6982 regexp-alist)))
6983 (setq commands-alist (cdr commands-alist)))
6984 regexp-alist))
6985 ; (message "setting compilation file regexps command")
6986 (setq spice-compilation-file-regexp-alist
6987 (let ((commands-alist spice-simulator-alist)
6988 regexp-alist)
6989 (while commands-alist
6990 (unless (equal "" (car (nth 4 (car commands-alist))))
6991 (setq regexp-alist
6992 (append regexp-alist
6993 (list (nth 4 (car commands-alist))))))
6994 (setq commands-alist (cdr commands-alist)))
6995 regexp-alist))
6999 (defun spice-compile-init ()
7000 "Initialize for simulation(/compilation)."
7002 ;;------------------------------------------------------------
7003 ;; use Eldo/Hspice as compiler, on current buffer
7004 (make-local-variable 'compile-command)
7005 (make-local-variable 'compilation-read-command)
7006 (make-local-variable 'compilation-buffer-name-function)
7007 (make-local-variable 'compilation-error-regexp-alist)
7008 (make-local-variable 'compilation-file-regexp-alist)
7010 (setq compilation-read-command 't)
7011 (setq compilation-buffer-name-function
7012 'spice-simulation-buffer-name-function)
7014 ; (message "setting compilation error regexps command")
7015 (setq compilation-error-regexp-alist spice-compilation-error-regexp-alist
7016 compilation-file-regexp-alist spice-compilation-file-regexp-alist)
7020 (defvar spice-column 1
7021 "Global variable to do column hack.
7023 Why ? Compile.el requires that every error is 'special', ie.
7024 different from the previous one. This is either the file is
7025 different, the line number is different or the column number is
7026 different. Prob: the file is always the same, the simulator guys
7027 never output the file name of the file that is being read, so
7028 that one doesn't change; the line number can not be found either;
7029 the column number is same problem; Solution: always take line
7030 number one, then take the column number 1 or 2 alternatingly,
7031 remember previous value here !
7033 This is ugly, I know, but it's the only way I could think of to find
7034 the errors in the simulation buffer with compile.el")
7037 (defun spice-linenum (f c)
7038 "Dirty hack function for `spice-column' global varible."
7039 ;;(message (format "calling linenum fun '%s'" f))
7040 (with-current-buffer compilation-last-buffer
7041 ;;(message (format "buffer '%s'" (buffer-name)))
7043 (list (point-marker) f 1
7044 (if (= spice-column 1)
7045 (setq spice-column 2)
7046 (setq spice-column 1))))
7049 (defun spice-next-error (n)
7050 "Move point to the next error N in the compilation buffer.
7051 Does NOT find the source line like \\[next-error] does, is defined
7052 in spice-mode since many simulators don't output errors with source line
7053 numbers included, so finding the error is still difficult."
7054 (interactive "p")
7055 (save-excursion
7056 (let (prev-buffer)
7057 (setq prev-buffer (buffer-name))
7058 (pop-to-buffer compilation-last-buffer)
7059 (compilation-next-error n)
7060 (recenter)
7061 (pop-to-buffer prev-buffer))))
7064 (defun spice-previous-error (n)
7065 "Move point to the previous error N in the compilation buffer.
7066 Does NOT find the source line like \\[next-error] does, is defined
7067 in spice-mode since many simulators don't output errors with source line
7068 numbers included, so finding the error is still difficult."
7069 (interactive "p")
7070 (save-excursion
7071 (let (prev-buffer)
7072 (setq prev-buffer (buffer-name))
7073 (pop-to-buffer compilation-last-buffer)
7074 (compilation-previous-error n)
7075 (recenter)
7076 (pop-to-buffer prev-buffer))))
7079 ;;------------------------------------------------------------
7080 ;; Waveform viewer support
7081 ;;------------------------------------------------------------
7082 ;; This is work in progress; (user) interface might change
7084 (defun spice-waveform-buffer-name-function (arg)
7085 "Check running process."
7086 (let ((name (if arg arg (buffer-name))))
7087 (concat "*Spice-waveform-" name "*")))
7090 (defun spice-set-waveform-viewer (name)
7091 (setq spice-waveform-viewer name)
7092 (spice-set-waveform-viewer-command))
7094 (defun spice-get-waveform-viewer ()
7095 "Make an educated guess on what waveform viewer a user likely would want."
7096 (if (and spice-waveform-viewer
7097 (assoc spice-waveform-viewer spice-waveform-viewer-alist))
7098 spice-waveform-viewer ;; is specified by user, take his choice
7099 (if (spice-standard-p 'eldo) "Xelga" ;; eldo's viewer is xelga
7100 (if (spice-standard-p 'hspice) "Awaves" ;; Hspice's viewer is awaves
7101 "Nutmeg")))) ;; fallback Spice3's viewer nutmeg ...
7104 (defun spice-waveform-viewer-derive-filename (arg)
7105 "Derive from the buffer file name the name of a derived file.
7107 If ARG is a string, it is a suffix to replace the buffer's
7108 suffix, if ARG is a list , , if ARG is a function, the function
7109 is called without arguments and it should return the derived
7110 filename, if ARG is nil, nil is returned, if ARG is t, the
7111 filename itself is returned unmodified."
7112 (cond ((stringp arg)
7113 (concat (file-name-sans-extension buffer-file-name) arg))
7114 ((listp arg)
7115 (let ((alist arg)
7116 filename)
7117 ;(message alist)
7118 (while alist
7119 (message (concat (file-name-sans-extension buffer-file-name) (car alist)))
7120 (setq
7121 filename
7122 (concat (file-name-sans-extension buffer-file-name) (car alist)))
7123 (setq alist (cdr alist)))
7124 filename))
7125 ((functionp arg)
7126 (funcall arg))
7127 (nil
7128 nil) ;; nil if nil ...
7130 buffer-file-name) ;; fallback if t ...
7134 (defvar spice-waveform-viewer-command ""
7135 "Variable containing buffer local waveform viewer command.")
7137 (defvar spice-waveform-viewer-filename nil
7138 "Variable filename field of waveform viewer structure.")
7140 (defvar spice-waveform-viewer-alist-entry nil
7141 "Variable holding selected entry of waveform viewer.")
7143 (defvar spice-waveform-viewer-read-command t
7144 "Variable containing boolean indicating reading of buffer local waveform viewer command.")
7146 (defvar spice-after-start-process-function nil
7147 "Variable containing after start process function.")
7149 (defun spice-set-waveform-viewer-command ()
7150 "Set waveform viewer command for spice."
7151 (interactive)
7152 (setq spice-waveform-viewer-alist-entry nil)
7153 (let ((commands-alist spice-waveform-viewer-alist))
7154 (while commands-alist
7155 (when (equal (spice-get-waveform-viewer)
7156 (nth 0 (car commands-alist)))
7157 (setq spice-waveform-viewer-alist-entry (car commands-alist))
7159 (setq commands-alist (cdr commands-alist)))))
7162 (defun spice-waveform-viewer-init ()
7163 "Initialize for waveform viewer."
7165 ;;------------------------------------------------------------
7166 (make-local-variable 'spice-waveform-viewer-command)
7167 (make-local-variable 'spice-waveform-viewer-read-command)
7168 (make-local-variable 'spice-waveform-viewer-filename)
7169 (make-local-variable 'spice-waveform-viewer-alist-entry)
7170 (make-local-variable 'spice-after-start-process-function)
7172 (setq spice-waveform-viewer-read-command 't)
7174 (spice-set-waveform-viewer-command))
7177 (defun spice-run-waveform-viewer ()
7178 "Run the waveform viewer if it is not yet running."
7179 (interactive)
7180 (if (not buffer-file-name)
7181 (message "Can not run waveform viewer on unsaved file-less buffers.")
7182 (let (name command file)
7183 (setq name (nth 0 spice-waveform-viewer-alist-entry)
7184 command (concat (nth 1 spice-waveform-viewer-alist-entry)
7186 (nth 2 spice-waveform-viewer-alist-entry)
7188 (spice-waveform-viewer-derive-filename
7189 (nth 4 spice-waveform-viewer-alist-entry)))
7190 file (buffer-name))
7191 (spice-process-check file)
7192 (message "Starting waveform viewer %s" name)
7193 (funcall (nth 3 spice-waveform-viewer-alist-entry) name command file))
7194 ) ; if (else part)
7198 (defun spice-master-directory ()
7199 "Directory of master file."
7200 (abbreviate-file-name
7201 (expand-file-name
7202 (file-name-directory (buffer-file-name)))))
7205 (defun spice-run-silent (name command file)
7206 "Start process NAME with (optional) second argument COMMAND and FILE."
7207 (let ((dir (spice-master-directory)))
7208 (with-current-buffer (get-buffer-create "*spice silent*")
7209 (erase-buffer)
7210 (if dir (cd dir))
7211 ; (message "cd to %s" dir)
7212 (let ((process (start-process (concat name " silent")
7213 (current-buffer) ; can be nil
7214 spice-shell
7215 spice-shell-command-option
7216 command)))
7217 (message "started %s" command)
7218 (if spice-after-start-process-function
7219 (funcall spice-after-start-process-function process))
7220 (set-process-query-on-exit-flag process)))))
7222 (defun spice-run-interactive (name command file)
7223 "Run waveform viewer interactively with process (NAME COMMAND FILE).
7224 Run command in a buffer (in comint-shell-mode) so that it accepts user
7225 interaction."
7226 (require 'comint)
7227 (let (; (default spice-command-default)
7228 (buffer (spice-waveform-buffer-name-function file))
7229 (process nil)
7230 (dir (spice-master-directory)))
7231 (spice-process-check file) ; Check that no process is running
7232 ; (setq spice-command-buffer (current-buffer))
7233 (with-output-to-temp-buffer buffer)
7234 (set-buffer buffer)
7235 (setq buffer-read-only nil)
7236 (if dir (cd dir))
7237 (insert "Running `" name "' on `" file "' with ``" command "''\n")
7238 (comint-exec buffer name spice-shell nil
7239 (list spice-shell-command-option command))
7240 (comint-mode)
7241 (setq mode-name name)
7242 ; (setq spice-command-default default)
7243 (setq process (get-buffer-process buffer))
7244 (if spice-after-start-process-function
7245 (funcall spice-after-start-process-function process))
7246 ; (spice-command-mode-line process) ; mode line setting
7247 ; (set-process-sentinel process 'spice-command-sentinel)
7248 (set-marker (process-mark process) (point-max))
7249 ;;; (setq compilation-in-progress (cons process compilation-in-progress))
7250 ; (spice-parse-reset)
7251 ; (setq spice-parse-function 'spice-parse-spice)
7252 ; (setq spice-sentinel-function 'spice-LaTeX-sentinel)
7255 (defun spice-command-mode-line (process)
7256 "Format the mode line for a buffer containing output from PROCESS."
7257 (setq mode-line-process (concat ": " (symbol-name (process-status process))))
7258 (set-buffer-modified-p (buffer-modified-p)))
7260 (defun spice-process-check (name)
7261 "Check if a process for the spice deck NAME already exist.
7262 If so, give the user the choice of aborting the process or the current
7263 command."
7264 (let ((process (get-buffer-process
7265 (spice-waveform-buffer-name-function name))))
7266 ; (message "checking %s for running process" (spice-waveform-buffer-name-function name))
7267 (cond ((null process))
7268 ((not (eq (process-status process) 'run)))
7269 ((yes-or-no-p (concat "Process `"
7270 (process-name process)
7271 "' for deck `"
7272 name
7273 "' running, kill it? "))
7274 (delete-process process))
7276 (error "Cannot have two processes for the spice deck")))))
7279 ;; ---- setting commands ?
7281 (defun spice-set-command ()
7282 "Set both simulator an waveform viewer commands for current buffer."
7283 (interactive)
7284 (spice-set-simulator-command)
7285 (spice-set-waveform-viewer-command)
7289 ;;------------------------------------------------------------
7290 ;; File initialization support, code taken from eldo-mode and
7291 ;; modified/extended
7292 ;;------------------------------------------------------------
7294 ;; initialize empty file:
7295 (defun spice-initialize-empty-file ()
7296 "Create a standard template for a new/empty file.
7298 This is the default initialization function. If the user has specified
7299 an initialization function, by setting
7300 `spice-initialize-file-function', the user-specified function is
7301 called instead. This function first checks for the template file
7302 specified in `spice-initialization-file' which is inserted and a default
7303 changelog entry is added. If this file isn't readable, a default
7304 template is inserted depending on the submode (eldo, hspice or layla)
7305 that has been selected."
7306 (interactive "*") ; read-only check
7307 (if (file-readable-p spice-initialize-template-file) ;; template file
7308 (insert-file-contents spice-initialize-template-file)
7309 ;; this has been taken from eldo-mode and thus only applies if
7310 ;; eldo is selected
7311 (if (spice-standard-p 'eldo)
7312 (progn
7313 (insert
7314 (concat "# " (buffer-name) " "
7315 "\n.notrc\n.nocom"
7316 "\n\n"
7317 spice-default-header
7318 "\n\n"))
7319 (spice-add-section "LIBRARIES")
7320 (insert "\n\n\n")
7321 (spice-add-section "SIMULATION OPTIONS")
7322 (insert
7323 (concat "\n\n"
7324 ".options STAT=1 SIMUDIV=10 !Status reports\n"
7325 ".options noascii nomod \n"
7326 ".options eps=1e-7 itol=1e-6 gmin=1e-16 analog \n"
7327 ".options nobound_phase"
7328 ".width out=80 \n"
7329 ".temp=27 \n"
7330 "\n\n\n"))
7331 (spice-add-section "SUPPLIES/REFERENCES")
7332 (insert "\n\n.END\n\n\n\n")
7333 (spice-add-section "Changelog")
7334 (insert "\n\n*** Local Variables:\n*** mode:spice\n*** End:\n")
7336 (if (spice-standard-p 'hspice) ;; hspice specific options
7337 (progn
7338 (insert
7339 (concat "* " (buffer-name) " "
7340 "\n\n"
7341 spice-default-header
7342 "\n\n"))
7343 (spice-add-section "LIBRARIES")
7344 (insert "\n\n\n")
7345 (spice-add-section "SIMULATION OPTIONS")
7346 (insert
7347 (concat "\n\n"
7348 ".options nomod nopage opts \n"
7349 ".options itl1=5000 itl2=2500 itl3=20 itl4=20 itl5=0 \n"
7350 ".options numdgt=10 $ print 10 digits in output \n"
7351 ".width out=80 \n"
7352 ".temp=27 \n"
7353 "\n\n\n"))
7354 (spice-add-section "SUPPLIES/REFERENCES")
7355 (insert "\n\n.end\n\n\n\n")
7356 (spice-add-section "Changelog")
7357 (insert "\n\n*** Local Variables:\n*** mode:spice\n*** End:\n")
7359 (if (spice-standard-p 'layla) ;; layla specific options
7360 (progn
7361 (insert
7362 (concat "* " (buffer-name) " "
7363 "\n"
7364 spice-default-header
7365 "\n\n"))
7366 (spice-add-section "MAIN CIRCUIT")
7367 (insert "\n\n\n")
7368 (spice-add-section "PORTS")
7369 (insert "\n\n.end\n\n\n\n")
7370 (spice-add-section "Changelog")
7371 (insert "\n\n*** Local Variables:\n*** mode:spice\n*** End:\n")
7377 (spice-add-changelog-entry "File created") ; in any case
7380 ;; ======================================================================
7381 ;; Support for .subckt search !?
7382 ;; ======================================================================
7384 ;; What about searching from an included file, how to find the
7385 ;; top-level then ? think I've cracked it: .end identifies top-level
7386 ;; spice files so remember the last one to start search from if the
7387 ;; search fails
7389 ;; BUG: doesn't handle nested .subckt defs ! Reports first found match...
7391 (defun spice-search-included-files (subckt)
7392 (save-excursion
7393 (let ((mrk nil))
7394 (goto-char (point-min))
7395 (while (and
7396 (search-forward-regexp spice-library-regexp-start
7397 (point-max) t)
7398 (not mrk))
7399 (beginning-of-line)
7400 (if (looking-at (concat spice-library-regexp-start
7401 spice-library-regexp-end))
7402 (if (file-readable-p (substitute-in-file-name (match-string 3)))
7403 (setq mrk
7404 (spice-search-file-for-subckt
7405 (substitute-in-file-name (match-string 3)) subckt))
7406 (message "File '%s' isn't readable" (match-string 3))) ; if
7407 ) ; if
7408 (end-of-line)) ; while
7409 mrk) ; let
7410 ) ; save-
7414 (defvar spice-subckt-search-master-filename nil
7415 "Latest top level (identified by .end in file) .cir file used in subcircuit searches.")
7417 (defun spice-search-file-for-subckt (filename subckt)
7418 "Searche a FILENAME for a SUBCKT definition.
7419 Remembers `spice-subckt-search-master-filename' for future subckt searches."
7420 (with-current-buffer (find-file-noselect filename)
7421 (condition-case nil
7422 (let ((index-alist (imenu--make-index-alist t))
7423 (mrk nil))
7424 (if (assoc spice-imenu-end-submenu-name index-alist)
7425 (setq spice-subckt-search-master-filename buffer-file-name))
7426 (setq mrk (assoc-string subckt index-alist))
7427 (if mrk mrk (spice-search-included-files subckt)))
7428 (error nil))))
7431 ;; History of subckt searches.
7432 (defvar spice-subckt-search-history nil
7433 "History of subcircuit searches.")
7435 (defun spice-guess-subckt-name ()
7436 "Guess name of subckt from context, multiple lines."
7437 (let ((subckt "")) ; (current-word)
7438 (save-excursion
7439 (beginning-of-line)
7440 (while (and (looking-at "^+")
7441 (not (forward-line -1))))
7442 (if (looking-at spice-xinstance-regexp)
7443 (progn
7444 ;; (message "Could it be '%s' ?" (match-string 3))
7445 (setq subckt (match-string 5))
7446 (remove-text-properties 0 (length subckt) '(face nil) subckt)
7447 ))) ; save-
7448 subckt))
7451 (defun spice-visit-subckt-def (mark)
7452 "Helper function visiting buffer and MARK specified."
7453 (when (and (eq (marker-buffer (cdr mark))
7454 (current-buffer))
7455 (not (and transient-mark-mode mark-active)))
7456 (push-mark))
7457 (pop-to-buffer (marker-buffer (cdr mark)) t)
7458 (widen)
7459 (goto-char (cdr mark)))
7462 (defun spice-search-subckt (subckt-args)
7463 "Searches for the .subckt definition with name under cursor, or any other name specified by user.
7465 Be CAREFUL using this command. Depending on the structure of your
7466 spice decks this might find wrong definitions. To AVOID any such
7467 problems always start searching from the TOP-LEVEL spice
7468 deck (ie. the file that is supplied to the simulator). If you
7469 start searching from an included file, potentially the definition
7470 is not found or it is found starting from ANOTHER top level
7471 file (which could result in a completely wrong search result).
7473 This search command places the mark if search result is in the
7474 same file, return to the search start position by using C-u
7475 C-<SPC> or C-u C-@."
7476 (interactive
7477 (list (let* ((default-subckt (spice-guess-subckt-name))
7478 (input (read-from-minibuffer
7479 "Subcircuit name: "
7480 default-subckt nil nil
7481 spice-subckt-search-history)))
7482 (if (string= input "")
7483 (if (string= default-subckt "")
7484 (error "No subckt args given")
7485 default-subckt)
7486 input))))
7487 ;(message (format "name of subckt is %s" subckt-args))
7488 (let (mrk)
7489 (setq mrk (spice-search-file-for-subckt buffer-file-name subckt-args))
7490 ; (message (format "mark is %s" (cdr mrk)))
7491 (if (and (cdr mrk) (markerp (cdr mrk)))
7492 (spice-visit-subckt-def mrk)
7493 (progn
7494 (message "Couldn't find subcircuit '%s', retrying search in top-level file"
7495 subckt-args))) ; if
7496 (if (and (not mrk)
7497 spice-subckt-search-master-filename)
7498 (progn
7499 (setq mrk (spice-search-file-for-subckt
7500 spice-subckt-search-master-filename subckt-args))
7501 (if (and (cdr mrk) (markerp (cdr mrk)))
7502 (progn
7503 (spice-visit-subckt-def mrk)
7504 (message "Used top-level file '%s' to find '%s'"
7505 spice-subckt-search-master-filename subckt-args)
7507 (progn
7508 (message
7509 (format "Couldn't find subcircuit '%s', retry search in top-level file"
7510 subckt-args))
7511 ))))))
7514 ;; ======================================================================
7515 ;; loading of include files of current deck.
7517 (defun spice-load-include-files (&optional non-recursive)
7518 "Loads all files that are included in this deck.
7520 Makes it more easy to load a project. This loading occurs
7521 recursively. Files already loaded are not reloaded or scanned for
7522 .includes. This function is only guaranteed to work when all
7523 included files are not already loaded."
7524 (interactive)
7525 (let ((index-alist (imenu--make-index-alist t))
7526 l filename)
7527 (if (setq l (cdr (assoc spice-imenu-libraries-submenu-name index-alist))) ;; file contains include files/libraries
7528 (while l
7529 (setq filename (expand-file-name
7530 (substitute-in-file-name (car (car l)))))
7531 ;;(message "Trying to load %s" filename)
7532 (if (and (file-readable-p filename)
7533 (not
7534 (assoc filename ;; already loaded
7535 (mapcar
7536 (lambda (buffer)
7537 (cons (buffer-file-name buffer) buffer))
7538 (buffer-list)))))
7539 (with-current-buffer (find-file-noselect filename)
7540 ;; (message "filename is %s" filename)
7541 ;; (spice-mode) ? ref. discussion Manu
7542 (unless (or non-recursive
7543 (not (eq major-mode 'spice-mode)))
7544 (spice-load-include-files))))
7545 (setq l (cdr l))))))
7548 ;; ======================================================================
7549 ;; unloading of spice files except current deck.
7551 (defun spice-unload-other-decks ()
7552 "Kills all other spice files except current one.
7554 Makes it easy to unload a lot of spice files without restarting Emacs."
7555 (interactive)
7556 (save-excursion
7557 (let ((current (current-buffer)))
7558 (mapcar
7559 (lambda (buffer)
7560 (set-buffer buffer)
7561 (if (and (eq major-mode 'spice-mode)
7562 (not (eq current buffer)))
7563 (progn
7564 (message "Killing %s" buffer)
7565 (kill-buffer buffer))))
7566 (buffer-list)))))
7569 ;; ======================================================================
7570 ;; folding for commented out regions ...
7571 ;;; taken from and adapted:
7572 ;;; Filename: foldingo.el
7573 ;;; Author: Christian Queinnec <Christian.Queinnec@lip6.fr>
7574 ;; This is work in progress; (user) interface might change
7576 (defvar spice-some-comment-regions-are-hidden nil
7577 "Keeps track if some comment regions are hidden.")
7578 (make-variable-buffer-local 'spice-some-comment-regions-are-hidden)
7580 (defvar spice-last-hide-comment-regions-tick nil
7581 "Keeps track when last time comment hiding was called.")
7582 (make-variable-buffer-local 'spice-last-hide-comment-regions-tick)
7584 (defun spice-hide-init ()
7585 "Initialize buffer local variables to make hiding of spice regions
7586 effective"
7587 ;; trick to make a comment-start/padding dependent regexp:
7588 (custom-initialize-reset 'spice-hide-line-prefix
7589 (car (get 'spice-hide-line-prefix
7590 'standard-value)))
7591 ;; make sure we have invisibility property working, local for a buffer
7592 (if (fboundp 'add-to-invisibility-spec)
7593 (add-to-invisibility-spec 'spice-mode))
7594 ;; (remove-from-invisibility-spec '(spice-mode . t))
7595 ;; local for buffers:
7596 (set (make-local-variable 'line-move-ignore-invisible) t)
7597 (if spice-auto-hide-comments
7598 (spice-hide-all-comments))
7601 (defun spice-hide (from to)
7602 "Not supported, don't use this."
7603 (interactive "*r")
7604 (spice-hide-region from to t))
7606 (defun spice-unhide (from to)
7607 "Not supported, don't use this."
7608 (interactive "*r")
7609 (spice-hide-region from to nil))
7611 (defun spice-hide-all-comments-p ()
7612 "Checks if there are comments that can be hidden...; assumes that if
7613 the user edited the file, new comments might have been created and
7614 thus hide all comments must be activated. This is not the best
7615 criterion, but it is safe."
7616 ;; (interactive)
7617 ;; (message "buffer tick is %s, last hide comment is %s"
7618 ;; (buffer-modified-tick) spice-last-hide-comment-regions-tick)
7619 (if (and
7620 spice-last-hide-comment-regions-tick ; can be nil
7621 (= spice-last-hide-comment-regions-tick (buffer-modified-tick)))
7622 nil t))
7624 (defun spice-hide-all-comments ()
7625 "Hides all commented out regions in the current spice deck. Allows
7626 to get a better overview of the deck if many lines are commented out.
7627 It relies on having all regions being commented out using the
7628 \"Comment Region\" menu entry that uses `comment-region'. The regexp
7629 used to match comment lines, `spice-hide-line-prefix', might identify
7630 standard spice comment lines used for documentation. To avoid
7631 problems, make sure documentation is not part of comments. For
7632 instance by using the doc starters available in the spice languages,
7633 or by making sure they are different from the comment lines generated
7634 with the menu entry, by placing two *'s when the default comment is
7635 only one *. If you want to unhide all the hidden comment lines, use
7636 `spice-unhide-all-comments'."
7637 (interactive)
7638 (spice-unhide-all-comments)
7639 (setq spice-last-hide-comment-regions-tick (buffer-modified-tick))
7640 (save-excursion
7641 (goto-char (point-min))
7642 ;; (message "beginning of buffer reached %s" (point))
7643 (forward-line)
7644 (while (search-forward-regexp (concat "^" spice-hide-line-prefix)
7645 (point-max) t)
7646 (beginning-of-line)
7647 ;; (message "reached %s" (point))
7648 (let ((beg (point))
7650 lines)
7651 ;; (message "found start of regexp %s" (point))
7652 (setq lines (forward-line))
7653 ;; (message "%s left" lines)
7654 ;; the empty lines following commented lines are also hidden
7655 (while (and (looking-at (concat "^\\(" spice-hide-line-prefix "\\|[ ]*$\\)"))
7656 (= (setq lines (forward-line)) 0))
7657 ;; (message "%s left" lines)
7659 (setq end (point))
7660 (spice-hide-region beg end t))))
7661 (spice-set-spice-name)
7664 (defun spice-unhide-all-comments ()
7665 "Unhides all hidden comment regions."
7666 (interactive)
7667 (setq spice-some-comment-regions-are-hidden nil)
7668 (setq spice-last-hide-comment-regions-tick nil)
7669 (spice-hide-region (point-min) (point-max) nil)
7670 (spice-set-spice-name)) ;; update mode-line
7672 (defun spice-hide-region (from to flag)
7673 "Hides or shows lines from FROM to TO, according to FLAG. If FLAG
7674 is nil then the text is shown, while if FLAG is t the text is hidden."
7675 (let ((inhibit-read-only t))
7676 (save-excursion
7677 (goto-char from)
7678 ; (foldingo-discard-overlays (point) to 'invisible 'spice-comment)
7679 (spice-discard-overlays from to 'spice-comment)
7680 (if flag
7681 (let ((overlay (make-overlay (point) to)))
7682 (spice-make-overlay-hidden overlay))))))
7684 (defun spice-make-overlay-hidden (overlay)
7685 ;; Make overlay hidden and intangible.
7686 ;; (overlay-put overlay 'intangible t)
7687 (overlay-put overlay 'invisible 'spice-mode)
7688 (overlay-put overlay 'spice-comment t)
7689 (setq spice-some-comment-regions-are-hidden t)
7690 ;; (overlay-put overlay 'intangible t)
7693 (defun spice-discard-overlays (from to prop)
7694 "discards overlays in region FROM to TO that have property PROP set."
7695 (let ((inhibit-read-only t))
7696 (save-excursion
7697 (goto-char from)
7698 (while (< (point) to)
7699 (let ((overlays (overlays-at (point))))
7700 (while overlays
7701 (let ((o (car overlays)))
7702 (if (overlay-get o prop)
7703 (delete-overlay o)))
7704 (setq overlays (cdr overlays))))
7705 (goto-char (next-overlay-change (point)))))))
7708 ;; ======================================================================
7709 ;; utility spice-mode-output functions
7711 (defun spice-check-output-mode ()
7712 "Check if current buffer is output file and return symbol or NIL."
7713 (save-excursion
7714 (goto-char (point-min))
7715 (if (looking-at "1\\*\\*\\*\\*\\*\\*\\*") ; eldo
7716 'eldo
7717 (if (or (looking-at "Using: ")
7718 (looking-at " \\*\\*\\*\\*\\*\\* Star-HSPICE")) ; hspice
7719 'hspice
7720 nil))))
7722 (defun spice-output-p ()
7723 "Check if current buffer is output file."
7724 (interactive)
7725 (if spice-output-local t nil))
7727 (defconst spice-output-sections-regexp
7728 (concat
7730 "\\(0\\*\\*\\*\\*\\| \\*\\*\\*\\*\\*\\*\\) *"
7731 "\\( [a-z0-9]\\w*\\(\\s-+\\w+\\)* \\)\\s-+\\(t[a-z]*\\) ?=.*$")
7732 "Regexp identifying spice output headers (both hspice and eldo).")
7734 (defvar spice-output-font-lock-keywords
7735 (list
7736 (list spice-output-sections-regexp
7737 '(1 font-lock-comment-face)
7738 '(2 spice-title-face)
7739 (list 4 spice-constant-face))
7740 (list "^[0-1] ?\\*.*$" 0 font-lock-comment-face)
7741 (list "^ \\(\\*\\*\\*\\*\\*?\\) \\(.*\\)$"
7742 '(1 font-lock-comment-face)
7743 '(2 font-lock-type-face))
7744 (list "^\\(FATAL \\)?ERROR.+$" 0 'font-lock-warning-face) ; eldo errors
7745 (list "^\\s-*\\(..?error..?[: ]\\).+$" 0 'font-lock-warning-face) ; hspice errors
7747 "List of regexps for font-lock in output mode."
7750 (defun spice-mode-output ()
7751 "Spice major mode start up function for spice output files. Experimental ;)"
7753 (setq buffer-read-only t) ; don't want to edit output files, do we
7754 ; common mistake in hspice output files!
7756 ;; use local keymap (for keys and menu)
7757 (use-local-map spice-output-mode-map)
7759 ;; set menu for local buffer
7760 (easy-menu-define spice-output-menu spice-output-mode-map
7761 "Menu keymap for Spice Output Mode." spice-output-menu-list)
7763 ;; font-lock local start-up
7764 (set (make-local-variable 'font-lock-defaults)
7765 (list 'spice-output-font-lock-keywords
7766 nil t (list (cons ?\" "w")))) ; nil, t (do multiline
7767 ; comments)
7769 ;; imenu buffer local init
7770 (set (make-local-variable 'imenu-case-fold-search) t)
7771 (set (make-local-variable 'imenu-generic-expression)
7772 (list (list "*Errors*"
7773 "^\\s-*\\(\\(..?error..?[: ]\\|\\(FATAL \\)?ERROR\\).+$\\)"
7775 (list nil ;; "*Sections*"
7776 spice-output-sections-regexp
7777 2)))
7781 (defun spice-output-filename ()
7782 "Determines output filename of current spice deck."
7783 (interactive)
7784 (let ((filename nil)
7785 (l spice-output-filename-alist))
7786 (while l
7787 (if (spice-standard-p (car (car l)))
7788 (progn
7789 (setq filename (eval (car (cdr (car l)))))
7790 ;; (message "Checking filename %s" filename)
7791 (if (file-readable-p filename)
7792 (setq l nil)
7793 (setq filename nil))))
7794 (setq l (cdr l)))
7795 filename))
7797 (defun spice-output-file-p ()
7798 "Checks if an output file is available for current spice deck."
7799 (interactive)
7800 (and (not spice-output-local)
7801 (buffer-file-name)
7802 (spice-output-filename)))
7804 (defun spice-load-output-file-internal (filename)
7805 "Loads output file into emacs and sets major mode"
7806 (interactive)
7807 (if (and
7808 (stringp filename)
7809 (file-readable-p filename))
7810 (progn
7811 (find-file-other-window filename)
7812 (spice-mode))))
7814 (defun spice-load-output-file ()
7815 "Loads output file into spice, calls `spice-load-output-file-internal'
7816 to do the actual work, this is called from the menu or key binding"
7817 (interactive)
7818 (let (filename)
7819 (setq filename (spice-output-filename))
7820 (spice-load-output-file-internal filename)))
7823 ;; ======================================================================
7824 ;; .guess statement auxiliary functions (eldo !)
7826 (defvar spice-guess-nodeset-statements nil
7827 "holds temp .guess/nodeset statements")
7829 (defun spice-derive-guess-nodeset-statements (from to)
7830 "Derives .guess/nodeset statements from DC operating point
7831 lines. This implements the hspice functionality of .ic0 files for
7832 eldo..."
7833 (save-excursion
7834 (let ( ;; (count 0)
7836 (goto-char (max from to))
7837 (setq m1 (make-marker))
7838 (set-marker m1 (point))
7839 (goto-char (min from to))
7840 (while (re-search-forward "^\\s-*\\(\\S-+\\)\\s-+\\([-0-9\.E+]+\\)"
7841 m1 t)
7842 (progn
7843 ;;(message "Inserting .guess...(%s)" (make-string (incf count) ?.))
7844 ;;(beginning-of-line)
7845 ;;(insert ".guess V(" (match-string 1) ") = " (match-string 2) "\n*")
7846 (setq spice-guess-nodeset-statements
7847 (append spice-guess-nodeset-statements
7848 (list (concat " V("
7849 (match-string-no-properties 1)
7850 ") = "
7851 (match-string-no-properties 2)))
7854 )))))
7856 (defun spice-create-guess-nodeset-file (str)
7857 "Creates a <buffer-file-name>_guess/nodeset.cir file from node
7858 voltage pairs in the current output file."
7859 (interactive)
7860 (setq spice-guess-nodeset-statements nil)
7861 (let (from to outbuf stats filename)
7862 (setq filename (file-name-nondirectory buffer-file-name))
7863 (save-excursion
7864 (goto-char (point-min))
7865 (setq from (re-search-forward "^\\s-+NODE\\s-+VOLTAGE\\s-*$" (point-max) t))
7866 (if from
7867 (setq to (re-search-forward "^$" (point-max) t)))
7868 (if (and from to)
7869 (spice-derive-guess-nodeset-statements from to)))
7870 (if (not spice-guess-nodeset-statements)
7871 (message "Didn't find 'node -- voltage' pairs in output file...")
7872 (setq outbuf
7873 (find-file-noselect (concat
7874 (file-name-sans-extension buffer-file-name)
7875 "_" str ".cir")))
7876 (switch-to-buffer-other-window outbuf)
7877 (erase-buffer)
7878 (insert "* ." str " statements derived from " filename " ["
7879 (format-time-string "%b %d %Y") " " (format-time-string "%T")
7880 "]\n\n")
7881 (setq stats spice-guess-nodeset-statements)
7882 (while stats
7883 (insert ".")
7884 (insert str)
7885 (insert " ")
7886 (insert (car stats))
7887 (insert "\n")
7888 (setq stats (cdr stats)))
7889 (insert "\n\n* ." str " statements derived "
7890 (format-time-string "%b %d %Y") " "
7891 (format-time-string "%T") "\n\n")
7892 (save-buffer)
7893 (goto-char (point-min))
7894 ) ; when
7895 ) ; let
7899 (defun spice-replace-with-guess-statements (from to)
7900 "replace with .guess statements."
7901 (interactive "*r")
7902 (spice-replace-with-guess-nodeset-statements "guess" from to))
7905 (defun spice-replace-with-nodeset-statements (from to)
7906 "replace with .nodeset statements."
7907 (interactive "*r")
7908 (spice-replace-with-guess-nodeset-statements "nodeset" from to))
7911 (defun spice-replace-with-guess-nodeset-statements (str from to)
7912 "Replaces selected region with .guess/nodeset statements."
7913 (interactive)
7914 (setq spice-guess-nodeset-statements nil)
7915 (if (and from to)
7916 (spice-derive-guess-nodeset-statements from to))
7917 (if (not spice-guess-nodeset-statements)
7918 (message "Didn't find any 'node -- voltage' pairs in region...")
7919 (let (stats)
7920 (kill-region from to)
7921 (setq stats spice-guess-nodeset-statements)
7922 (while stats
7923 (insert ".")
7924 (insert str)
7925 (insert " ")
7926 (insert (car stats))
7927 (insert "\n")
7928 (setq stats (cdr stats))))
7932 ;; ======================================================================
7933 ;; fill-prefix related functions
7935 (defvar spice-save-comment-line-break-function nil
7936 "*Mode specific variable to save previous line break function in.")
7938 (defun spice-comment-indent-new-line (&optional soft)
7939 "Spice mode comment-indent-new-line function, used by `auto-fill'. Sets
7940 `fill-prefix' depending on context: comment prefix if in comment with special
7941 layla handling (!); \"!\" doc prefix if in hspice mode; \"$\" doc prefix
7942 in eldo mode, otherwise uses \"+ \" prefix."
7943 (interactive)
7944 (let ((fpx fill-prefix) ; remember prefix
7945 (end (point))) ; don't look beyond point for doc starters
7946 (if (save-excursion
7947 (beginning-of-line)
7949 (looking-at (concat "\\([" comment-start
7950 (when (spice-standard-p 'layla)
7951 spice-continuation-prefix)
7952 (when (spice-standard-p 'hspice)
7953 "$")
7954 (when (spice-standard-p 'eldo)
7955 "!")
7956 "]+\\)"))
7957 (and
7958 (spice-standard-p 'hspice)
7959 (re-search-forward "\\s-\\([$]\\)" end t))
7960 (and
7961 (spice-standard-p 'eldo)
7962 (re-search-forward "\\s-\\([!]\\)" end t))))
7963 (setq fill-prefix (concat (match-string-no-properties 1) " "))
7964 (setq fill-prefix (concat spice-continuation-prefix " ")))
7965 ;(comment-indent-new-line) ;;call standard comment-indent-new-line function
7966 (when spice-save-comment-line-break-function
7967 (funcall spice-save-comment-line-break-function))
7968 (setq fill-prefix fpx)))
7971 (defun spice-fill-context-prefix () ; ???
7972 "Calculates prefix from current position (move-to-left-margin), and
7973 returns it. Non-comment paragraphs can also be filled correctly."
7974 ;; (message "deriving fill prefix")
7975 (let ((result
7976 (if (or (looking-at (concat "\\([" comment-start
7977 (when (spice-standard-p 'layla)
7978 spice-continuation-prefix)
7979 "]+\\)"))
7980 (looking-at "\\([$!]+\\)"))
7981 (concat (match-string-no-properties 1) " ")
7982 (concat spice-continuation-prefix " "))))
7983 ;; (message (format "result is '%s'" result))
7984 result))
7986 (defun spice-delete-indentation (&optional arg)
7987 "Wrapper for `delete-indentation', sets `fill-prefix' to adequate value."
7988 (interactive "*P")
7989 (let ((fillpfx fill-prefix))
7990 (beginning-of-line)
7991 (if arg (forward-line 1))
7992 (if (looking-at "\\([+$!*]+\\)") ;; don't check submodes here ?
7993 (setq fill-prefix (match-string-no-properties 1)))
7994 (delete-indentation)
7995 (setq fill-prefix fillpfx)))
7998 ;; ======================================================================
7999 ;; msb fix (from cperl-mode.el)
8000 (defvar spice-msb-fixed nil) ;; global variable keeping track of addition
8002 (defun spice-msb-fix ()
8003 "Adds \"Spice Decks\" entry in msb menu, assumes that msb is already loaded"
8004 (setq spice-msb-fixed t)
8005 (let* ((l (length msb-menu-cond))
8006 (last (nth (1- l) msb-menu-cond))
8007 (precdr (nthcdr (- l 2) msb-menu-cond)) ; cdr of this is last
8008 (handle (1- (nth 1 last))))
8009 (setcdr precdr (list
8010 (list
8011 '(eq major-mode 'spice-mode)
8012 handle
8013 "Spice Decks (%d)")
8014 last))))
8017 ;; ======================================================================
8018 ;; utility spice-mode functions
8020 (defun spice-about ()
8021 (interactive)
8022 (sit-for 0)
8023 (message "spice-mode version %s, © %s" spice-version spice-developer))
8025 (defun spice-set-spice-name ()
8026 "Set mode line name of spice mode"
8027 (setq mode-name "Spice"))
8029 ;; (defun spice-set-spice-name ()
8030 ;; "Set mode line name of spice mode"
8031 ;; (setq mode-name
8032 ;; (concat
8033 ;; (when (not spice-output-local)
8034 ;; (concat
8035 ;; (when (spice-standard-p 'layla) "Layla")
8036 ;; (when (spice-standard-p 'mondriaan) "-Mdrn")
8037 ;; (when (spice-standard-p 'hspice)
8038 ;; (when (spice-standard-p 'layla) "/"))
8039 ;; (when (spice-standard-p 'hspice) "Hspice")
8040 ;; (when (spice-standard-p 'eldo)
8041 ;; (when (or (spice-standard-p 'hspice)
8042 ;; (spice-standard-p 'layla)) "/"))
8043 ;; (when (spice-standard-p 'eldo) "Eldo")
8044 ;; (when (spice-standard-p 'eldorf) "-RF")
8045 ;; (when (spice-standard-p 'eldovloga) "-VlA")
8046 ;; (when (spice-standard-p 'fasthenry)
8047 ;; (when (or (spice-standard-p 'eldo)
8048 ;; (spice-standard-p 'hspice)
8049 ;; (spice-standard-p 'layla)) "/"))
8050 ;; (when (spice-standard-p 'fasthenry) "FastHenry")
8051 ;; (when (spice-standard-p 'draccdl)
8052 ;; (when (or (spice-standard-p 'eldo)
8053 ;; (spice-standard-p 'hspice)
8054 ;; (spice-standard-p 'layla)
8055 ;; (spice-standard-p 'fasthenry)) "/"))
8056 ;; (when (spice-standard-p 'draccdl) "DracCDL")
8057 ;; (when (spice-standard-p 'spectre)
8058 ;; (when (or (spice-standard-p 'eldo)
8059 ;; (spice-standard-p 'hspice)
8060 ;; (spice-standard-p 'layla)
8061 ;; (spice-standard-p 'fasthenry)
8062 ;; (spice-standard-p 'draccdl)) "/"))
8063 ;; (when (spice-standard-p 'spectre) "Spectre")
8064 ;; (when (or (spice-standard-p 'fasthenry)
8065 ;; (spice-standard-p 'eldo)
8066 ;; (spice-standard-p 'hspice)
8067 ;; (spice-standard-p 'layla)
8068 ;; (spice-standard-p 'draccdl)
8069 ;; (spice-standard-p 'spectre)) "|")))
8070 ;; "Spice"
8071 ;; (when spice-output-local "-output")
8072 ;; (when spice-some-comment-regions-are-hidden " H+"))))
8075 (defun spice-check-spice-standard ()
8076 "checks if spice-standard is set to a correct value."
8077 ;; if mondriaan then also layla
8078 (when (spice-standard-p 'mondriaan)
8079 (unless (spice-standard-p 'layla)
8080 (error "Error: turn on Layla when you want to use Mondriaan")))
8081 ;; if eldoRf then also eldo
8082 (when (spice-standard-p 'eldorf)
8083 (unless (spice-standard-p 'eldo)
8084 (error "Error: turn on Eldo when you want to use Eldo RF")))
8085 ;; if eldo verilog-A then also eldo
8086 (when (spice-standard-p 'eldovloga)
8087 (unless (spice-standard-p 'eldo)
8088 (error "Error: turn on Eldo when you want to use Eldo Verilog-A")))
8091 (defun spice-update-existing-buffers ()
8092 "updates all spice-mode buffers with new customization"
8093 (save-excursion
8094 (let ((current (current-buffer)))
8095 (mapcar
8096 (lambda (buffer)
8097 (set-buffer buffer)
8098 (if (and (eq major-mode 'spice-mode)
8099 (not (eq current buffer)))
8100 (progn
8101 (message "Activating customizations in %s" buffer)
8102 (spice-activate-customizations-local))))
8103 (buffer-list))))
8107 (defun spice-activate-customizations-local ()
8108 "Activates customization (of global variables) in current buffer."
8109 (if (spice-output-p)
8110 (use-local-map spice-output-mode-map)
8111 (use-local-map spice-mode-map))
8112 (spice-set-spice-name)
8113 (spice-update-mode-menu)
8114 (set-syntax-table spice-mode-syntax-table)
8115 (if (not (spice-output-p))
8116 (setq imenu-generic-expression spice-imenu-generic-expression))
8117 (when spice-imenu-add-to-menubar
8118 (imenu-add-to-menubar "Index"))
8119 ;; rebuild menu:
8120 (setq imenu--index-alist nil)
8121 (imenu--make-index-alist t)
8122 (spice-compile-init)
8123 (spice-waveform-viewer-init)
8124 (if (fboundp 'font-lock-unset-defaults)
8125 (font-lock-unset-defaults))
8126 (font-lock-set-defaults)
8127 (font-lock-flush)
8131 (defun spice-activate-customizations-obsolete ()
8132 "Activate all customizations on local variables.
8134 Run this if you set the spice-standard variable to modify
8135 spice-mode's behaviour in the local buffer. It sets up the buffer
8136 local variables using the modified global variables of the
8137 customization buffer."
8138 (interactive)
8139 (if (spice-output-p)
8140 (use-local-map spice-output-mode-map)
8141 (use-local-map spice-mode-map))
8142 ;; (setq spice-standard-local spice-standard)
8143 (spice-set-spice-name)
8144 (spice-menu-init)
8145 (spice-update-mode-menu)
8146 (spice-mode-syntax-table-init)
8147 (set-syntax-table spice-mode-syntax-table)
8148 (spice-keywords-init)
8149 (spice-font-lock-init)
8150 (spice-imenu-init)
8151 (if (not (spice-output-p))
8152 (setq imenu-generic-expression spice-imenu-generic-expression))
8153 ;; add imenu to menubar ?
8154 (when spice-imenu-add-to-menubar
8155 (imenu-add-to-menubar "Index"))
8156 (spice-compile-variables-init)
8157 (spice-compile-init)
8158 (spice-waveform-viewer-init)
8159 (if (fboundp 'font-lock-unset-defaults)
8160 (font-lock-unset-defaults))
8161 ;; (setq font-lock-defaults
8162 ;; (list 'spice-font-lock-keywords nil t (list (cons ?\" "w"))))
8163 (font-lock-set-defaults)
8164 (font-lock-flush))
8167 ;; ======================================================================
8168 ;; spice-mode main entry point
8169 ;; ======================================================================
8170 ;;;###autoload
8171 (defun spice-mode ()
8172 "Major mode for editing spice decks in (X)Emacs.
8174 Entry to Spice mode calls the value of the variable `spice-mode-hook'
8175 with no args, if that value is non-nil after initialization is finished.
8177 Usage & Features:
8178 -----------------
8180 - Comprehensive menu
8182 - Highlighting of (extended) SPICE syntax, with (limited) ERROR notification
8183 Please setup spice-mode to recognize the correct syntax through
8184 customization of the `spice-standard' variable. You can use the menu
8185 entry Spice->Customize->Spice Standard to do this interactively.
8187 - Template insertion (abbrev/electrification) for many spice constructs,
8188 two alternatives are available: Abbrev minor mode and `tempo-complete-tag'
8189 + Abbrevs can be turned on and off via the Settings submenu.
8190 To see the available abbrevs, use `M-x list-abbrevs' or use the menu
8191 after enabling abbrev minor mode. To find out what key sequence
8192 triggers an expand do 'C-h w expand-abbrev'.
8193 + `tempo-complete-tag' is bound to <tab> - for example, type 'M<tab>'
8194 at the beginning of a line and you will be prompted with a complete
8195 Mosfet template. Most tags are pretty straightforward i.e 'C' for a
8196 capacitor, 'L' for an inductance etc...
8197 You can type `C-h v tempo-tags'for a complete list of tags and
8198 associated templates. Note: to insert a real <TAB>, use <C-q TAB> or
8199 <shift TAB>.
8201 - Comment & documentation string handling
8202 + the '*' symbol is used to comment out a whole line - that symbol has
8203 to be at the beginning of a line
8204 + the '!' and '$' symbols are used to document your netlist in eldo
8205 and hspice/layla mode respectively
8206 + menu entry to comment out region/uncomment region
8207 + key bindings for commenting/uncommenting a region as in `auctex-mode'.
8209 - Comment hiding support
8210 + Can hide all commented out regions in a buffer to improve readability
8211 + prefix string is customizable: `spice-hide-line-prefix'.
8212 + custom variable can be set to automatically hide all commented regions
8213 at load time (`spice-auto-hide-comments')
8214 + requires use of doc strings, otherwise also documentation might be
8215 hidden
8216 + When parts of the deck are hidden the string \"H+\" appears in the
8217 modeline.
8219 - Imenu (Index menu and/or shift right click in emacs if configured)
8220 + shows subcircuit definitions
8221 + shows .end statements in submenu
8222 + shows device models in submenus
8223 + shows libraries (.lib/.inc) in submenu
8224 + shows analyses in submenu
8225 + shows sections in submenu
8226 + shows output file sections in menu
8227 + shows LAYLA objects in submenus if layla submode has been enabled
8228 + can be added to the menubar by setting `spice-imenu-add-to-menubar'
8229 (uses `imenu-add-to-menubar' to add an Imenu entry to the menubar).
8231 - File browser using Speedbar (`speedbar') and/or index/sources menu
8233 - .inc/.include/.lib/.libfas access
8234 + through mouse-2 click (`ffap-at-mouse' or `spice-load-file-at-mouse')
8235 + using \\r (ie. <return>), (`ffap')
8236 + through menu entry all include/lib files of a deck can be loaded at
8237 once (`spice-load-include-files'), recursively.
8239 - Searching for .subckt defs: `spice-search-subckt' or `C-c C-s'
8240 + extracts subcircuit name from context
8241 + search history
8242 + mark is set where search has been started if the definition is found
8243 in the same file. Return to mark with `C-u C-<SPC>' (or `C-u C-@')
8244 as with interactive searches (fi `isearch-forward')
8245 + be careful when starting the search from an included file,
8246 correctness can not be guaranteed. Starting a search from
8247 a top-level .cir file gives correct results. The latest used
8248 top-level file is stored (a top-level file contains a .end
8249 statement !), and also searched if the subckt def is not found in
8250 a first pass (for instance when starting from an included file).
8252 - Postscript printing with fontification (through `ps-print' package).
8254 - Addition of Spice Deck submenu in msb mode, see `msb', `spice-msb-fix'.
8256 - Section support (as in eldo-mode):
8257 + add section headers, goto section through menu entries or interactive
8258 + customizable through `spice-section-alist', you can add your
8259 own section headers, alter the list of predefined sections, ...
8260 + Changelog addition through `spice-add-changelog-entry', or
8261 use `C-c a c'.
8263 - Simulator support
8264 + use `spice-simulator' and `spice-simulator-switches' to
8265 select your simulator from `spice-simulator-alist'.
8266 + Support for error parsing of spice3 (batch-mode, -b),
8267 hspice, eldo and spectre. Add your own in spice-mode or through
8268 customization in `.emacs'.
8269 + use local file variables to customize per file as follows:
8270 <<< test.cir >>>
8272 .end
8274 * Local Variables:
8275 * mode: spice
8276 * spice-simulator: \"Hspice\"
8277 * spice-simulator-switches: \"\"
8278 * eval: (spice-set-command)
8279 * End:
8280 <<< test.cir ends here >>>
8282 - Waveform viewer support (beta)
8283 + use `spice-waveform-viewer' and `spice-waveform-viewer-switches' to
8284 select your waveform from `spice-waveform-viewer-alist'.
8285 + Support for interactive (command-line) waveform viewer such as
8286 nutmeg, or batch (GUI) type waveform viewer such as xelga or gsi.
8288 - Output file support
8289 + can load output file from menu (checks if file exists and is readable)
8290 + imenu in output files shows output file sections
8291 + for eldo .chi files: can create <file>_guess.cir files automatically
8292 for inclusion in <file>.cir file through
8293 `spice-create-guess-nodeset-file'
8294 or `spice-replace-with-guess-nodeset-statements'; this speeds up DC
8295 convergence for AC analyses.
8297 - (Fully) customizable
8298 + can select spice compatibility mode:
8299 * spice2g6/3 (default)
8300 * hspice (default)
8301 * eldo (default), RF and verilog-A extensions
8302 * fasthenry (default)
8303 * Dracula CDL
8304 * LAYLA, Mondriaan extensions
8305 * any combination of the above (there are conflicts however, so not
8306 all keyword fontification is correct in the latter case)
8307 + spice-mode font-lock faces
8308 + spice-mode default initialization of empty/new files determined by
8309 `spice-initialize-empty-file', `spice-initialize-template-file',
8310 `spice-default-header' and `spice-initialize-file-function'.
8311 + see the customization examples in the `spice-mode.el' file header
8312 + You can adapt `spice-simulator-alist' for your local site in
8313 `spice-mode.el' or in `.emacs' through customization.
8314 + You can adapt `spice-waveform-viewer-alist' for your local site in
8315 `spice-mode.el' or in `.emacs' through customization.
8316 + You can adapt `spice-section-alist' for your local site in
8317 `spice-mode.el' or in `.emacs' through customization.
8319 - Auto fill minor mode support
8320 + can be turned on from the Settings menu
8321 + auto fill works both for element where the continuation character
8322 is a '+', as well as in comment/doc mode where the continuation
8323 character is a '*', '$' or a '!'.
8324 + uses `fill-column' to determine where to wrap the line
8325 + doesn't use `fill-prefix'. A context dependent prefix is calculated
8326 through the `spice-comment-indent-new-line' function. This function
8327 is used as `comment-line-break-function' instead of the default line
8328 break function (in emacs: `comment-indent-new-line').
8330 - Paragraph support: [a-z] starts dev lines, '+' continues dev lines,
8331 [*!$] start paragraphs.
8333 - Works under GNU Emacs20.6/21.[123].
8336 Do not use a -*- Mode -*- line in a spice deck as the first card in
8337 the deck is defined to be the title card. Rather, autoload spice-mode
8338 through your .emacs file:
8340 (autoload 'spice-mode \"spice-mode\" \"Spice/Layla Editing Mode\" t)
8341 (setq auto-mode-alist (append (list (cons \"\\\\.sp$\" 'spice-mode)
8342 (cons \"\\\\.cir$\" 'spice-mode)
8343 (cons \"\\\\.cdl$\" 'spice-mode)
8344 (cons \"\\\\.chi$\" 'spice-mode) ; output
8345 (cons \"\\\\.mod$\" 'spice-mode)); models
8346 auto-mode-alist))
8348 Alternative methods are provided in the spice-mode.el file header.
8350 Key bindings in highlighted include file lines:
8351 -----------------------------------------------
8353 \\{spice-mode-mouse-map}
8355 Key bindings for other parts in the file:
8356 -----------------------------------------
8358 \\{spice-mode-map}
8360 ;;Key bindings for output files:
8361 ;;------------------------------
8363 ;;\\{spice-output-mode-map}
8366 (interactive)
8367 (kill-all-local-variables) ; important !
8369 (setq major-mode 'spice-mode)
8370 (setq mode-name "Spice")
8372 ;; remember if this file is an output type
8373 (set (make-local-variable 'spice-output-local) (spice-check-output-mode))
8375 ;; set mode name
8376 (spice-set-spice-name)
8378 ;; build global syntax table
8379 (unless spice-mode-syntax-table
8380 (spice-mode-syntax-table-init))
8381 ;; set it for local buffer
8382 (set-syntax-table spice-mode-syntax-table)
8384 ;; initialize global spice keywords, required for output mode !
8385 (unless spice-keywords
8386 (spice-keywords-init))
8388 ;; global font-lock start-up
8389 (unless spice-font-lock-keywords
8390 (spice-font-lock-init))
8392 ;; create global Spice mode menu's: mode-menu and output-mode-menu
8393 (unless (and spice-menu-list spice-output-menu-list)
8394 (spice-menu-init))
8396 ;; global spice-imenu init (not output mode !)
8397 (unless spice-imenu-generic-expression
8398 (spice-imenu-init))
8400 ;; global vars for compile init
8401 (unless spice-compilation-error-regexp-alist
8402 (spice-compile-variables-init))
8404 (set (make-local-variable 'parse-sexp-ignore-comments) nil)
8406 (set (make-local-variable 'tempo-interactive) t)
8407 (set (make-local-variable 'require-final-newline) t) ; hspice empty deck errors
8409 (set (make-local-variable 'comment-start) "*")
8410 (set (make-local-variable 'comment-end) "")
8411 (set (make-local-variable 'comment-start-skip) "\*")
8412 (set (make-local-variable 'comment-multi-line) nil)
8414 ;;------------------------------------------------------------
8415 ;; initialize hiding functions, mix of global and buffer local settings
8416 (spice-hide-init)
8418 (if (spice-output-p)
8419 (spice-mode-output)
8421 ;; use local keymap (for keys and menu)
8422 (use-local-map spice-mode-map)
8424 ;; set menu for local buffer
8425 (easy-menu-define spice-menu spice-mode-map
8426 "Menu keymap for Spice Mode." spice-menu-list)
8428 ;; abbreviations table: buffer local
8429 (setq local-abbrev-table spice-mode-abbrev-table)
8431 ;; buffer local init
8432 (set (make-local-variable 'fill-prefix) nil) ; automatically derived
8433 ;; remove auto-fill-inhibit and added spice-comment-indent... function
8434 ;; (set (make-local-variable 'auto-fill-inhibit-regexp) "^\*[^\.\+].*")
8436 ;; buffer local init for indentation of comment
8437 (set (make-local-variable 'spice-save-comment-line-break-function)
8438 comment-line-break-function)
8439 (set (make-local-variable 'comment-line-break-function)
8440 'spice-comment-indent-new-line)
8441 (set (make-local-variable 'fill-column) 78) ;; was 80
8443 ;; support for paragraphs (is it useful?) ; this is really arbitrary
8444 ;; all buffer local
8445 ;; (set (make-local-variable 'paragraph-start) "^[!$*]-.*$")
8446 ;; (set (make-local-variable 'paragraph-separate) "^[!$*]-.*$")
8447 (set (make-local-variable 'paragraph-start)
8448 "\\([a-z\\.].*\\([\n][+].*\\)*\\|[$]...+\\|[!]...+\\|[ \t\f]*$\\|\\*...+\\|.*\\s-[$!].*$\\)")
8449 ;; (set (make-local-variable 'paragraph-separate) "[a-z$!*]")
8450 (set (make-local-variable 'paragraph-separate) "\\([ \t\f]*\\|.*\\s-[$!].*\\)$")
8451 (set (make-local-variable 'adaptive-fill-regexp) nil)
8452 (set (make-local-variable 'adaptive-fill-function) 'spice-fill-context-prefix)
8453 (set (make-local-variable 'adaptive-fill-first-line-regexp) "[*$!+]\\s-+")
8455 ;; Tempo tags - using 'tempo-local-tags' doesn't work (why??)
8456 (set (make-local-variable 'tempo-tags)
8457 (append spice-tempo-tags tempo-tags))
8459 ;; buffer local font lock
8460 (set (make-local-variable 'font-lock-defaults)
8461 (list 'spice-font-lock-keywords nil t (list (cons ?\" "w")))) ;; nil, t (do multiline comments)
8462 (set (make-local-variable 'font-lock-multiline) t)
8463 (font-lock-set-defaults)
8465 ;; imenu init:
8466 (set (make-local-variable 'imenu-case-fold-search) t)
8467 ;; buffer local imenu init
8468 (set (make-local-variable 'imenu-generic-expression)
8469 spice-imenu-generic-expression)
8471 ;; add speedbar (global, can be moved ?)
8472 (spice-speedbar-init)
8474 ;;------------------------------------------------------------
8475 ;; now hook in 'spice-colorize-libraries (eldo-mode.el)
8476 ;; all buffer local:
8477 (add-hook 'font-lock-after-fontify-buffer-hook
8478 'spice-colorize-libraries-buffer t t) ; not in emacs 20
8479 (add-hook 'after-change-functions 'spice-colorize-libraries t t)
8480 (spice-colorize-libraries-buffer)
8482 ;;------------------------------------------------------------
8483 ;; compile buffer local init
8484 (spice-compile-init)
8486 ;;------------------------------------------------------------
8487 ;; buffer local init
8488 (spice-waveform-viewer-init)
8490 ;; if new file add a default template
8491 (if (and (= (buffer-size) 0)
8492 (not buffer-read-only)
8493 spice-initialize-empty-file
8494 (functionp spice-initialize-file-function))
8495 (funcall spice-initialize-file-function))
8497 ) ;; matches big if (normal spice or spice output mode)
8499 ;; build imenu, buffer local
8500 (imenu--make-index-alist t)
8502 ;; add imenu to menubar, buffer local
8503 (when spice-imenu-add-to-menubar
8504 (imenu-add-to-menubar "Index"))
8506 ;; msb fix, run only once
8507 (and (featurep 'msb) ;; have we got this feature ?
8508 msb-mode ;; is it on ?
8509 (boundp 'msb-menu-cond) ;; still using msb-menu-cond ?
8510 (not spice-msb-fixed) ;; haven't yet added spice decks category ?
8511 (spice-msb-fix)) ;; add category
8513 ;; open describe window, hope this doesn't annoy people too much...
8514 (if spice-show-describe-mode
8515 (save-excursion
8516 (describe-mode) ;; aha...
8517 (setq spice-show-describe-mode nil)) ;; but only once in a session !!
8519 (if spice-echo-intro
8520 (message "Spice mode %s. Type C-h m for documentation." ;; always
8521 spice-version))
8523 ;; run spice-mode hooks
8524 (run-hooks 'spice-mode-hook)
8528 ;; this is sometimes useful
8529 (provide 'spice-mode)
8531 ;;; spice-mode.el ends here
8533 ;;; Local Variables:
8534 ;;; mode:Emacs-lisp
8535 ;;; End: