-
Notifications
You must be signed in to change notification settings - Fork 2
/
spice-mode.el
8551 lines (7786 loc) · 310 KB
/
spice-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
;;; spice-mode.el --- Major mode for SPICE -*- lexical-binding: t -*-
;; Emacs Lisp Archive Entry
;; Author: Geert A. M. Van der Plas <geert_vanderplas@email.com> 1999-
;; Emmanuel Rouat <emmanuel.rouat@wanadoo.fr> 1997-
;; Carlin J. Vieri, MIT AI Lab <cvieri@ai.mit.edu> 1994
;; Keywords: spice, spice2g6, spice3, eldo, hspice, layla, mondriaan, fasthenry, CDL, spectre compatibility, netlist editing
;; Package-Requires: ((emacs "24.3"))
;; Filename: spice-mode.el
;; Version: 1.2.25
;; Maintainer: Geert A. M. Van der Plas <geert_vanderplas@email.com>
;; Last-Updated: 01 November 2004
;; Description: spice file editing
;; Homepage: https://repo.or.cz/spice-mode.git
;; URL: http://spice-mode.4t.com/
;; old-URL: http://www.esat.kuleuven.ac.be/~vdplas/emacs/
;; Please send suggestions and bug reports to
;; mailto:Geert_VanderPlas@email.com
;; Copyright (C) 1994, MIT Artificial Intelligence Lab
;; Copyright (C) 1997- Emmanuel Rouat
;; Copyright (C) 1999- Geert A. M. Van der Plas
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to
;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
;; INSTALL:
;; ========
;; byte compile spice-mode.el to spice-mode.elc (see `byte-compile-file')
;; put these two files in an arbitrary, but accesible directory
;; for example: $HOME/emacs, /usr/lib/emacs/site-lisp/ or
;; /usr/local/lib/emacs/site-lisp/
;; If you chose a non-standard place to put the files add the following
;; line to your Emacs start-up file (`.emacs') or custom `site-start.el'
;; file (replace <directory-name> by the directory where you placed
;; spice-mode.el and spice-mode.elc):
;; (setq load-path (cons (expand-file-name "<directory-name>") load-path))
;; To use spice-mode, add either the following to your `.emacs' file. This
;; assumes that you will use the .sp, .cir, .ckt, .mod, ... extensions for
;; your spice source decks and output files:
;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
;; (setq auto-mode-alist (append (list (cons "\\.sp$" 'spice-mode)
;; (cons "\\.cir$" 'spice-mode)
;; (cons "\\.ckt$" 'spice-mode)
;; (cons "\\.mod$" 'spice-mode)
;; (cons "\\.cdl$" 'spice-mode)
;; (cons "\\.chi$" 'spice-mode) ;eldo outpt
;; (cons "\\.inp$" 'spice-mode))
;; auto-mode-alist))
;; Other way to load spice mode (by Andrew Scott):
;; ;;; Testing for spice-mode (Another spice mode, also works on Spice,
;; ;;; Eldo, Layla; this one works on GNU Emacs-20.6 issues).
;; (autoload 'spice-mode "spice-mode" "Spice/Layla Editing Mode" t)
;; (add-to-list 'auto-mode-alist '("\\.cir$" . spice-mode))
;; (add-to-list 'auto-mode-alist '("\\.ckt$" . spice-mode))
;; (add-to-list 'auto-mode-alist '("\\.inp$" . spice-mode))
;; (add-to-list 'auto-mode-alist '("\\.spout$" . spice-mode));hspice out
;; (add-to-list 'auto-mode-alist '("\\.pdir$" . spice-mode))
;; ;;; Intel formats
;; (add-to-list 'auto-mode-alist '("\\.[sS][pP]$" . spice-mode))
;; (add-to-list 'auto-mode-alist '("\\.[sm]?t0$" . spice-mode))
;; (add-to-list 'auto-mode-alist '("\\.[h]?spice$" . spice-mode))
;; CUSTOMIZATION:
;; ==============
;; use customization to modify the behaviour of spice-mode; add
;; custom-set-variables to your `.emacs' file, for example:
;; (custom-set-variables
;; ; '(spice-initialize-file-function (quote geert-spice-file-header)) ;; use geert-spice-file-header function (not included in this file !)
;; '(spice-initialize-empty-file t) ;; initialize empty/new spice file
;; ; '(spice-standard '(spice2g6 (hspice eldo eldorf eldovloga layla))) ;; all 4 modes
;; '(spice-standard (quote (spice2g6 (hspice eldo)))) ;; hspice and eldo
;; '(spice-standard (quote (spice2g6 ()))) ;; spice2g6/3 only
;; '(spice-simulator "Spice3") ;; default simulator
;; '(spice-waveform-viewer "Nutmeg") ;; default waveform
;; '(spice-highlight-keywords nil) ;; less highlighting
;; '(spice-section-alist ;; add own sections
;; ;; this is ugly, I know ;)
;; (append (nth 1 (nth 0 (get 'spice-section-alist 'standard-value)))
;; (list
;; (list "My Header" "MY HEADER" nil)
;; )))
;; '(spice-show-describe-mode nil) ;; don't describe mode at startup
;; )
;; This can also be achieved interactively through customizations !
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Commentary:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; The original spice-mode.el created by C. Vieri has been modified
;; extensively. These changes have been heavily influenced by the eldo-mode.el
;; of Emmanuel Rouat (the tempo-templates for one) and the vhdl-mode.el of
;; Reto Zimmermann and Rodney J. Whitby (the font-locking, the
;; customization, the menus, ...) Help in understanding 'advanced' Lisp
;; was provided by G. Debyser <geert.debyser@advalvas.be>, our (Common) Lisp
;; expert. Since version 0.97 a lot of input/ideas have been provided by
;; Emmanuel Rouat. Just take a look and search for eldo-mode ;)
;; This package provides an Emacs major mode for editing SPICE decks.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; TODO:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; - customization group spice- needs to be improved
;; activate customizations needs to be looked at (potentially removed)
;; - fix problem imenu sometimes truncating filenames of include files
;; by replacing the functionality with own function
;; - improve Y instance handling. use builtin macromodels, and own development;; models
;; - ...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; BUGS:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; - searching for .subckt could be buggy because of user's file structure
;; - xinstance highlighting is buggy, and probably always will ?
;; - font-lock expressions are incredibly complicated, and multiple spice
;; formats are not handled correctly at the same time...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; If you have any questions about this mode, feel free to contact me
;; at the following address: geert_vanderplas@email.com. If I find the
;; time, I can take a look at the problem
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Code:
(defconst spice-version "1.2.25 (03 Jan 2007)"
"Current version of spice mode
(spice2g6/spice3/hspice/eldo(rf&verilog-a)/fasthenry/
layla/mondriaan/draccdl/spectre).")
(defconst spice-developer
"Geert Van der Plas & Emmanuel Rouat (<geert_vanderplas@email.com>, <emmanuel.rouat@wanadoo.fr>)"
"Current developers/maintainers of spice-mode.")
(defvar spice-tempo-tags nil
"List of templates used in spice mode.")
;; help function
(defun spice-custom-set (variable value &rest functions)
"Set VARIABLE as VALUE in `custom-set-default' and call FUNCTIONS (if bound) afterwards."
(if (fboundp 'custom-set-default)
(custom-set-default variable value)
(set-default variable value))
(while functions
(when (fboundp (car functions)) (funcall (car functions)))
(setq functions (cdr functions))))
(defgroup spice nil
"Customizations for Spice mode."
:prefix "spice-"
:link '(url-link "http://spice-mode.4t.com/")
:group 'languages
)
;;;###autoload
(defcustom spice-mode-hook nil
"*List of hook functions run by `spice-mode' (see `run-hooks')."
:type 'hook
:group 'spice)
;;;###autoload
(defcustom spice-standard '(spice2g6 (gnucap))
"Spice standards used.
Basic standard:
Spice2g6 : Original Berkeley Spice (leave this always on!)
Additional standards:
Hspice (TM) : Commercial Spice, formerly Meta Software, now owned by Synopsys
Eldo (TM) : Commercial Spice, formerly Anacad, now owned by Mentor Graphics
EldoRf (TM) : RF Steady State analyses of Eldo (also turn on Eldo!)
EldoVlogA : Verilog-A extensions to Eldo netlist language (also turn on Eldo!)
FastHenry : Multipole-accelerated inductance analysis program from MIT
Layla : KULeuven LAYLA (layout synthesis) extensions to Spice format
Mondriaan : KULeuven MONDRIAAN (layout synthesis) extensions (also turn on Layla!)
DracCDL (TM): Dracula CDL extensions (Cadence LOGLVS netlists)
Spectre (TM): Spice compatibility of Spectre language (simulator language=spice decks)."
:type '(list (choice :tag "Basic standard"
(const :tag "Spice2g6" spice2g6))
(set :tag "Additional standards" :indent 2
(const :tag "Hspice" hspice)
(const :tag "Eldo" eldo)
(const :tag "Eldo RF" eldorf)
(const :tag "Eldo Verilog-A" eldovloga)
(const :tag "FastHenry" fasthenry)
(const :tag "Layla" layla)
(const :tag "Mondriaan" mondriaan)
(const :tag "DracCDL" draccdl)
(const :tag "Spectre Spice Compatibility" spectre)
(const :tag "GnuCAP" gnucap)))
:set (lambda (variable value)
(spice-custom-set variable value
'spice-check-spice-standard
'spice-mode-syntax-table-init
'spice-keywords-init
'spice-font-lock-init
'spice-imenu-init
'spice-update-existing-buffers))
:group 'spice)
;;;###autoload
(defcustom spice-imenu-add-to-menubar t
"Spice mode adds imenu (Index) item to menubar."
:group 'spice
:set (lambda (variable value)
(spice-custom-set variable value
'spice-update-existing-buffers))
:type 'boolean)
;;;###autoload
(defcustom spice-show-describe-mode nil ; was t
"Spice mode runs `describe-mode' once at start of spice-mode."
:group 'spice
:type 'boolean)
;;;###autoload
(defcustom spice-echo-intro t
"Spice mode echos introductory message on entry to spice-mode."
:group 'spice
:type 'boolean)
(defgroup spice-initialize-file nil
"Customizations for initialization of empty/new spice files."
:group 'spice)
;;;###autoload
(defcustom spice-initialize-empty-file nil
"Spice initialize empty/new file setting."
:group 'spice-initialize-file
:type 'boolean)
;;;###autoload
(defcustom spice-initialize-template-file "~/.spice-default"
"File containing the default header in new empty file.
See also `spice-initialize-empty-file'."
:group 'spice-initialize-file
:type 'file)
;;;###autoload
(defcustom spice-default-header nil
"Default header for new Spice netlists, see also `spice-initialize-empty-file'."
:group 'spice-initialize-file
:type 'string)
;;;###autoload
(defcustom spice-initialize-file-function 'spice-initialize-empty-file
"Optional initialize function for empty/new files,
See also `spice-initialize-empty-file'.
If a different function is specified it should insert a default
header/template in the current buffer. This function should check
which submode is in use with `spice-standard-p' and adapt its
output accordingly. It may also use the `spice-default-header'
variable and insert its contents into the buffer."
:group 'spice-initialize-file
:type 'function)
(defgroup spice-simulate nil
"Customizations for simulation."
:group 'spice)
(defcustom spice-simulator-alist
'(
;; Spice3; spice3 -b <file.cir>
;;
("Spice3" "spice3 -b" ""
("\\s-*Error[\t ]+on[ \t]+line[\t ]+\\([0-9]+\\) +:.+"
0 1 nil (buffer-file-name))
("Circuit: \\(.*\\)$" 1)) ; spice3 hack, is not the filename, but that's no prob
;; Hspice; hspice <file.cir>
;; **error**: only 1 connection at node 0:2
("Hspice" "hspice" ""
("\\s-*\\(..?error..?[: ]\\).+" 0 spice-linenum 1 (buffer-file-name))
("[* ]* [iI]nput [fF]ile: +\\([^ \t]+\\).*$" 1))
;; Eldo; eldo -i <file.cir>
;; ERROR 503: MODEL "NMOS": Undeclared model reference.
("Eldo" "eldo -i" ""
("\\s-*\\(E[rR][rR][oO][rR] +[0-9]+:\\).*"
0 spice-linenum 1 (buffer-file-name))
("Running \\(eldo\\).*$" 1)) ; eldo hack, true filename can not be found
;; Spectre; spectre <file.cir>
;; "viblok2.cir" 7: Unknown dot word `.param'.
("Spectre" "spectre" ""
("\\s-*\"\\([^ \t\n]+\\)\" +\\([0-9]+\\):.*"
1 2)
("" 0)) ; filename is in regexp of error
("Gnucap" "gnucap -b" ""
("\\s-*Error[\t ]+on[ \t]+line[\t ]+\\([0-9]+\\) +:.+"
0 1 nil (buffer-file-name))
("Circuit: \\(.*\\)$" 1))
;;; Add your local simulators here:
;;
)
"*List of available Spice simulators and their properties.
Each list entry specifies the following items for a simulator:
Simulator:
Simulator Name : name used in variable `spice-simulator' to choose
simulator
Simulate Command : command including options used for simulation program
Extra switches : extra switches for simulator, after filename
Error Message:
Regexp : regular expression to match error messages
File Subexp Index: index of subexpression that matches the file name
Line Subexp Index: index of subexpression that matches the line number.
use function `spice-linenum' when the line number
is not available
Col Subexp Index : index of subexpression that matches the column number
if not available but `spice-linenum' has been
supplied in the previous field, use 1
File Message:
Regexp : regular expression to match a file name message
File Subexp Index: index of subexpression that matches the file name
See also variable `spice-simulator-switches' to add options to the
simulate command.
Most simulators do not include the file name in the error message, but print
out a file name message in advance. In this case, set \"File Subexp Index\"
to 0 and fill out the \"File Message\" entries."
:type '(repeat (list :tag "Simulator" :indent 2
(string :tag "Simulator Name ")
(string :tag "Simulate Command ")
;(string :tag "From Directory " "./")
(string :tag "Extra Switches ")
(list :tag "Error Message" :indent 4
(regexp :tag "Regexp ")
(integer :tag "File Subexp Index")
(integer :tag "Line Subexp Index"))
(list :tag "File Message" :indent 4
(regexp :tag "Regexp ")
(integer :tag "File Subexp Index"))))
:set (lambda (variable value)
(spice-custom-set variable value
'spice-menu-init
'spice-compile-variables-init
'spice-update-existing-buffers))
:group 'spice-simulate)
;;;###autoload
(defcustom spice-simulator nil ; example: "Hspice"
"Spice command, used when compiling buffer with `compile-mode',
see also `spice-simulator-switches'."
:group 'spice-simulate
:type 'string)
;;;###autoload
(defcustom spice-simulator-switches "" ; example "-noconf"
"Spice command switches, used when compiling buffer with
`compile-mode', see also `spice-simulator'."
:group 'spice-simulate
:type 'string)
(defcustom spice-waveform-viewer-alist
'(
;; Nutmeg; nutmeg <waveformdata.dat>
;;
("Nutmeg" "nutmeg" "" spice-run-interactive (".dat" ".ac0" ".tr0")) ; spice3 nutmeg viewer
("Gwave" "gwave" "" spice-run-silent
(".raw" ".braw" ".ac0" ".tr0" ".sw0" ".W" ".N" ".acs")) ; gwave viewer
("Xelga" "xelga" "" spice-run-silent ".cou") ; xelga eldo viewer
("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...
;; ("Awaves2" "echo_awaves" "" spice-run-silent nil) ; awaves hspice viewer
;;; Add your local waveform viewers here:
;;
)
"*List of available Waveform viewers and their properties.
Each list entry specifies the following items for a waveform viewer:
Waveform Viewer:
Wave Viewer Name : name used in variable `spice-waveform-viewer' to choose
a waveform viewer
Wave Viewer Command : command including options used for waveform viewer
Extra switches : extra switches for waveform viewer, after filename
See also variable `spice-waveform-viewer-switches' to add options to the
waveform viewer command."
:type '(repeat (list :tag "Waveform Viewer" :indent 2
(string :tag "Waveform Viewer Name ")
(string :tag "Waveform Viewing Command ")
(string :tag "Extra Switches ")
(choice :tag "How"
:value spice-run-silent
(function-item spice-run-silent)
(function-item spice-run-interactive)
(function :tag "Other"))
(choice (string :tag "Filename Suffix ")
(function :tag "Function Deriving Filename")
(repeat (list :tag "List of Filename Suffixes")))))
:set (lambda (variable value)
(spice-custom-set variable value
'spice-menu-init
'spice-update-existing-buffers))
:group 'spice-simulate)
;;;###autoload
(defcustom spice-waveform-viewer nil ; example: "Nutmeg"
"Spice command, used when starting waveform viewer, see also
`spice-waveform-viewer-switches'."
:group 'spice-simulate
:type 'string)
;;;###autoload
(defcustom spice-waveform-viewer-switches "" ; example "-b"
"Spice waveform viewer command switches, see also
`spice-waveform-viewer'."
:group 'spice-simulate
:type 'string)
(defgroup spice-commands nil
"Customizations for commands."
:group 'spice)
;;;###autoload
(defcustom spice-shell
(if (memq system-type '(ms-dos emx windows-nt))
shell-file-name
"/bin/sh")
"*Name of shell used to parse spice commands."
:group 'spice-commands
:type 'file)
;;;###autoload
(defcustom spice-shell-command-option
(cond ((memq system-type '(ms-dos emx windows-nt) )
(cond ((boundp 'shell-command-option)
shell-command-option)
((boundp 'shell-command-switch)
shell-command-switch)
(t
"/c")))
(t ;Unix & EMX (Emacs 19 port to OS/2)
"-c"))
"*Shell argument indicating that next argument is the command."
:group 'spice-commands
:type 'string)
(defgroup spice-hide nil
"Customizations for hiding of comments."
:group 'spice)
;;;###autoload
(defcustom spice-hide-line-prefix
(if (featurep 'newcomment)
'(concat
(regexp-quote
(concat comment-start
(if (boundp 'comment-padding)
(if (integerp comment-padding)
(make-string comment-padding ? )
comment-padding)
" ")))
"[a-z\\*!$0-9+\\.]"))
"Regexp string describing lines that are commented out and will be hidden.
The regexp is matched to the beginning of a line, the ^ is added
automatically. The initialization of this variable is handled in
`spice-hide-init', which is after the setting of `comment-start'
and `comment-padding' variables."
:group 'spice-hide
:type 'string)
;;;###autoload
(defcustom spice-auto-hide-comments nil
"*Boolean indicating automatic hiding of all commented regions at load time."
:group 'spice-hide
:type 'boolean)
(defgroup spice-section nil
"Customizations for sections."
:group 'spice)
;; sections (entirely different implementation but sections idea has
;; been taken from eldo-mode.el)
;;;###autoload
(defcustom spice-section-alist
'(
;; Libraries
("Libraries" "LIBRARIES" nil) ;
;; Netlist
("Netlist" "NETLIST" nil) ;
;; Main Circuit
("Main Circuit" "MAIN CIRCUIT" nil) ;
;; Options
("Options" "SIMULATION OPTIONS" nil) ;
;; Supplies
("Supplies" "SUPPLIES/REFERENCES" nil) ;
;; Input Signals
("Input Signals" "INPUT SIGNALS" nil) ;
;; DC Analysis
("DC Analysis" "DC ANALYSIS" nil) ;
;; AC Analysis
("AC Analysis" "AC ANALYSIS" nil) ;
;; Transient Analysis
("Transient Analysis" "TRANSIENT ANALYSIS" nil) ;
;;; Add your site-local spice sections here:
;;
)
"*List of valid sections in a Spice file and their options.
Each list entry specifies the following items for a section:
Section:
Section Name : name used in to select/create find section, make this
name short and descriptive.
Section String : string used in file to start section (usually all
uppercase variant of name).
Extra switches : extra switches for a section, unspecified for now."
:type '(repeat (list :tag "Section" :indent 2
(string :tag "Section Name ")
(string :tag "Section String ")
(sexp :tag "Extra Switches (nil)")))
:set (lambda (variable value)
(spice-custom-set variable value
'spice-keywords-init
'spice-font-lock-init
'spice-menu-init
'spice-imenu-init
'spice-update-existing-buffers))
:group 'spice-section)
(defgroup spice-faces nil
"Customizations for highlighting."
:group 'spice)
;;;###autoload
(defcustom spice-highlight-keywords t
"*Non-nil means highlight SPICE keywords and other standardized words.
The following faces are used:
`spice-title-face' : title (first line in a spice file)
`spice-doc-face' : doc strings
`spice-analysis-face' : analyses
`spice-instance-name-face' : instance/element names
`spice-model-name-face' : subckt model names
`spice-layla-function-name-face': layla function names
`spice-include-file-face' : include files and libraries
`font-lock-keyword-face' : keywords
`font-lock-warning-face' : warnings
`font-lock-comment-face' : comment
`font-lock-function-name-face': subcircuit references / names of objects
`font-lock-type-face' : types
`font-lock-string-face' : strings & include files
`font-lock-constant-face' : simulator's options
`font-lock-variable-name-face': names of .param's & variables
NOTE: Activate the new setting in a spice buffer by re-fontifying it (menu
entry \"Fontify Buffer\")."
:type 'boolean
:group 'spice-faces)
;; We try to use usual/standard font-lock faces, plus a few specific ones:
(custom-add-to-group
'spice-faces 'font-lock-comment-face 'custom-face)
(custom-add-to-group
'spice-faces 'font-lock-keyword-face 'custom-face)
(custom-add-to-group
'spice-faces 'font-lock-type-face 'custom-face)
(custom-add-to-group
'spice-faces 'font-lock-function-name-face 'custom-face)
(custom-add-to-group
'spice-faces 'font-lock-variable-name-face 'custom-face)
(custom-add-to-group
'spice-faces 'font-lock-warning-face 'custom-face)
(custom-add-to-group
'spice-faces 'font-lock-string-face 'custom-face)
(defgroup spice-output nil
"Customizations for spice output file handling."
:group 'spice)
;;;###autoload
(defcustom spice-output-filename-alist
'(
;; Libraries
(eldo (concat (file-name-sans-extension (buffer-file-name)) ".chi")) ;
(hspice (concat (file-name-sans-extension (buffer-file-name)) ".lis")) ;
(hspice (concat (file-name-sans-extension (buffer-file-name)) ".spout")) ;
(hspice (concat (file-name-sans-extension (buffer-file-name)) ".hspout")) ;
(spice2g6 (concat (file-name-sans-extension (buffer-file-name)) ".out")) ;
)
"List of valid output names depending on selected spice standard.
Spice Standard : one of spice2g6, hspice, eldo or layla
Expression : expression calculating the output filename."
:type '(repeat (list :tag "Output Filenames" :indent 2
(symbol :tag "Spice Standard ")
(sexp :tag "Expression ")))
:group 'spice-output)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; buffer local vars for spice-mode
;;(defvar spice-standard-local nil
;; "buffer local version of spice-standard.")
(defvar spice-output-local nil
"Buffer local version of spice-output.")
(defun spice-standard-p (standard)
"Check if STANDARD is specified as used standard on local variable."
(or (eq standard (car spice-standard))
(memq standard (cadr spice-standard))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; regexps for spice mode
(defconst spice-continuation-prefix "+"
"Continuation prefix for normal spice line.")
(defconst spice-line-break "\\(\n\\s-*\\+\\s-*\\)*"
"Regexp that matches a (possible) line break (\n+).")
(defconst spice-model-name "\\([a-z][^ \t\n=]*\\)" ; "\\([a-z]\\sw*[^ \t\n=]*\\)"
"Regexp that describes a syntactically correct model or subckt name.")
(defconst spice-library-regexp-start
"^\\.\\(inc\\|include\\|verilog\\|use_veriloga\\|lib\\(\\s-+key=\\w+\\)?\\|libfas\\|subckt\\s-+lib\\|model\\s-+lib\\)\\s-+[\"']?"
"Regexp that matches the beginning of library or include filename.")
(defconst spice-library-regexp-end
"\\([^ \t\n\"']*\\)"
"Regexp that matches the end of library or include filename.") ; doesn't catch end of buffer
(defconst spice-section-regexp-start "\\(^[*!$]\\s-*\\)"
"Spice mode section header start regexp.")
(defconst spice-spice2g6-keywords
'(
"subckt"
"print" "plot"
"opt" ; opt is actually a spice3 keyword, not 2g6
"nodeset"
"model" "macro" "include" ; include is actually a spice3 keyword, not 2g6
"ends" "end"
)
"List of Spice2g6 keywords.")
(defconst spice-spice2g6-analyses
'(
"tran" "op" "noise" "four" "disto" "dc" "ac"
)
"List of Spice2g6 analysis keywords.")
(defconst spice-spice2g6-analysis-modifiers
'(
"dec" "lin" "oct" ;; the ubiquitous spice2g6 ac modifiers
"pol" "zer" "pz" "cur" "vol" ;; pz analysis spice3
"ac" ;; .sens analysis spice3
)
"List of Spice2g6 analysis modifier keywords.")
(defconst spice-eldo-keywords
'(
"width" "use" "unprotect" "tvinclude" "topcell"
"table" "subdup" "solve" "sinus" "sigbus"
"setsoa" "setbus" "save" "restart" "ramp"
"protect" "probe" "plotbus"
"param" "overwrite_input" "optwind" "optpwl" "optnoise" "options"
"option" "optfour"
"notrc" "nocom" "modlogic"
"moddup" "meas" "mcmod" "lotgroup" "loop" "load"
"libfas" "lib" "init" "include" "ic" "hier" "guess" "global"
"extract" "endl" "enddata" "dspf_include" "distrib" "del"
"defwave" "defplotdig" "defmac" "data" "d2a" "comchar" "conso" "connect"
"chrsim" "chrent" "chrand" "checksoa" "checkbus" "alter" "addlib" "a2d"
)
"List of Eldo keywords.")
(defconst spice-eldo-colon-keywords
'(
"param" "pin" "model"
)
"List of Eldo colon keywords.")
(defconst spice-eldo-macromodel-keywords
'(
"opamp0" "opamp0d" "opamp1" "opamp1d" "opamp2" "opamp2d"
"satr" "satv" "vswitch" "cswitch"
"tri2sin" "stairgen" "sawgen" "trigen"
"amm" "pam"
"sa_ho" "tr_ho"
"pwm" "vco"
"peak_d" "lev_d"
"logamp" "expamp"
"diff" "integ"
"add" "sub" "mult" "div"
"sc_ideal" "sc_i" "sc_n" "sc_p" "sc_s1" "sc_s2"
"sc_sp1" "sc_sp2" "sc_b" "sc_u"
)
"List of Eldo macromodels.")
(defconst spice-eldo-analyses
'(
"wcase" "tf" "temp"
"step" "snf" "sens" "pz"
"noisetran" "mc"
)
"List of Eldo analysis keywords.")
(defconst spice-eldo-analysis-modifiers
'(
)
"List of Eldo analysis modifier keywords.")
(defconst spice-eldorf-keywords
'(
"sst"
)
"List of Eldo RF keywords.")
(defconst spice-eldovloga-keywords
'(
"verilog" "use_veriloga"
)
"List of Eldo Verilog-A keywords.")
(defconst spice-eldovloga-colon-keywords
'(
"port" "generic"
)
"List of Eldo Verilog-A colon keywords.")
(defconst spice-eldorf-analyses
'(
"sstac" "sstxf" "sstnoise"
)
"List of Eldo RF keywords.")
(defconst spice-hspice-keywords
'(
"width" "unprot" "unprotect" "uic"
"title" "sys" "system" "save"
"sample" "prot" "protect"
"probe" "pc" "parameter"
"param" "options" "option"
"nomod"
"measure" "meas" "macro"
"load" "lib" "include" "inc" "ic" "graph" "global"
"eom" "enddata" "dellib" "delete"
"del" "dcvolt" "data" "control" "comment"
"alter"
"fsoptions" "layerstack" "material" "shape" ; FEM solver for W elements
)
"List of Hspice keywords.")
(defconst spice-hspice-analyses
'(
"disto"
"fft"
"tf" "temp"
"net" ;; S, Z, Y and H parameters
"sample"
"sens"
"pz"
"noise"
)
"List of Hspice analysis keywords.")
(defconst spice-hspice-analysis-modifiers
'(
"sweep" "poi"
)
"List of Hspice analysis modifier keywords.")
(defconst spice-gnucap-keywords
'(
"width" "unmark" "unfault"
"title" "temperature" "temp"
"pause" "quit" "exit" "save" "status" "parameter"
"store" "probe" "freeze" "unfreeze"
"param" "options" "nodeset" "modify" "mod" "merge"
"measure" "meas" "mark" "log" "list"
"load" "lib" "inc" "ic" "get" "gen" "generator"
"eval"
"del" "delete" "fault" "clear" "chdir" "cd" "build" "b"
"alter" "alarm"
)
"List of Gnucap keywords.")
(defconst spice-gnucap-output-types
'("tr" "op")
"List of Gnucap output keywords.")
(defconst spice-gnucap-analyses
'("tr")
"List of Gnucap analysis keywords.")
(defconst spice-fasthenry-keywords
'(
"units" "default" "external" "equiv"
)
"List of FastHenry keywords.")
(defconst spice-fasthenry-analyses
'(
"freq"
)
"List of FastHenry analysis keywords.")
(defconst spice-fasthenry-analysis-modifiers
'(
)
"List of FastHenry analysis modifier keywords.")
(defconst spice-layla-keywords
'(
"stop" "start"
"port" "performance" "parameter"
"param" "options" "option"
"net"
"model" "matching"
"include" "inc"
"bus"
)
"List of Layla keywords.")
(defconst spice-mondriaan-keywords
'(
"master" "routingarea" "routingchannel" "ports" "portgrid" "net"
)
"List of Mondriaan keywords.")
(defconst spice-draccdl-keywords
'(
"bipolar" "busdelimiter" "capa" "caparea" "capval" "default" "dioarea"
"dioperi" "diode" "edifdelimiter" "busdelimiter" "equation" "equiv"
"gnonswap" "ldd" "mega" "nonswap" "nopin" "nosub" "pin" "pininfo"
"resi" "ressize" "resval" "reverse" "scale" "spice" "unspec"
"eom" "global" "param" "macro" "swap"
)
"List of Dracula CDL keywords.")
(defconst spice-spice2g6-types
'(
"ac" "dc" "exp" "pulse" "pwl" "sffm" "sin"
)
"List of types in spice2g6.")
(defconst spice-hspice-types
'(
"metal" "dielectric" "pec" "rectangle" "circle" "strip" "polygon" ;; ""
)
"List of types in hspice.")
(defconst spice-eldo-types
'(
"pattern"
)
"List of source types in eldo.")
(defconst spice-eldorf-types
'(
"fpulse" "four" "probe"
)
"List of source types in eldorf.")
(defconst spice-fasthenry-types
'(
"point" "rect" "circle"
"user1" "user2" "user3" "user4" "user5" "user6" "user7"
)
"List of source types in fasthenry.")
(defconst spice-special-model-type-names
'(
"d" "npn" "pnp" "nmos" "pmos"
)
"List of model type names which are excluded for imenu.")
(defconst spice-spice2g6-model-type-names
'(
"r" "c" "urc" "ltra"
"njf" "pjf"
"nmf" "pmf"
"sw" "csw"
)
"List of model type names in spice2g6.")
(defconst spice-eldo-model-type-names
'(
"res" "cap" "ind"
"rn" "rp" "lpnp"
)
"List of model type names extra in eldo.")
(defconst spice-eldo-vloga-model-type-names
'(
"macro"
)
"List of model type names extra in Eldo Verilog-A.")
(defconst spice-hspice-model-type-names
'(
"l" "core" "w" "plot"
)
"List of model type names extra in hspice.")
(defconst spice-spice2g6-output-keywords
'("print" "plot")
"List of output keywords in spice2g6.")
(defconst spice-spice2g6-output-types
'("ac" "dc" "tran")
"List of output types in spice2g6.")
(defconst spice-eldo-output-keywords
'("extract" "meas")
"List of output keywords in eldo.")
(defconst spice-eldo-output-types
'("dcac" "dcsweep" "dctran" "noise" "four" "sweep")
"List of output types in eldo.")
(defconst spice-eldorf-output-types
'("fsst" "tsst" "sstac" "sstxf" "ssnoise" )
"List of output types in eldo.")
(defconst spice-hspice-output-keywords
'("probe" "graph" "measure")
"List of output keywords in hspice.")
(defconst spice-hspice-output-types
'("noise" "disto")
"List of output types in hspice.")
(defconst spice-spice2g6-options-keywords
'("trytocompact")
"List of spice2g6/3 options keywords.")
(defconst spice-eldo-options-keywords
'("wsf" "wsfascii" "sda"
"precise" "spi3asc" "spi3bin" "spicedc" "spiout" "libfas" "nolib"
"ammeter" "msgbias" "nowarn" "ulogic" "aspec" "mod4pins" "modwl" "wl"
"captab" "coustep" "input" "lcapop" "list" "noascii" "ascii"
"autostop" "nobound_phase" "nocou" "node" "nomod" "nopage" "nosizechk"
"notrc" "trap" "smooth" "be" "gear" "newton" "iem" "analog" "digital"
"osr" "mixed" "pstran" "dptran" "itl6" "itl7" "itl8" "nmaxsize"
"noconvassist" "nolat" "pivrel" "pivtol" "qtrunc" "noconvassist"
"nolat" "pivrel" "pivtol" "qtrunc" "relvar" "splitc" "noswitch"
"unbound" "randmc" "usedefap" "engnot" "nodcpart" "probeop"
"noprobeop" "histlim" "wbulk" "noinit" "nonoise" "tempcouk" "nofnsiem"
"icdc" "icdev" "carlo_gauss" "cteprec" "d2dmvl9bit" "defconvmsg"
"maxnodeord" "notrclib" "motorola" "aex")
"List of eldo options keywords.")
(defconst spice-eldorf-options-keywords
'("sst_freqdiv")
"List of Eldo RF options keywords.")
(defconst spice-hspice-options-keywords
'("acct" "converge"
"absh" "acout" "cds" "scale" "cshdc" "alt999" "alt9999" "csdf"
"accurate" "dvdt" "measout" "acout" "brief" "cshunt" "gshunt" "probe"
"kcltest" "dctran" "di" "itl5" "list" "sda" "gshunt" "cshunt" "post"
"node" "noelck" "gshunt" "maxamp" "nomod" "aspec" "icsweep" "relh"
"nopage" "newtol" "reli" "notop" "parhier" "off" "spice" "wl"
"dvtr" "nxx" "seed" "risetime" "imax" "nopiv" "imin" "opts" "cscal"
"vntol" "absv" "pathnum" "badchr" "fmax" "plim" "diagnostic" "pivref"
"fscal" "autostop" "nowarn" "gscal" "search" "lscal" "bypass" "verify"
"sparse" "pivot" "pzabs" "cpu" "pztol" "fast" "interp" "h9007" "expli"
"ritol" "itlpz" "itrprt" "unwrap" "captab" "newtol" "dccap")
"List of hspice options keywords.")