/spice-mode/spice-mode.el

#
Emacs Lisp | 8679 lines | 7223 code | 774 blank | 682 comment | 271 complexity | 89b5512e5c5904e034ebe8a4bff124e0 MD5 | raw file

Large files are truncated, but you can click here to view the full file

  1. ;;; spice-mode.el --- major mode providing a spice mode hook for fontification
  2. ;;; $Id: spice-mode.el,v 1.100 2007/01/03 16:46:46 vdplasg Exp $
  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: ngspice, gnucap, spice, spice2g6, spice3, eldo, hspice, layla, mondriaan, fasthenry, CDL, spectre compatibility, netlist editing
  8. ;; Filename: spice-mode.el
  9. ;; Version: 1.2.25
  10. ;; Maintainer: Geert A. M. Van der Plas <geert_vanderplas@email.com>
  11. ;; Last-Updated: 01 November 2004
  12. ;; Description: spice file editing
  13. ;; URL: http://spice-mode.4t.com/
  14. ;; old-URL: http://www.esat.kuleuven.ac.be/~vdplas/emacs/
  15. ;; Compatibility: Emacs2[01], (partly tested)XEmacs21
  16. ;; Please send suggestions and bug reports to
  17. ;; mailto:Geert_VanderPlas@email.com
  18. ;; Copyright (C) 1994, MIT Artificial Intelligence Lab
  19. ;; Copyright (C) 1997- Emmanuel Rouat
  20. ;; Copyright (C) 1999- Geert A. M. Van der Plas
  21. ;; This file is free software; you can redistribute it and/or modify
  22. ;; it under the terms of the GNU General Public License as published by
  23. ;; the Free Software Foundation; either version 2, or (at your option)
  24. ;; any later version.
  25. ;; This file is distributed in the hope that it will be useful,
  26. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  27. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  28. ;; GNU General Public License for more details.
  29. ;; You should have received a copy of the GNU General Public License
  30. ;; along with GNU Emacs; see the file COPYING. If not, write to
  31. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  32. ;; INSTALL:
  33. ;; ========
  34. ;; byte compile spice-mode.el to spice-mode.elc (see `byte-compile-file')
  35. ;; put these two files in an arbitrary, but accesible directory
  36. ;; for example: $HOME/emacs, /usr/lib/emacs/site-lisp/ or
  37. ;; /usr/local/lib/emacs/site-lisp/
  38. ;; If you chose a non-standard place to put the files add the following
  39. ;; line to your Emacs start-up file (`.emacs') or custom `site-start.el'
  40. ;; file (replace <directory-name> by the directory where you placed
  41. ;; spice-mode.el and spice-mode.elc):
  42. ;; (setq load-path (cons (expand-file-name "<directory-name>") load-path))
  43. ;; To use spice-mode, add either the following to your `.emacs' file. This
  44. ;; assumes that you will use the .sp, .cir, .ckt, .mod, ... extensions for
  45. ;; your spice source decks and output files:
  46. ;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
  47. ;; (setq auto-mode-alist (append (list (cons "\\.sp$" 'spice-mode)
  48. ;; (cons "\\.cir$" 'spice-mode)
  49. ;; (cons "\\.ckt$" 'spice-mode)
  50. ;; (cons "\\.spc$" 'spice-mode) ; xcircuit output
  51. ;; (cons "\\.spice$" 'spice-mode) ; magic output
  52. ;; (cons "\\.mod$" 'spice-mode)
  53. ;; (cons "\\.cdl$" 'spice-mode)
  54. ;; (cons "\\.chi$" 'spice-mode) ;eldo outpt
  55. ;; (cons "\\.inp$" 'spice-mode))
  56. ;; auto-mode-alist))
  57. ;; Other way to load spice mode (by Andrew Scott):
  58. ;; ;;; Testing for spice-mode (Another spice mode, also works on Spice,
  59. ;; ;;; Eldo, Layla; this one works on GNU Emacs-20.6 issues).
  60. ;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
  61. ;; (add-to-list 'auto-mode-alist '("\\.cir$" . spice-mode))
  62. ;; (add-to-list 'auto-mode-alist '("\\.ckt$" . spice-mode))
  63. ;; (add-to-list 'auto-mode-alist '("\\.inp$" . spice-mode))
  64. ;; (add-to-list 'auto-mode-alist '("\\.spout$" . spice-mode));hspice out
  65. ;; (add-to-list 'auto-mode-alist '("\\.pdir$" . spice-mode))
  66. ;; ;;; Intel formats
  67. ;; (add-to-list 'auto-mode-alist '("\\.[sS][pP]$" . spice-mode))
  68. ;; (add-to-list 'auto-mode-alist '("\\.[sm]?t0$" . spice-mode))
  69. ;; (add-to-list 'auto-mode-alist '("\\.[h]?spice$" . spice-mode))
  70. ;; CUSTOMIZATION:
  71. ;; ==============
  72. ;; use customization to modify the behaviour of spice-mode; add
  73. ;; custom-set-variables to your `.emacs' file, for example:
  74. ;; (custom-set-variables
  75. ;; ; '(spice-initialize-file-function (quote geert-spice-file-header)) ;; use geert-spice-file-header function (not included in this file !)
  76. ;; '(spice-initialize-empty-file t) ;; initialize empty/new spice file
  77. ;; ; '(spice-standard '(spice2g6 (hspice eldo eldorf eldovloga layla))) ;; all 4 modes
  78. ;; '(spice-standard (quote (spice2g6 (hspice eldo)))) ;; hspice and eldo
  79. ;; '(spice-standard (quote (spice2g6 ()))) ;; spice2g6/3 only
  80. ;; '(spice-simulator "Spice3") ;; default simulator
  81. ;; '(spice-waveform-viewer "ngnutmeg") ;; default waveform
  82. ;; '(spice-highlight-keywords nil) ;; less highlighting
  83. ;; '(spice-section-alist ;; add own sections
  84. ;; ;; this is ugly, I know ;)
  85. ;; (append (nth 1 (nth 0 (get 'spice-section-alist 'standard-value)))
  86. ;; (list
  87. ;; (list "My Header" "MY HEADER" nil)
  88. ;; )))
  89. ;; '(spice-use-func-menu t) ;; use func-menu (XEmacs)
  90. ;; '(spice-show-describe-mode nil) ;; don't describe mode at startup
  91. ;; )
  92. ;; This can also be achieved interactively through customizations !
  93. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  94. ;;; Commentary:
  95. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  96. ;; The original spice-mode.el created by C. Vieri has been modified
  97. ;; extensively. These changes have been heavily influenced by the eldo-mode.el
  98. ;; of Emmanuel Rouat (the tempo-templates for one) and the vhdl-mode.el of
  99. ;; Reto Zimmermann and Rodney J. Whitby (the font-locking, the
  100. ;; customization, the menus, ...) Help in understanding 'advanced' lisp
  101. ;; was provided by G. Debyser <geert.debyser@advalvas.be>, our (common) lisp
  102. ;; expert. Since version 0.97 a lot of input/ideas have been provided by
  103. ;; Emmanuel Rouat. Just take a look and search for eldo-mode ;)
  104. ;; This package provides an Emacs major mode for editing SPICE decks.
  105. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  106. ;;; TODO:
  107. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  108. ;; - customization group spice- needs to be improved
  109. ;; activate customizations needs to be looked at (potentially removed)
  110. ;; - fix problem imenu sometimes truncating filenames of include files
  111. ;; by replacing the functionality with own function
  112. ;; - improve Y instance handling. use builtin macromodels, and own development;; models
  113. ;; - ...
  114. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  115. ;;; BUGS:
  116. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  117. ;; - searching for .subckt could be buggy because of user's file structure
  118. ;; - xinstance highlighting is buggy, and probably always will ?
  119. ;; - font-lock expressions are incredibly complicated, and multiple spice
  120. ;; formats are not handled correctly at the same time...
  121. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. ;; If you have any questions about this mode, feel free to contact me
  123. ;; at the following address: geert_vanderplas@email.com. If I find the
  124. ;; time, I can take a look at the problem
  125. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  126. ;; free variables
  127. (defvar fume-function-name-regexp-alist)
  128. (defvar fume-function-name-regexp)
  129. (defvar compilation-file-regexp-alist)
  130. (defvar fume-find-function-name-method-alist)
  131. (defvar fume-menubar-menu-name)
  132. (defvar fume-buffer-menu)
  133. (defvar fume-buffer-name)
  134. (defvar fume-index-method)
  135. (defvar msb-menu-cond)
  136. (defconst spice-version "1.2.26 (12 Dec 2009)"
  137. "Current version of spice mode (spice2g6/spice3/hspice/eldo(rf&verilog-a)/fasthenry/layla/mondriaan/draccdl/spectre).")
  138. (defconst spice-developer
  139. "Geert Van der Plas & Emmanuel Rouat (<geert_vanderplas@email.com>, <emmanuel.rouat@wanadoo.fr>)"
  140. "Current developers/maintainers of spice-mode.")
  141. (defvar spice-running-xemacs (string-match "XEmacs" emacs-version)
  142. "A variable that tells us whether we're in Xemacs or not")
  143. (defvar spice-tempo-tags nil
  144. "List of templates used in spice mode.")
  145. ;; help function
  146. (defun spice-custom-set (variable value &rest functions)
  147. "Set variables as in `custom-set-default' and call FUNCTIONS (if
  148. bound) afterwards."
  149. (if (fboundp 'custom-set-default)
  150. (custom-set-default variable value)
  151. (set-default variable value))
  152. (while functions
  153. (when (fboundp (car functions)) (funcall (car functions)))
  154. (setq functions (cdr functions))))
  155. (defgroup spice nil
  156. "Customizations for Spice mode."
  157. :prefix "spice-"
  158. :link '(url-link "http://spice-mode.4t.com/")
  159. :group 'languages
  160. )
  161. ;;;###autoload
  162. (defcustom spice-mode-hook nil
  163. "*List of hook functions run by `spice-mode' (see `run-hooks')."
  164. :type 'hook
  165. :group 'spice)
  166. ;;;###autoload
  167. (defcustom spice-standard '(spice2g6 (hspice eldo eldorf eldovloga fasthenry)) ; "layla" has been removed
  168. "*Spice standards used.
  169. Basic standard:
  170. Spice2g6 : Original Berkeley Spice (leave this always on!)
  171. Additional standards:
  172. Gnucap : The Gnu Circuit Analysis Package
  173. Hspice (TM) : Commercial Spice, formerly Meta Software, now owned by Synopsys
  174. Eldo (TM) : Commercial Spice, formerly Anacad, now owned by Mentor Graphics
  175. EldoRf (TM) : RF Steady State analyses of Eldo (also turn on Eldo!)
  176. EldoVlogA : Verilog-A extensions to Eldo netlist language (also turn on Eldo!)
  177. FastHenry : Multipole-accelerated inductance analysis program from MIT
  178. Layla : KULeuven LAYLA (layout synthesis) extensions to Spice format
  179. Mondriaan : KULeuven MONDRIAAN (layout synthesis) extensions (also turn on Layla!)
  180. DracCDL (TM): Dracula CDL extensions (Cadence LOGLVS netlists)
  181. Spectre (TM): Spice compatibility of Spectre language (simulator language=spice decks)
  182. "
  183. :type '(list (choice :tag "Basic standard"
  184. (const :tag "Spice2g6" spice2g6))
  185. (set :tag "Additional standards" :indent 2
  186. (const :tag "Hspice" hspice)
  187. (const :tag "Eldo" eldo)
  188. (const :tag "Eldo RF" eldorf)
  189. (const :tag "Eldo Verilog-A" eldovloga)
  190. (const :tag "FastHenry" fasthenry)
  191. (const :tag "Layla" layla)
  192. (const :tag "Mondriaan" mondriaan)
  193. (const :tag "DracCDL" draccdl)
  194. (const :tag "Spectre Spice Compatibility" spectre)))
  195. :set (lambda (variable value)
  196. (spice-custom-set variable value
  197. 'spice-check-spice-standard
  198. 'spice-mode-syntax-table-init
  199. 'spice-keywords-init
  200. 'spice-font-lock-init
  201. 'spice-imenu-init
  202. 'spice-update-existing-buffers))
  203. :group 'spice)
  204. ;;;###autoload
  205. (defcustom spice-imenu-add-to-menubar t
  206. "*Spice mode adds imenu (Index) item to menubar"
  207. :group 'spice
  208. :set (lambda (variable value)
  209. (spice-custom-set variable value
  210. 'spice-update-existing-buffers))
  211. :type 'boolean)
  212. ;;;###autoload
  213. (defcustom spice-use-func-menu nil
  214. "*Spice func menu setting (untested), comparable to imenu"
  215. :group 'spice
  216. :set (lambda (variable value)
  217. (spice-custom-set variable value
  218. 'spice-update-existing-buffers))
  219. :type 'boolean)
  220. ;;;###autoload
  221. (defcustom spice-show-describe-mode nil ; was t
  222. "*Spice mode runs `describe-mode' once at start of spice-mode"
  223. :group 'spice
  224. :type 'boolean)
  225. ;;;###autoload
  226. (defcustom spice-echo-intro t
  227. "*Spice mode echos introductory message on entry to spice-mode"
  228. :group 'spice
  229. :type 'boolean)
  230. (defgroup spice-initialize-file nil
  231. "Customizations for initialization of empty/new spice files."
  232. :group 'spice)
  233. ;;;###autoload
  234. (defcustom spice-initialize-empty-file nil
  235. "*Spice initialize empty/new file setting"
  236. :group 'spice-initialize-file
  237. :type 'boolean)
  238. ;;;###autoload
  239. (defcustom spice-initialize-template-file "~/.spice-default"
  240. "*File containing the default header that is inserted when opening
  241. an empty file (ie. a new file), see also `spice-initialize-empty-file'"
  242. :group 'spice-initialize-file
  243. :type 'file)
  244. ;;;###autoload
  245. (defcustom spice-default-header nil
  246. "*Default header for new Spice netlists, see also `spice-initialize-empty-file'"
  247. :group 'spice-initialize-file
  248. :type 'string)
  249. ;;;###autoload
  250. (defcustom spice-initialize-file-function 'spice-initialize-empty-file
  251. "*Optional initialize function for empty/new files, see also
  252. `spice-initialize-empty-file'. If a different function is specified it
  253. should insert a default header/template in the current buffer. This
  254. function should check which submode is in use with `spice-standard-p'
  255. and adapt its output accordingly. It may also use the `spice-default-header'
  256. variable and insert its contents into the buffer."
  257. :group 'spice-initialize-file
  258. :type 'function)
  259. (defgroup spice-simulate nil
  260. "Customizations for simulation."
  261. :group 'spice)
  262. (defcustom spice-simulator-alist
  263. '(
  264. ;; Spice3; spice3 -b <file.cir>
  265. ;;
  266. ("Gnucap" "gnucap -b" ""
  267. ("\\s-*Error[\t ]+on[ \t]+line[\t ]+\\([0-9]+\\) +:.+"
  268. 0 1 nil (buffer-file-name))
  269. ("Circuit: \\(.*\\)$" 1)) ; spice3 hack, is not the filename, but that's no prob
  270. ;; Hspice; hspice <file.cir>
  271. ;; **error**: only 1 connection at node 0:2
  272. ("Hspice" "hspice" ""
  273. ("\\s-*\\(..?error..?[: ]\\).+" 0 spice-linenum 1 (buffer-file-name))
  274. ("[* ]* [iI]nput [fF]ile: +\\([^ \t]+\\).*$" 1))
  275. ;; Eldo; eldo -i <file.cir>
  276. ;; ERROR 503: MODEL "NMOS": Undeclared model reference.
  277. ("Eldo" "eldo -i" ""
  278. ("\\s-*\\(E[rR][rR][oO][rR] +[0-9]+:\\).*"
  279. 0 spice-linenum 1 (buffer-file-name))
  280. ("Running \\(eldo\\).*$" 1)) ; eldo hack, true filename can not be found
  281. ;; Spectre; spectre <file.cir>
  282. ;; "viblok2.cir" 7: Unknown dot word `.param'.
  283. ("Spectre" "spectre" ""
  284. ("\\s-*\"\\([^ \t\n]+\\)\" +\\([0-9]+\\):.*"
  285. 1 2)
  286. ("" 0)) ; filename is in regexp of error
  287. ;;; Add your local simulators here:
  288. ;;
  289. )
  290. "*List of available Spice simulators and their properties.
  291. Each list entry specifies the following items for a simulator:
  292. Simulator:
  293. Simulator Name : name used in variable `spice-simulator' to choose
  294. simulator
  295. Simulate Command : command including options used for simulation program
  296. Extra switches : extra switches for simulator, after filename
  297. Error Message:
  298. Regexp : regular expression to match error messages
  299. File Subexp Index: index of subexpression that matches the file name
  300. Line Subexp Index: index of subexpression that matches the line number.
  301. use function `spice-linenum' when the line number
  302. is not available
  303. Col Subexp Index : index of subexpression that matches the column number
  304. if not available but `spice-linenum' has been
  305. supplied in the previous field, use 1
  306. File Message:
  307. Regexp : regular expression to match a file name message
  308. File Subexp Index: index of subexpression that matches the file name
  309. See also variable `spice-simulator-switches' to add options to the
  310. simulate command.
  311. Most simulators do not include the file name in the error message, but print
  312. out a file name message in advance. In this case, set \"File Subexp Index\"
  313. to 0 and fill out the \"File Message\" entries.
  314. "
  315. :type '(repeat (list :tag "Simulator" :indent 2
  316. (string :tag "Simulator Name ")
  317. (string :tag "Simulate Command ")
  318. ;(string :tag "From Directory " "./")
  319. (string :tag "Extra Switches ")
  320. (list :tag "Error Message" :indent 4
  321. (regexp :tag "Regexp ")
  322. (integer :tag "File Subexp Index")
  323. (integer :tag "Line Subexp Index"))
  324. (list :tag "File Message" :indent 4
  325. (regexp :tag "Regexp ")
  326. (integer :tag "File Subexp Index"))))
  327. :set (lambda (variable value)
  328. (spice-custom-set variable value
  329. 'spice-menu-init
  330. 'spice-compile-variables-init
  331. 'spice-update-existing-buffers))
  332. :group 'spice-simulate)
  333. ;;;###autoload
  334. (defcustom spice-simulator nil ; example: "Hspice"
  335. "*Spice command, used when compiling buffer with `compile-mode',
  336. see also `spice-simulator-switches'."
  337. :group 'spice-simulate
  338. :type 'string)
  339. ;;;###autoload
  340. (defcustom spice-simulator-switches "" ; example "-noconf"
  341. "*Spice command switches, used when compiling buffer with `compile-mode',
  342. see also `spice-simulator'."
  343. :group 'spice-simulate
  344. :type 'string)
  345. (defcustom spice-waveform-viewer-alist
  346. '(
  347. ;; Nutmeg; nutmeg <waveformdata.dat>
  348. ;;
  349. ("Gwave" "gwave" "" spice-run-silent
  350. (".raw" ".braw" ".ac0" ".tr0" ".sw0" ".W" ".N" ".acs")) ; gwave viewer
  351. ("ngnutmeg" "ngnutmeg" "" spice-run-interactive (".dat" ".ac0" ".tr0")) ; spice3 nutmeg viewer
  352. ("Xelga" "xelga" "" spice-run-silent ".cou") ; xelga eldo viewer
  353. ("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...
  354. ;; ("Awaves2" "echo_awaves" "" spice-run-silent nil) ; awaves hspice viewer
  355. ;;; Add your local waveform viewers here:
  356. ;;
  357. )
  358. "*List of available Waveform viewers and their properties.
  359. Each list entry specifies the following items for a waveform viewer:
  360. Waveform Viewer:
  361. Wave Viewer Name : name used in variable `spice-waveform-viewer' to choose
  362. a waveform viewer
  363. Wave Viewer Command : command including options used for waveform viewer
  364. Extra switches : extra switches for waveform viewer, after filename
  365. See also variable `spice-waveform-viewer-switches' to add options to the
  366. waveform viewer command.
  367. "
  368. :type '(repeat (list :tag "Waveform Viewer" :indent 2
  369. (string :tag "Waveform Viewer Name ")
  370. (string :tag "Waveform Viewing Command ")
  371. (string :tag "Extra Switches ")
  372. (choice :tag "How"
  373. :value spice-run-silent
  374. (function-item spice-run-silent)
  375. (function-item spice-run-interactive)
  376. (function :tag "Other"))
  377. (choice (string :tag "Filename Suffix ")
  378. (function :tag "Function Deriving Filename")
  379. (repeat (list :tag "List of Filename Suffixes")))))
  380. :set (lambda (variable value)
  381. (spice-custom-set variable value
  382. 'spice-menu-init
  383. 'spice-update-existing-buffers))
  384. :group 'spice-simulate)
  385. ;;;###autoload
  386. (defcustom spice-waveform-viewer nil ; example: "ngnutmeg"
  387. "*Spice command, used when starting waveform viewer,
  388. see also `spice-waveform-viewer-switches'."
  389. :group 'spice-simulate
  390. :type 'string)
  391. ;;;###autoload
  392. (defcustom spice-waveform-viewer-switches "" ; example "-b"
  393. "*Spice waveform viewer command switches,
  394. see also `spice-waveform-viewer'."
  395. :group 'spice-simulate
  396. :type 'string)
  397. (defgroup spice-commands nil
  398. "Customizations for commands."
  399. :group 'spice)
  400. ;;;###autoload
  401. (defcustom spice-shell
  402. (if (memq system-type '(ms-dos emx windows-nt))
  403. shell-file-name
  404. "/bin/sh")
  405. "*Name of shell used to parse spice commands."
  406. :group 'spice-commands
  407. :type 'file)
  408. ;;;###autoload
  409. (defcustom spice-shell-command-option
  410. (cond ((memq system-type '(ms-dos emx windows-nt) )
  411. (cond ((boundp 'shell-command-option)
  412. shell-command-option)
  413. ((boundp 'shell-command-switch)
  414. shell-command-switch)
  415. (t
  416. "/c")))
  417. (t ;Unix & EMX (Emacs 19 port to OS/2)
  418. "-c"))
  419. "*Shell argument indicating that next argument is the command."
  420. :group 'spice-commands
  421. :type 'string)
  422. (defgroup spice-hide nil
  423. "Customizations for hiding of comments."
  424. :group 'spice)
  425. ;;;###autoload
  426. (custom-declare-variable 'spice-hide-line-prefix
  427. '(concat
  428. (regexp-quote
  429. (concat comment-start
  430. (if (boundp 'comment-padding)
  431. (if (integerp comment-padding)
  432. (make-string comment-padding ? )
  433. comment-padding)
  434. " ")))
  435. "[a-z\\*!$0-9+\\.]")
  436. "*Regexp string describing lines that are commented out and will be
  437. hidden. The regexp is matched to the beginning of a line, the ^ is
  438. added automatically. The initialization of this variable is handled
  439. in `spice-hide-init', which is after the setting of `comment-start'
  440. and `comment-padding' variables."
  441. :initialize (lambda (variable value)
  442. (message "Deferring initialization of %s with %s to spice-hide-init" variable value)) ; avoid init now, comment-start and padding aren't set yet.
  443. :group 'spice-hide
  444. :type 'string)
  445. ;;;###autoload
  446. (defcustom spice-auto-hide-comments nil
  447. "*Boolean indicating automatic hiding of all commented regions at load time."
  448. :group 'spice-hide
  449. :type 'boolean)
  450. (defgroup spice-section nil
  451. "Customizations for sections."
  452. :group 'spice)
  453. ;; sections (entirely different implementation but sections idea has
  454. ;; been taken from eldo-mode.el)
  455. ;;;###autoload
  456. (defcustom spice-section-alist
  457. '(
  458. ;; Libraries
  459. ("Libraries" "LIBRARIES" nil) ;
  460. ;; Netlist
  461. ("Netlist" "NETLIST" nil) ;
  462. ;; Main Circuit
  463. ("Main Circuit" "MAIN CIRCUIT" nil) ;
  464. ;; Options
  465. ("Options" "SIMULATION OPTIONS" nil) ;
  466. ;; Supplies
  467. ("Supplies" "SUPPLIES/REFERENCES" nil) ;
  468. ;; Input Signals
  469. ("Input Signals" "INPUT SIGNALS" nil) ;
  470. ;; DC Analysis
  471. ("DC Analysis" "DC ANALYSIS" nil) ;
  472. ;; AC Analysis
  473. ("AC Analysis" "AC ANALYSIS" nil) ;
  474. ;; Transient Analysis
  475. ("Transient Analysis" "TRANSIENT ANALYSIS" nil) ;
  476. ;;; Add your site-local spice sections here:
  477. ;;
  478. )
  479. "*List of valid sections in a Spice file and their options.
  480. Each list entry specifies the following items for a section:
  481. Section:
  482. Section Name : name used in to select/create find section, make this
  483. name short and descriptive.
  484. Section String : string used in file to start section (usually all
  485. uppercase variant of name).
  486. Extra switches : extra switches for a section, unspecified for now."
  487. :type '(repeat (list :tag "Section" :indent 2
  488. (string :tag "Section Name ")
  489. (string :tag "Section String ")
  490. (sexp :tag "Extra Switches (nil)")))
  491. :set (lambda (variable value)
  492. (spice-custom-set variable value
  493. 'spice-keywords-init
  494. 'spice-font-lock-init
  495. 'spice-menu-init
  496. 'spice-imenu-init
  497. 'spice-update-existing-buffers))
  498. :group 'spice-section)
  499. (defgroup spice-faces nil
  500. "Customizations for highlighting."
  501. :group 'spice)
  502. ;;;###autoload
  503. (defcustom spice-highlight-keywords t
  504. "*Non-nil means highlight SPICE keywords and other standardized words.
  505. The following faces are used:
  506. `spice-title-face' : title (first line in a spice file)
  507. `spice-doc-face' : doc strings
  508. `spice-analysis-face' : analyses
  509. `spice-instance-name-face' : instance/element names
  510. `spice-model-name-face' : subckt model names
  511. `spice-layla-function-name-face': layla function names
  512. `spice-include-file-face' : include files and libraries
  513. `font-lock-keyword-face' : keywords
  514. `font-lock-warning-face' : warnings
  515. `font-lock-comment-face' : comment
  516. `font-lock-function-name-face': subcircuit references / names of objects
  517. `font-lock-type-face' : types
  518. `font-lock-string-face' : strings & include files
  519. `font-lock-constant-face' : simulator's options
  520. `font-lock-variable-name-face': names of .param's & variables
  521. NOTE: Activate the new setting in a spice buffer by re-fontifying it (menu
  522. entry \"Fontify Buffer\"). XEmacs: turn off and on font locking."
  523. :type 'boolean
  524. :group 'spice-faces)
  525. ;; We try to use usual/standard font-lock faces, plus a few specific ones:
  526. (custom-add-to-group
  527. 'spice-faces 'font-lock-comment-face 'custom-face)
  528. (custom-add-to-group
  529. 'spice-faces 'font-lock-keyword-face 'custom-face)
  530. (custom-add-to-group
  531. 'spice-faces 'font-lock-type-face 'custom-face)
  532. (custom-add-to-group
  533. 'spice-faces 'font-lock-function-name-face 'custom-face)
  534. (custom-add-to-group
  535. 'spice-faces 'font-lock-variable-name-face 'custom-face)
  536. (custom-add-to-group
  537. 'spice-faces 'font-lock-warning-face 'custom-face)
  538. (custom-add-to-group
  539. 'spice-faces 'font-lock-string-face 'custom-face)
  540. (defgroup spice-output nil
  541. "Customizations for spice output file handling."
  542. :group 'spice)
  543. ;;;###autoload
  544. (defcustom spice-output-filename-alist
  545. '(
  546. ;; Libraries
  547. (eldo (concat (file-name-sans-extension (buffer-file-name)) ".chi")) ;
  548. (hspice (concat (file-name-sans-extension (buffer-file-name)) ".lis")) ;
  549. (hspice (concat (file-name-sans-extension (buffer-file-name)) ".spout")) ;
  550. (hspice (concat (file-name-sans-extension (buffer-file-name)) ".hspout")) ;
  551. (spice2g6 (concat (file-name-sans-extension (buffer-file-name)) ".out")) ;
  552. )
  553. "*List of valid output names depending on selected spice standard:
  554. Spice Standard : one of spice2g6, hspice, eldo or layla
  555. Expression : expression calculating the output filename
  556. "
  557. :type '(repeat (list :tag "Output Filenames" :indent 2
  558. (symbol :tag "Spice Standard ")
  559. (sexp :tag "Expression ")))
  560. :group 'spice-output)
  561. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  562. ;; buffer local vars for spice-mode
  563. ;;(defvar spice-standard-local nil
  564. ;; "buffer local version of spice-standard.")
  565. (defvar spice-output-local nil
  566. "buffer local version of spice-output.")
  567. (defun spice-standard-p (standard)
  568. "Check if STANDARD is specified as used standard on local variable."
  569. (or (eq standard (car spice-standard))
  570. (memq standard (cadr spice-standard))))
  571. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  572. ;; regexps for spice mode
  573. (defconst spice-continuation-prefix "+"
  574. "Continuation prefix for normal spice line")
  575. (defconst spice-line-break "\\(\n\\s-*\\+\\s-*\\)*"
  576. "Regexp that matches a (possible) line break (\n+)")
  577. (defconst spice-model-name "\\([a-z][^ \t\n=]*\\)" ; "\\([a-z]\\sw*[^ \t\n=]*\\)"
  578. "Regexp that describes a syntactically correct model or subckt name")
  579. (defconst spice-library-regexp-start
  580. "^\\.\\(inc\\|include\\|verilog\\|use_veriloga\\|lib\\(\\s-+key=\\w+\\)?\\|libfas\\|subckt\\s-+lib\\|model\\s-+lib\\)\\s-+[\"']?"
  581. "Regexp that matches the beginning of library or include filename")
  582. (defconst spice-library-regexp-end
  583. "\\([^ \t\n\"']*\\)"
  584. "Regexp that matches the end of library or include filename") ; doesn't catch end of buffer
  585. (defconst spice-section-regexp-start "\\(^[*!$]\\s-*\\)"
  586. "spice mode section header start regexp.")
  587. (defconst spice-spice2g6-keywords
  588. '(
  589. "subckt"
  590. "print" "plot"
  591. "opt" ; opt is actually a spice3 keyword, not 2g6
  592. "nodeset"
  593. "model" "macro" "include" ; include is actually a spice3 keyword, not 2g6
  594. "ends" "end"
  595. )
  596. "List of Spice2g6 keywords")
  597. (defconst spice-spice2g6-analyses
  598. '(
  599. "tran" "op" "noise" "four" "disto" "dc" "ac"
  600. )
  601. "List of Spice2g6 analysis keywords")
  602. (defconst spice-spice2g6-analysis-modifiers
  603. '(
  604. "dec" "lin" "oct" ;; the ubiquitous spice2g6 ac modifiers
  605. "pol" "zer" "pz" "cur" "vol" ;; pz analysis spice3
  606. "ac" ;; .sens analysis spice3
  607. )
  608. "List of Spice2g6 analysis modifier keywords")
  609. (defconst spice-eldo-keywords
  610. '(
  611. "width" "use" "unprotect" "tvinclude" "topcell"
  612. "table" "subdup" "solve" "sinus" "sigbus"
  613. "setsoa" "setbus" "save" "restart" "ramp"
  614. "protect" "probe" "plotbus"
  615. "param" "overwrite_input" "optwind" "optpwl" "optnoise" "options"
  616. "option" "optfour"
  617. "notrc" "nocom" "modlogic"
  618. "moddup" "meas" "mcmod" "lotgroup" "loop" "load"
  619. "libfas" "lib" "init" "include" "ic" "hier" "guess" "global"
  620. "extract" "endl" "enddata" "dspf_include" "distrib" "del"
  621. "defwave" "defplotdig" "defmac" "data" "d2a" "comchar" "conso" "connect"
  622. "chrsim" "chrent" "chrand" "checksoa" "checkbus" "alter" "addlib" "a2d"
  623. )
  624. "List of Eldo keywords")
  625. (defconst spice-eldo-colon-keywords
  626. '(
  627. "param" "pin" "model"
  628. )
  629. "List of Eldo colon keywords")
  630. (defconst spice-eldo-macromodel-keywords
  631. '(
  632. "opamp0" "opamp0d" "opamp1" "opamp1d" "opamp2" "opamp2d"
  633. "satr" "satv" "vswitch" "cswitch"
  634. "tri2sin" "stairgen" "sawgen" "trigen"
  635. "amm" "pam"
  636. "sa_ho" "tr_ho"
  637. "pwm" "vco"
  638. "peak_d" "lev_d"
  639. "logamp" "expamp"
  640. "diff" "integ"
  641. "add" "sub" "mult" "div"
  642. "sc_ideal" "sc_i" "sc_n" "sc_p" "sc_s1" "sc_s2"
  643. "sc_sp1" "sc_sp2" "sc_b" "sc_u"
  644. )
  645. "List of Eldo macromodels")
  646. (defconst spice-eldo-analyses
  647. '(
  648. "wcase" "tf" "temp"
  649. "step" "snf" "sens" "pz"
  650. "noisetran" "mc"
  651. )
  652. "List of Eldo analysis keywords")
  653. (defconst spice-eldo-analysis-modifiers
  654. '(
  655. )
  656. "List of Eldo analysis modifier keywords")
  657. (defconst spice-eldorf-keywords
  658. '(
  659. "sst"
  660. )
  661. "List of Eldo RF keywords")
  662. (defconst spice-eldovloga-keywords
  663. '(
  664. "verilog" "use_veriloga"
  665. )
  666. "List of Eldo Verilog-A keywords")
  667. (defconst spice-eldovloga-colon-keywords
  668. '(
  669. "port" "generic"
  670. )
  671. "List of Eldo Verilog-A colon keywords")
  672. (defconst spice-eldorf-analyses
  673. '(
  674. "sstac" "sstxf" "sstnoise"
  675. )
  676. "List of Eldo RF keywords")
  677. (defconst spice-hspice-keywords
  678. '(
  679. "width" "unprot" "unprotect" "uic"
  680. "title" "sys" "system" "save"
  681. "sample" "prot" "protect"
  682. "probe" "pc" "parameter"
  683. "param" "options" "option"
  684. "nomod"
  685. "measure" "meas" "macro"
  686. "load" "lib" "include" "inc" "ic" "graph" "global"
  687. "eom" "enddata" "dellib" "delete"
  688. "del" "dcvolt" "data" "control" "comment"
  689. "alter"
  690. "fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
  691. )
  692. "List of Hspice keywords")
  693. (defconst spice-hspice-analyses
  694. '(
  695. "disto"
  696. "fft"
  697. "tf" "temp"
  698. "net" ;; S, Z, Y and H parameters
  699. "sample"
  700. "sens"
  701. "pz"
  702. "noise"
  703. )
  704. "List of Hspice analysis keywords")
  705. (defconst spice-hspice-analysis-modifiers
  706. '(
  707. "sweep" "poi"
  708. )
  709. "List of Hspice analysis modifier keywords")
  710. (defconst spice-fasthenry-keywords
  711. '(
  712. "units" "default" "external" "equiv"
  713. )
  714. "List of FastHenry keywords")
  715. (defconst spice-fasthenry-analyses
  716. '(
  717. "freq"
  718. )
  719. "List of FastHenry analysis keywords")
  720. (defconst spice-fasthenry-analysis-modifiers
  721. '(
  722. )
  723. "List of FastHenry analysis modifier keywords")
  724. (defconst spice-layla-keywords
  725. '(
  726. "stop" "start"
  727. "port" "performance" "parameter"
  728. "param" "options" "option"
  729. "net"
  730. "model" "matching"
  731. "include" "inc"
  732. "bus"
  733. )
  734. "List of Layla keywords")
  735. (defconst spice-mondriaan-keywords
  736. '(
  737. "master" "routingarea" "routingchannel" "ports" "portgrid" "net"
  738. )
  739. "List of Mondriaan keywords")
  740. (defconst spice-draccdl-keywords
  741. '(
  742. "bipolar" "busdelimiter" "capa" "caparea" "capval" "default" "dioarea"
  743. "dioperi" "diode" "edifdelimiter" "busdelimiter" "equation" "equiv"
  744. "gnonswap" "ldd" "mega" "nonswap" "nopin" "nosub" "pin" "pininfo"
  745. "resi" "ressize" "resval" "reverse" "scale" "spice" "unspec"
  746. "eom" "global" "param" "macro" "swap"
  747. )
  748. "List of Dracula CDL keywords")
  749. (defconst spice-spice2g6-types
  750. '(
  751. "ac" "dc" "exp" "pulse" "pwl" "sffm" "sin"
  752. )
  753. "List of types in spice2g6")
  754. (defconst spice-hspice-types
  755. '(
  756. "metal" "dielectric" "pec" "rectangle" "circle" "strip" "polygon" ;; ""
  757. )
  758. "List of types in hspice")
  759. (defconst spice-eldo-types
  760. '(
  761. "pattern"
  762. )
  763. "List of source types in eldo")
  764. (defconst spice-eldorf-types
  765. '(
  766. "fpulse" "four" "probe"
  767. )
  768. "List of source types in eldorf")
  769. (defconst spice-fasthenry-types
  770. '(
  771. "point" "rect" "circle"
  772. "user1" "user2" "user3" "user4" "user5" "user6" "user7"
  773. )
  774. "List of source types in fasthenry")
  775. (defconst spice-special-model-type-names
  776. '(
  777. "d" "npn" "pnp" "nmos" "pmos"
  778. )
  779. "List of model type names which are excluded for imenu")
  780. (defconst spice-spice2g6-model-type-names
  781. '(
  782. "r" "c" "urc" "ltra"
  783. "njf" "pjf"
  784. "nmf" "pmf"
  785. "sw" "csw"
  786. )
  787. "List of model type names in spice2g6")
  788. (defconst spice-eldo-model-type-names
  789. '(
  790. "res" "cap" "ind"
  791. "rn" "rp" "lpnp"
  792. )
  793. "List of model type names extra in eldo")
  794. (defconst spice-eldo-vloga-model-type-names
  795. '(
  796. "macro"
  797. )
  798. "List of model type names extra in Eldo Verilog-A")
  799. (defconst spice-hspice-model-type-names
  800. '(
  801. "l" "core" "w" "plot"
  802. )
  803. "List of model type names extra in hspice")
  804. (defconst spice-spice2g6-output-keywords
  805. '("print" "plot")
  806. "List of output keywords in spice2g6")
  807. (defconst spice-spice2g6-output-types
  808. '("ac" "dc" "tran")
  809. "List of output types in spice2g6")
  810. (defconst spice-eldo-output-keywords
  811. '("extract" "meas")
  812. "List of output keywords in eldo")
  813. (defconst spice-eldo-output-types
  814. '("dcac" "dcsweep" "dctran" "noise" "four" "sweep")
  815. "List of output types in eldo")
  816. (defconst spice-eldorf-output-types
  817. '("fsst" "tsst" "sstac" "sstxf" "ssnoise" )
  818. "List of output types in eldo")
  819. (defconst spice-hspice-output-keywords
  820. '("probe" "graph" "measure")
  821. "List of output keywords in hspice")
  822. (defconst spice-hspice-output-types
  823. '("noise" "disto")
  824. "List of output types in hspice")
  825. (defconst spice-spice2g6-options-keywords
  826. '("trytocompact")
  827. "List of spice2g6/3 options keywords.")
  828. (defconst spice-eldo-options-keywords
  829. '("wsf" "wsfascii" "sda"
  830. "precise" "spi3asc" "spi3bin" "spicedc" "spiout" "libfas" "nolib"
  831. "ammeter" "msgbias" "nowarn" "ulogic" "aspec" "mod4pins" "modwl" "wl"
  832. "captab" "coustep" "input" "lcapop" "list" "noascii" "ascii"
  833. "autostop" "nobound_phase" "nocou" "node" "nomod" "nopage" "nosizechk"
  834. "notrc" "trap" "smooth" "be" "gear" "newton" "iem" "analog" "digital"
  835. "osr" "mixed" "pstran" "dptran" "itl6" "itl7" "itl8" "nmaxsize"
  836. "noconvassist" "nolat" "pivrel" "pivtol" "qtrunc" "noconvassist"
  837. "nolat" "pivrel" "pivtol" "qtrunc" "relvar" "splitc" "noswitch"
  838. "unbound" "randmc" "usedefap" "engnot" "nodcpart" "probeop"
  839. "noprobeop" "histlim" "wbulk" "noinit" "nonoise" "tempcouk" "nofnsiem"
  840. "icdc" "icdev" "carlo_gauss" "cteprec" "d2dmvl9bit" "defconvmsg"
  841. "maxnodeord" "notrclib" "motorola" "aex")
  842. "List of eldo options keywords.")
  843. (defconst spice-eldorf-options-keywords
  844. '("sst_freqdiv")
  845. "List of Eldo RF options keywords.")
  846. (defconst spice-hspice-options-keywords
  847. '("acct" "converge"
  848. "absh" "acout" "cds" "scale" "cshdc" "alt999" "alt9999" "csdf"
  849. "accurate" "dvdt" "measout" "acout" "brief" "cshunt" "gshunt" "probe"
  850. "kcltest" "dctran" "di" "itl5" "list" "sda" "gshunt" "cshunt" "post"
  851. "node" "noelck" "gshunt" "maxamp" "nomod" "aspec" "icsweep" "relh"
  852. "nopage" "newtol" "reli" "notop" "parhier" "off" "spice" "wl"
  853. "dvtr" "nxx" "seed" "risetime" "imax" "nopiv" "imin" "opts" "cscal"
  854. "vntol" "absv" "pathnum" "badchr" "fmax" "plim" "diagnostic" "pivref"
  855. "fscal" "autostop" "nowarn" "gscal" "search" "lscal" "bypass" "verify"
  856. "sparse" "pivot" "pzabs" "cpu" "pztol" "fast" "interp" "h9007" "expli"
  857. "ritol" "itlpz" "itrprt" "unwrap" "captab" "newtol" "dccap")
  858. "List of hspice options keywords.")
  859. (defconst spice-spice2g6-options-parameters
  860. '("gmin" "reltol" "abstol" "vntol" "trtol" "chgtol" "pivtol" "pivrel"
  861. "tnom" "temp" "lvlcod" "itl1" "itl2" "itl3" "itl4" "itl5" "defl"
  862. "defw" "defad" "defas" "method")
  863. "List of spice2g6/3 options parameters.")
  864. (defconst spice-eldo-options-parameters
  865. '("cptime" "msgnode" "zoomtime" "bsim3ver" "defnrd" "defnrs" "defpd" "defps"
  866. "gramp" "scale" "scalebsim" "scalm" "soiback" "flicker_noise"
  867. "thermal_noise" "cousmp" "limprobe" "ascii" "savetime" "simudiv"
  868. "stat" "timediv" "maxord" "bloc" "epsdig" "absvar" "capanw" "chgtol"
  869. "dvdt" "eps" "fluxtol" "freqsmp" "ft" "hmin" "hmax" "itol" "lvltim"
  870. "maxnodes" "maxtran" "maxv" "netsize" "ngtol" "ratprint" "reltrunc"
  871. "sample" "startsmp" "step" "trtol" "tuning" "vmin" "vntol" "xa"
  872. "numdgt" "dcpart" "couresol" "defa2d" "defd2a" "vbcsat" "dclog" "epso"
  873. "optype")
  874. "List of eldo options parameters.")
  875. (defconst spice-eldorf-options-parameters
  876. '("sst_start" "sst_stop" "sst_nper"
  877. "sst_npt" "sst_ovrsmp" "sst_spectrum" "sst_uic"
  878. "sst_max_liniter" "sst_verbose")
  879. "List of Eldo RF options parameters.")
  880. (defconst spice-hspice-options-parameters
  881. '("artist" "dcap" "absh" "absvar" "absi" "absv" "delmax" "absmos"
  882. "dcfor" "dchold" "fs" "mentor" "absvdc" "dcon" "ft" "co" "reltol" ; "post"
  883. "cvtol" "di" "dcstep" "imin" "ingold" "imax" "lennam" "psf" "maxamp"
  884. "dv" "defl" "relh" "gmax" "relvar" "measdgt" "zuken" "defnrd" "reli"
  885. "gmindc" "rmax" "defnrs" "relmos" "gramp" "rmin" "defpd" "relv"
  886. "slopetol" "defps" "relvdc" "timeres" "limpts" "scalm" "relq" "numdgt"
  887. "resmin" "optlst" "trtol" "genk" "pivot" "sparse" "lvltim" "klim"
  888. "maxord" "post_version" "bkpsiz" "mu" "xmu" "warnlimit" "expli"
  889. "bytol" "cptime" "epsmin" "mbypass" "expmax" "limtim" "vfloor")
  890. "List of hspice options parameters.")
  891. (defconst spice-layla-options-parameters
  892. '("begin_temp_iterations" "begin_acc_prob" "min_temp_scale_factor"
  893. "max_temp_scale_factor" "max_inner_loop_delta" "max_cost_delta"
  894. "min_range_scale_factor" "nr_temp_steps"
  895. "min_stable_inner_loops" "min_local_iterations" "max_local_iterations"
  896. "max_iterations" "bank_min_ar" "bank_max_ar" "bank_orientations"
  897. "bank_routing_space" "bus_sides" "bus_layer" "bus_port_width"
  898. "bus_port_height" "bus_port_distance" "bus_routing_space" "cap_min_ar"
  899. "cap_max_ar" "cap_orientations" "cap_routing_space" "cap_ar_step"
  900. "coil_orientations" "coil_routing_space" "alfa_area"
  901. "alfa_performance" "alfa_aspect_ratio" "alfa_overlap" "alfa_overlap_min"
  902. "alfa_overlap_max" "kappa_overlap" "device_min_ar" "device_max_ar"
  903. "device_orientations" "device_routing_space" "device_current"
  904. "diode_min_ar" "diode_max_ar" "diode_orientations"
  905. "diode_routing_space" "diode_current" "matching_compute_method"
  906. "dummy_min_ar" "dummy_max_ar" "dummy_orientations"
  907. "dummy_routing_space" "dummy_ar_step"
  908. "mos_min_ar" "mos_max_ar" "mos_orientations" "mos_routing_space"
  909. "mos_current" "prob_reshape" "prob_reorientation"
  910. "prob_symmetric_translation" "prob_symmetric_swap"
  911. "prob_symmetric_flip" "prob_symmetric_flip" "prob_symmetric_shift"
  912. "prob_independent_translation" "prob_independent_swap"
  913. "prob_independent_flip" "min_move_range" "net_compute_method"
  914. "write_init" "write_int" "int_write_interval" "write_fin" "write_final"
  915. "mentor_write_ipc" "gds2_write_ipc" "construct_net_performance"
  916. "construct_matching_performance" "aspect_ratio" "field_grow_factor"
  917. "field_aspect_ratio" "disable_symmetry" "disable_matching"
  918. "do_kul_routing" "kul_router_program" "kul_router_directives_file"
  919. "number_of_randomize_loops" "port_inherit_terminals" "bus_priority"
  920. "port_sides" "port_layer" "port_width" "port_height" "port_distance"
  921. "port_abutment" "port_routing_space" "port_no_routing" "port_current"
  922. "res_ar_step" "res_min_ar" "res_max_ar" "res_orientations"
  923. "res_routing_space" "res_width" "res_current" "disable_couple_flipping"
  924. "symmetry_max_offset_factor" "print_cost" "placement_name"
  925. "write_final_ample" "write_final_skill" "write_final_gds2_bin"
  926. "write_final_gds2_cells" "write_final_tud"
  927. "write_final_ample_generators" "write_final_ample_cells"
  928. "write_final_cif" "write_final_rose" "write_final_kul"
  929. "write_final_text"
  930. "write_int_ample" "write_int_skill" "write_int_gds2_bin"
  931. "write_int_gds2_cells" "write_int_tud" "write_int_ample_generators"
  932. "write_int_ample_cells" "write_int_cif" "write_int_rose"
  933. "write_int_kul" "write_int_text"
  934. "write_init_ample" "write_init_skill" "write_init_gds2_bin"
  935. "write_init_gds2_cells" "write_init_tud" "write_init_ample_generators"
  936. "write_init_ample_cells" "write_init_cif" "write_init_rose"
  937. "write_init_kul" "write_init_text" "time_out"
  938. "random_seed" "anneal_rs" )
  939. "List of LAYLA options parameters.")
  940. (defconst spice-layla-functions
  941. '(
  942. "bus_double_param" "bus_integer_param" "bus_string_param"
  943. "device_double_param" "device_integer_param" "device_string_param"
  944. "net_double_param" "net_integer_param" "net_string_param"
  945. "placement_double_param" "placement_integer_param" "placement_string_param"
  946. "port_double_param" "port_integer_param" "port_string_param"
  947. "symmetry_double_param" "symmetry_integer_param" "symmetry_string_param"
  948. )
  949. "List of functions in Layla mode")
  950. (defconst spice-draccdl-device-keywords
  951. '("nonswap" )
  952. "List of Dracula CDL device keywords.")
  953. (defconst spice-draccdl-device-parameters
  954. '("w" "l" "sub" "ea" ;; CDL parameters
  955. "x" "y") ;; added X&Y, dracula extracts them (not CDL!)
  956. "List of Dracula & CDL device parameters.")
  957. (defconst spice-spice2g6-entity-start-keywords
  958. '(
  959. "ends" "macro" "subckt"
  960. )
  961. "List of spice2g6 entity start keywords")
  962. (defconst spice-eldo-entity-start-keywords
  963. '(
  964. "endl"
  965. )
  966. "List of eldo entity start keywords")
  967. (defconst spice-hspice-entity-start-keywords
  968. '(
  969. "endl" "eom"
  970. "fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
  971. )
  972. "List of hspice entity start keywords")
  973. (defconst spice-layla-entity-start-keywords
  974. '(
  975. "bus" "net" "symmetry" "performance" "port"
  976. )
  977. "List of layla entity start keywords")
  978. (defconst spice-mondriaan-entity-start-keywords
  979. '(
  980. "routingarea" "routingchannel" ;; "net" ; already in layla
  981. )
  982. "List of mondriaan entity start keywords")
  983. (defconst spice-draccdl-entity-start-keywords
  984. '(
  985. "eom"
  986. )
  987. "List of DracCDL entity start keywords")
  988. (defvar spice-keywords nil
  989. "List of spice mode keywords.")
  990. (defvar spice-colon-keywords nil
  991. "List of spice mode colon keywords.")
  992. (defvar spice-analyses nil
  993. "List of spice mode analyses.")
  994. (defvar spice-analysis-modifiers nil
  995. "List of spice mode analysis modifiers.")
  996. (defvar spice-types nil
  997. "List of spice mode standardized types.")
  998. (defvar spice-functions nil
  999. "List of spice mode functions.")
  1000. (defvar spice-section-headings nil
  1001. "List of spice mode section headings.")
  1002. (defvar spice-misc-model-type-names nil
  1003. "List of miscellaneous model type name.")
  1004. (defvar spice-model-type-names nil
  1005. "List of all model type name.")
  1006. (defvar spice-output-keywords nil
  1007. "List of all output keywords.")
  1008. (defvar spice-output-types nil
  1009. "List of all output types.")
  1010. (defvar spice-options-keywords nil
  1011. "List of all output options keywords.")
  1012. (defvar spice-options-parameters nil
  1013. "List of all output options parameters.")
  1014. (defvar spice-entity-start-keywords nil
  1015. "List of entity definition keywords.")
  1016. (defvar spice-keywords-regexp nil
  1017. "Regexp for keywords.")
  1018. (defvar spice-colon-keywords-regexp nil
  1019. "Regexp for colon keywords.")
  1020. (defvar spice-analyses-regexp nil
  1021. "Regexp for analyses.")
  1022. (defvar spice-analysis-modifiers-regexp nil
  1023. "Regexp for analysis modifiers.")
  1024. (defvar spice-layla-keywords-regexp nil
  1025. "Regexp for layla keywords.")
  1026. (defvar spice-mondriaan-keywords-regexp nil
  1027. "Regexp for mondriaan keywords.")
  1028. (defvar spice-draccdl-keywords-regexp nil
  1029. "Regexp for dracula CDL keywords.")
  1030. (defvar spice-types-regexp nil
  1031. "Regexp for spice mode types.")
  1032. (defvar spice-functions-regexp nil
  1033. "Regexp for spice mode functions (Layla).")
  1034. (defvar spice-section-headings-regexp nil
  1035. "Regexp for spice mode section headings.")
  1036. (defvar spice-xinstance-regexp nil
  1037. "Regexp for x instances.")
  1038. (defvar spice-model-name-regexp nil
  1039. "Regexp model names of elements.")
  1040. (defvar spice-entity-start-regexp nil
  1041. "Regexp for start of entity definition.")
  1042. (require 'font-lock)
  1043. (defvar spice-instance-name-face 'spice-instance-name-face
  1044. "Face name to use spice instances.")
  1045. (defface spice-instance-name-face
  1046. '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
  1047. (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
  1048. (((class color) (background light)) (:foreground "ForestGreen" :bold t))
  1049. (((class color) (background dark)) (:foreground "Yellow" :bold t))
  1050. (t (:bold t)))
  1051. "Spice mode face used to highlight instances."
  1052. :group 'spice-faces)
  1053. (defvar spice-model-name-face 'spice-model-name-face
  1054. "Face name to use spice instances.")
  1055. (defface spice-model-name-face
  1056. '((((class grayscale) (background light)) (:foreground "LightGray"))
  1057. (((class grayscale) (background dark)) (:foreground "DimGray"))
  1058. (((class color) (background light)) (:foreground "Red3"))
  1059. (((class color) (background dark)) (:foreground "LightSteelBlue"))
  1060. (t (:bold t)))
  1061. "Spice mode face used to highlight models."
  1062. :group 'spice-faces)
  1063. (defvar spice-title-face 'spice-title-face
  1064. "Face name for title string.")
  1065. (defface spice-title-face
  1066. '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
  1067. (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
  1068. (((class color) (background light))
  1069. (:foreground "Yellow" :background "black" :bold t))
  1070. (((class color) (background dark))
  1071. (:foreground "green3":background "lightyellow" :bold t))
  1072. (t (:bold t)))
  1073. "Spice mode face used for title string."
  1074. :group 'spice-faces)
  1075. (defvar spice-layla-function-name-face 'spice-layla-function-name-face
  1076. "Face name to use for layla function names.")
  1077. (defface spice-layla-function-name-face
  1078. '((((class grayscale) (background light)) (:foreground "LightGray" :bold t))
  1079. (((class grayscale) (background dark)) (:foreground "DimGray" :bold t))
  1080. (((class color) (background light))
  1081. (:foreground "Darkgreen"))
  1082. (((class color) (background dark)) (:foreground "green"))
  1083. (t (:bold t)))
  1084. "Spice mode face used to higlight layla functions."
  1085. :group 'spice-faces)
  1086. (defvar spice-analysis-face 'spice-analysis-face
  1087. "Face name to highlight spice mode analysis commands.")
  1088. (defface spice-analysis-face
  1089. '((((class color) (background light)) (:foreground "Magenta" :bold t :underline t))
  1090. (((class color) (background dark)) (:foreground "Lightgreen" :bold t :underline t))
  1091. (t (:bold t)))
  1092. "Spice mode face used to highlight analysis commands."
  1093. :group 'spice-faces)
  1094. (defvar spice-doc-face (if spice-running-xemacs
  1095. 'font-lock-doc-string-face
  1096. 'font-lock-string-face)
  1097. "Face name to use for doc strings.")
  1098. (custom-add-to-group
  1099. 'spice-faces (if spice-running-xemacs
  1100. 'font-lock-doc-string-face
  1101. 'font-lock-string-face)
  1102. 'custom-face)
  1103. (defvar spice-constant-face (if spice-running-xemacs
  1104. 'font-lock-reference-face
  1105. (if (facep 'font-lock-constant-face)
  1106. 'font-lock-constant-face
  1107. 'font-lock-reference-face)) ; old emacs20.1
  1108. "Face name to use for constants.")
  1109. (custom-add-to-group
  1110. 'spice-faces (if spice-running-xemacs
  1111. 'font-lock-reference-face
  1112. (if (facep 'font-lock-constant-face)
  1113. 'font-lock-constant-face
  1114. 'font-lock-reference-face))
  1115. 'custom-face)
  1116. (defvar spice-include-file-face (if spice-running-xemacs
  1117. 'font-lock-preprocessor-face
  1118. 'font-lock-string-face)
  1119. "Face name to use for include files and libraries.")
  1120. (custom-add-to-group
  1121. 'spice-faces (if spice-running-xemacs
  1122. 'font-lock-preprocessor-face
  1123. 'font-lock-string-face)
  1124. 'custom-face)
  1125. (if (not spice-running-xemacs)
  1126. (custom-add-to-group
  1127. 'spice-faces 'font-lock-builtin-face 'custom-face)
  1128. (defface spice-builtin-face
  1129. '((((class grayscale) (background light)) (:foreground "LightGray"))
  1130. (((class grayscale) (background dark)) (:foreground "DimGray"))
  1131. (((class color) (background light)) (:foreground "Orchid" :bold t))
  1132. (((class color) (background dark)) (:foreground "LightBlue" :bold t))
  1133. (t (:bold t)))
  1134. "Spice mode face used for builtin types."
  1135. :group 'spice-faces))
  1136. (defvar spice-builtin-face (if spice-running-xemacs
  1137. 'spice-builtin-face
  1138. 'font-lock-builtin-face)
  1139. "Face name for builtin types.")
  1140. (defun spice-keywords-init ()
  1141. "Initialize reserved words."
  1142. (setq spice-keywords
  1143. (append spice-spice2g6-keywords
  1144. (when (spice-standard-p 'hspice)
  1145. spice-hspice-keywords)
  1146. (when (spice-standard-p 'eldo)
  1147. spice-eldo-keywords)
  1148. (when (spice-standard-p 'eldorf)
  1149. spice-eldorf-keywords)
  1150. (when (spice-standard-p 'fasthenry)
  1151. spice-fasthenry-keywords)))
  1152. (setq spice-colon-keywords
  1153. (append (when (spice-standard-p 'eldo)
  1154. spice-eldo-colon-keywords)
  1155. (when (spice-standard-p 'eldovloga)
  1156. spice-eldovloga-colon-keywords)))
  1157. (setq spice-analyses
  1158. (append spice-spice2g6-analyses
  1159. (when (spice-standard-p 'hspice)
  1160. spice-hspice-analyses)
  1161. (when (spice-standard-p 'eldo)
  1162. spice-eldo-analyses)
  1163. (when (spice-standard-p 'eldorf)
  1164. spice-eldorf-analyses)
  1165. (when (spice-standard-p 'fasthenry)
  1166. spice-fasthenry-analyses)))
  1167. (setq spice-analysis-modifiers
  1168. (append spice-spice2g6-analysis-modifiers
  1169. (when (spice-standard-p 'hspice)
  1170. spice-hspice-analysis-modifiers)
  1171. (when (spice-standard-p 'eldo)
  1172. spice-eldo-analysis-modifiers)
  1173. (when (spice-standard-p 'fasthenry)
  1174. spice-fasthenry-analysis-modifiers)))
  1175. (setq spice-misc-model-type-names
  1176. (append spice-spice2g6-model-type-names
  1177. (when (spice-standard-p 'hspice)
  1178. spice-hspice-model-type-names)
  1179. (when (spice-standard-p 'eldovloga)
  1180. spice-eldo-vloga-model-type-names)
  1181. (when (s

Large files are truncated, but you can click here to view the full file