aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilson Snyder2013-10-18 00:46:36 -0700
committerGlenn Morris2013-10-18 00:46:36 -0700
commitea89ff08fb312219b2eec07c3aef22a9e40cfa7f (patch)
treea5d0723df2f22cabb98121794eca20e20e0e0300
parent81b9ca36da4dbc025857fcf0113c164027bd0af2 (diff)
downloademacs-ea89ff08fb312219b2eec07c3aef22a9e40cfa7f.tar.gz
emacs-ea89ff08fb312219b2eec07c3aef22a9e40cfa7f.zip
Sync with upstream verilog-mode revision 1a6ecec7
* progmodes/verilog-mode.el (verilog-mode-version): Update. (verilog-mode-release-date): Remove. (verilog-highlight-grouping-keywords, verilog-active-low-regexp) (verilog-auto-inst-param-value, verilog-auto-input-ignore-regexp) (verilog-auto-inout-ignore-regexp, verilog-auto-output-ignore-regexp) (verilog-auto-tieoff-ignore-regexp) (verilog-auto-unused-ignore-regexp, verilog-typedef-regexp) (verilog-scan-cache-preserving, verilog-mode, verilog-at-struct-p) (verilog-signals-with, verilog-dir-cache-preserving) (verilog-auto-inst, verilog-auto-inout-param, verilog-auto): Doc fixes. (verilog-case-fold): New option, to control case folding in regexp searches, bug597. (verilog-menu): Add verilog-sk-uvm-component, minor tweaks. (verilog-string-match-fold, verilog-in-paren-count) (verilog-in-struct-nested-p, verilog-at-struct-mv-p) (verilog-at-close-struct-p): New functions. (verilog-beg-block-re-ordered, verilog-extended-case-re) (verilog-forward-sexp, verilog-set-auto-endcomments): (verilog-leap-to-case-head): Handle "unique0" case. (verilog-in-constraint-re): New constant. (verilog-keywords, verilog-type-font-keywords): Add some SystemVerilog 1800-2012 keywords. (verilog-label-be): Remove unimplemented argument, bug669. (verilog-batch-execute-func): When batch expanding clear create-lockfiles to prevent spurious user locks when a file ends up not changing. (verilog-calculate-indent, verilog-calc-1) (verilog-at-close-constraint-p, verilog-at-constraint-p) (verilog-do-indent): Fix indentation of nested constraints and structures. (verilog-sig-tieoff, verilog-typedef-name-p, verilog-auto-inst) (verilog-auto-inst-param): Use verilog-string-match-fold. (verilog-read-inst-module-matcher): Fix AUTOINST on gate primitives with #1. (verilog-read-decls): Fix double-declaring user-defined typed signals. Reads all user-defined typed variables. (verilog-read-defines): Fix reading definitions inside comments, bug647. (verilog-signals-matching-regexp) (verilog-signals-not-matching-regexp, verilog-auto): Respect verilog-case-fold. (verilog-diff-report): Fix line count. (verilog-auto-assign-modport): Remove unused local `modi'. (verilog-auto-inst-port): Support [][] in AUTO_TEMPLATE to better handle multidimensional arrays. Fix packed array ports misadding bit index in AUTOINST, bug637. (verilog-auto-output, verilog-auto-input): Fix AUTOINPUT and AUTOOUTPUT to not double-declare existing outputs and inputs, respectively. (verilog-template-map): Bind U to verilog-sk-uvm-component. (verilog-sk-uvm-object): Rename from verilog-sk-uvm-class. (verilog-sk-uvm-component): New skeleton. (verilog-submit-bug-report): Add verilog-case-fold, remove verilog-mode-release-date.
-rw-r--r--lisp/ChangeLog57
-rw-r--r--lisp/progmodes/verilog-mode.el475
2 files changed, 370 insertions, 162 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b91d17ba8a3..22be8a542d3 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,60 @@
12013-10-18 Wilson Snyder <wsnyder@wsnyder.org>
2
3 Sync with upstream verilog-mode revision 1a6ecec7.
4 * progmodes/verilog-mode.el (verilog-mode-version): Update.
5 (verilog-mode-release-date): Remove.
6 (verilog-highlight-grouping-keywords, verilog-active-low-regexp)
7 (verilog-auto-inst-param-value, verilog-auto-input-ignore-regexp)
8 (verilog-auto-inout-ignore-regexp, verilog-auto-output-ignore-regexp)
9 (verilog-auto-tieoff-ignore-regexp)
10 (verilog-auto-unused-ignore-regexp, verilog-typedef-regexp)
11 (verilog-scan-cache-preserving, verilog-mode, verilog-at-struct-p)
12 (verilog-signals-with, verilog-dir-cache-preserving)
13 (verilog-auto-inst, verilog-auto-inout-param, verilog-auto):
14 Doc fixes.
15 (verilog-case-fold): New option, to control case folding in
16 regexp searches, bug597.
17 (verilog-menu): Add verilog-sk-uvm-component, minor tweaks.
18 (verilog-string-match-fold, verilog-in-paren-count)
19 (verilog-in-struct-nested-p, verilog-at-struct-mv-p)
20 (verilog-at-close-struct-p): New functions.
21 (verilog-beg-block-re-ordered, verilog-extended-case-re)
22 (verilog-forward-sexp, verilog-set-auto-endcomments):
23 (verilog-leap-to-case-head): Handle "unique0" case.
24 (verilog-in-constraint-re): New constant.
25 (verilog-keywords, verilog-type-font-keywords):
26 Add some SystemVerilog 1800-2012 keywords.
27 (verilog-label-be): Remove unimplemented argument, bug669.
28 (verilog-batch-execute-func): When batch expanding clear
29 create-lockfiles to prevent spurious user locks when a file ends
30 up not changing.
31 (verilog-calculate-indent, verilog-calc-1)
32 (verilog-at-close-constraint-p, verilog-at-constraint-p)
33 (verilog-do-indent): Fix indentation of nested constraints
34 and structures.
35 (verilog-sig-tieoff, verilog-typedef-name-p, verilog-auto-inst)
36 (verilog-auto-inst-param): Use verilog-string-match-fold.
37 (verilog-read-inst-module-matcher):
38 Fix AUTOINST on gate primitives with #1.
39 (verilog-read-decls): Fix double-declaring user-defined typed signals.
40 Reads all user-defined typed variables.
41 (verilog-read-defines): Fix reading definitions inside comments, bug647.
42 (verilog-signals-matching-regexp)
43 (verilog-signals-not-matching-regexp, verilog-auto):
44 Respect verilog-case-fold.
45 (verilog-diff-report): Fix line count.
46 (verilog-auto-assign-modport): Remove unused local `modi'.
47 (verilog-auto-inst-port): Support [][] in AUTO_TEMPLATE to
48 better handle multidimensional arrays.
49 Fix packed array ports misadding bit index in AUTOINST, bug637.
50 (verilog-auto-output, verilog-auto-input): Fix AUTOINPUT and AUTOOUTPUT
51 to not double-declare existing outputs and inputs, respectively.
52 (verilog-template-map): Bind U to verilog-sk-uvm-component.
53 (verilog-sk-uvm-object): Rename from verilog-sk-uvm-class.
54 (verilog-sk-uvm-component): New skeleton.
55 (verilog-submit-bug-report): Add verilog-case-fold,
56 remove verilog-mode-release-date.
57
12013-10-17 Barry O'Reilly <gundaetiapo@gmail.com> 582013-10-17 Barry O'Reilly <gundaetiapo@gmail.com>
2 59
3 * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave 60 * lisp/subr.el (sit-for): Call (input-pending-p t) so as to behave
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 03364bddd9f..6f38f4b50b5 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -1,13 +1,12 @@
1;; verilog-mode.el --- major mode for editing verilog source in Emacs 1;;; verilog-mode.el --- major mode for editing verilog source in Emacs
2 2
3;; Copyright (C) 1996-2013 Free Software Foundation, Inc. 3;; Copyright (C) 1996-2013 Free Software Foundation, Inc.
4 4
5;; Author: Michael McNamara (mac@verilog.com), 5;; Author: Michael McNamara <mac@verilog.com>
6;; Wilson Snyder (wsnyder@wsnyder.org) 6;; Wilson Snyder <wsnyder@wsnyder.org>
7;; Please see our web sites:
8;; http://www.verilog.com 7;; http://www.verilog.com
9;; http://www.veripool.org 8;; http://www.veripool.org
10;; 9;; Created: 3 Jan 1996
11;; Keywords: languages 10;; Keywords: languages
12 11
13;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this 12;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
@@ -38,25 +37,26 @@
38 37
39;;; Commentary: 38;;; Commentary:
40 39
41;; This mode borrows heavily from the Pascal-mode and the cc-mode of Emacs
42
43;; USAGE 40;; USAGE
44;; ===== 41;; =====
45 42
46;; A major mode for editing Verilog HDL source code. When you have 43;; A major mode for editing Verilog and SystemVerilog HDL source code (IEEE
47;; entered Verilog mode, you may get more info by pressing C-h m. You 44;; 1364-2005 and IEEE 1800-2012 standards). When you have entered Verilog
48;; may also get online help describing various functions by: C-h f 45;; mode, you may get more info by pressing C-h m. You may also get online
49;; <Name of function you want described> 46;; help describing various functions by: C-h f <Name of function you want
47;; described>
50 48
51;; KNOWN BUGS / BUG REPORTS 49;; KNOWN BUGS / BUG REPORTS
52;; ======================= 50;; =======================
53 51
54;; Verilog is a rapidly evolving language, and hence this mode is 52;; SystemVerilog is a rapidly evolving language, and hence this mode is
55;; under continuous development. Hence this is beta code, and likely 53;; under continuous development. Please report any issues to the issue
56;; has bugs. Please report any issues to the issue tracker at 54;; tracker at
57;; http://www.veripool.org/verilog-mode 55;;
56;; http://www.veripool.org/verilog-mode
57;;
58;; Please use verilog-submit-bug-report to submit a report; type C-c 58;; Please use verilog-submit-bug-report to submit a report; type C-c
59;; C-b to invoke this and as a result I will have a much easier time 59;; C-b to invoke this and as a result we will have a much easier time
60;; of reproducing the bug you find, and hence fixing it. 60;; of reproducing the bug you find, and hence fixing it.
61 61
62;; INSTALLING THE MODE 62;; INSTALLING THE MODE
@@ -110,8 +110,8 @@
110; verilog-indent-begin-after-if t 110; verilog-indent-begin-after-if t
111; verilog-auto-lineup 'declarations 111; verilog-auto-lineup 'declarations
112; verilog-highlight-p1800-keywords nil 112; verilog-highlight-p1800-keywords nil
113; verilog-linter "my_lint_shell_command" 113; verilog-linter "my_lint_shell_command"
114; ) 114; )
115 115
116;; 116;;
117 117
@@ -123,10 +123,8 @@
123;;; Code: 123;;; Code:
124 124
125;; This variable will always hold the version number of the mode 125;; This variable will always hold the version number of the mode
126(defconst verilog-mode-version (substring "$$Revision: 840 $$" 12 -3) 126(defconst verilog-mode-version "2013-10-09-1a6ecec-vpo"
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-date (substring "$$Date: 2013-01-03 05:29:05 -0800 (Thu, 03 Jan 2013) $$" 8 -3)
129 "Release date of this Verilog mode.")
130(defconst verilog-mode-release-emacs t 128(defconst verilog-mode-release-emacs t
131 "If non-nil, this version of Verilog mode was released with Emacs itself.") 129 "If non-nil, this version of Verilog mode was released with Emacs itself.")
132 130
@@ -504,11 +502,11 @@ If 'all' is selected, then all line ups described below are done.
504If 'declarations', then just declarations are lined up with any 502If 'declarations', then just declarations are lined up with any
505preceding declarations, taking into account widths and the like, 503preceding declarations, taking into account widths and the like,
506so or example the code: 504so or example the code:
507 reg [31:0] a; 505 reg [31:0] a;
508 reg b; 506 reg b;
509would become 507would become
510 reg [31:0] a; 508 reg [31:0] a;
511 reg b; 509 reg b;
512 510
513If 'assignment', then assignments are lined up with any preceding 511If 'assignment', then assignments are lined up with any preceding
514assignments, so for example the code 512assignments, so for example the code
@@ -663,7 +661,7 @@ to see the effect as font color choices are cached by Emacs."
663(put 'verilog-highlight-p1800-keywords 'safe-local-variable 'verilog-booleanp) 661(put 'verilog-highlight-p1800-keywords 'safe-local-variable 'verilog-booleanp)
664 662
665(defcustom verilog-highlight-grouping-keywords nil 663(defcustom verilog-highlight-grouping-keywords nil
666 "Non-nil means highlight grouping keywords 'begin' and 'end' more dramatically. 664 "Non-nil means highlight grouping keywords more dramatically.
667If false, these words are in the `font-lock-type-face'; if True then they are in 665If false, these words are in the `font-lock-type-face'; if True then they are in
668`verilog-font-lock-ams-face'. Some find that special highlighting on these 666`verilog-font-lock-ams-face'. Some find that special highlighting on these
669grouping constructs allow the structure of the code to be understood at a glance." 667grouping constructs allow the structure of the code to be understood at a glance."
@@ -960,7 +958,7 @@ See also `verilog-library-flags', `verilog-library-directories'."
960(put 'verilog-library-extensions 'safe-local-variable 'listp) 958(put 'verilog-library-extensions 'safe-local-variable 'listp)
961 959
962(defcustom verilog-active-low-regexp nil 960(defcustom verilog-active-low-regexp nil
963 "If set, treat signals matching this regexp as active low. 961 "If true, treat signals matching this regexp as active low.
964This is used for AUTORESET and AUTOTIEOFF. For proper behavior, 962This is used for AUTORESET and AUTOTIEOFF. For proper behavior,
965you will probably also need `verilog-auto-reset-widths' set." 963you will probably also need `verilog-auto-reset-widths' set."
966 :group 'verilog-mode-auto 964 :group 'verilog-mode-auto
@@ -1003,7 +1001,7 @@ those temporaries reset. See example in `verilog-auto-reset'."
1003 "True means AUTORESET should determine the width of signals. 1001 "True means AUTORESET should determine the width of signals.
1004This is then used to set the width of the zero (32'h0 for example). This 1002This is then used to set the width of the zero (32'h0 for example). This
1005is required by some lint tools that aren't smart enough to ignore widths of 1003is required by some lint tools that aren't smart enough to ignore widths of
1006the constant zero. This may result in ugly code when parameters determine 1004the constant zero. This may result in ugly code when parameters determine
1007the MSB or LSB of a signal inside an AUTORESET. 1005the MSB or LSB of a signal inside an AUTORESET.
1008 1006
1009If nil, AUTORESET uses \"0\" as the constant. 1007If nil, AUTORESET uses \"0\" as the constant.
@@ -1062,7 +1060,7 @@ inputs. This is then used by an upper module:
1062 1060
1063 module ExampInst; 1061 module ExampInst;
1064 InstModule 1062 InstModule
1065 #(PARAM(10)) 1063 #(.PARAM(10))
1066 instName 1064 instName
1067 (/*AUTOINST*/ 1065 (/*AUTOINST*/
1068 .i (i[PARAM-1:0])); 1066 .i (i[PARAM-1:0]));
@@ -1073,7 +1071,7 @@ instead expand to:
1073 1071
1074 module ExampInst; 1072 module ExampInst;
1075 InstModule 1073 InstModule
1076 #(PARAM(10)) 1074 #(.PARAM(10))
1077 instName 1075 instName
1078 (/*AUTOINST*/ 1076 (/*AUTOINST*/
1079 .i (i[9:0]));" 1077 .i (i[9:0]));"
@@ -1135,21 +1133,21 @@ won't merge conflict."
1135(put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 'verilog-booleanp) 1133(put 'verilog-auto-inst-interfaced-ports 'safe-local-variable 'verilog-booleanp)
1136 1134
1137(defcustom verilog-auto-input-ignore-regexp nil 1135(defcustom verilog-auto-input-ignore-regexp nil
1138 "If set, when creating AUTOINPUT list, ignore signals matching this regexp. 1136 "If non-nil, when creating AUTOINPUT, ignore signals matching this regexp.
1139See the \\[verilog-faq] for examples on using this." 1137See the \\[verilog-faq] for examples on using this."
1140 :group 'verilog-mode-auto 1138 :group 'verilog-mode-auto
1141 :type '(choice (const nil) regexp)) 1139 :type '(choice (const nil) regexp))
1142(put 'verilog-auto-input-ignore-regexp 'safe-local-variable 'stringp) 1140(put 'verilog-auto-input-ignore-regexp 'safe-local-variable 'stringp)
1143 1141
1144(defcustom verilog-auto-inout-ignore-regexp nil 1142(defcustom verilog-auto-inout-ignore-regexp nil
1145 "If set, when creating AUTOINOUT list, ignore signals matching this regexp. 1143 "If non-nil, when creating AUTOINOUT, ignore signals matching this regexp.
1146See the \\[verilog-faq] for examples on using this." 1144See the \\[verilog-faq] for examples on using this."
1147 :group 'verilog-mode-auto 1145 :group 'verilog-mode-auto
1148 :type '(choice (const nil) regexp)) 1146 :type '(choice (const nil) regexp))
1149(put 'verilog-auto-inout-ignore-regexp 'safe-local-variable 'stringp) 1147(put 'verilog-auto-inout-ignore-regexp 'safe-local-variable 'stringp)
1150 1148
1151(defcustom verilog-auto-output-ignore-regexp nil 1149(defcustom verilog-auto-output-ignore-regexp nil
1152 "If set, when creating AUTOOUTPUT list, ignore signals matching this regexp. 1150 "If non-nil, when creating AUTOOUTPUT, ignore signals matching this regexp.
1153See the \\[verilog-faq] for examples on using this." 1151See the \\[verilog-faq] for examples on using this."
1154 :group 'verilog-mode-auto 1152 :group 'verilog-mode-auto
1155 :type '(choice (const nil) regexp)) 1153 :type '(choice (const nil) regexp))
@@ -1173,22 +1171,30 @@ assignment, else the data type for variable creation."
1173(put 'verilog-auto-tieoff-declaration 'safe-local-variable 'stringp) 1171(put 'verilog-auto-tieoff-declaration 'safe-local-variable 'stringp)
1174 1172
1175(defcustom verilog-auto-tieoff-ignore-regexp nil 1173(defcustom verilog-auto-tieoff-ignore-regexp nil
1176 "If set, when creating AUTOTIEOFF list, ignore signals matching this regexp. 1174 "If non-nil, when creating AUTOTIEOFF, ignore signals matching this regexp.
1177See the \\[verilog-faq] for examples on using this." 1175See the \\[verilog-faq] for examples on using this."
1178 :group 'verilog-mode-auto 1176 :group 'verilog-mode-auto
1179 :type '(choice (const nil) regexp)) 1177 :type '(choice (const nil) regexp))
1180(put 'verilog-auto-tieoff-ignore-regexp 'safe-local-variable 'stringp) 1178(put 'verilog-auto-tieoff-ignore-regexp 'safe-local-variable 'stringp)
1181 1179
1182(defcustom verilog-auto-unused-ignore-regexp nil 1180(defcustom verilog-auto-unused-ignore-regexp nil
1183 "If set, when creating AUTOUNUSED list, ignore signals matching this regexp. 1181 "If non-nil, when creating AUTOUNUSED, ignore signals matching this regexp.
1184See the \\[verilog-faq] for examples on using this." 1182See the \\[verilog-faq] for examples on using this."
1185 :group 'verilog-mode-auto 1183 :group 'verilog-mode-auto
1186 :type '(choice (const nil) regexp)) 1184 :type '(choice (const nil) regexp))
1187(put 'verilog-auto-unused-ignore-regexp 'safe-local-variable 'stringp) 1185(put 'verilog-auto-unused-ignore-regexp 'safe-local-variable 'stringp)
1188 1186
1187(defcustom verilog-case-fold t
1188 "Non-nil means `verilog-mode' regexps should ignore case.
1189This variable is t for backward compatibility; nil is suggested."
1190 :group 'verilog-mode
1191 :type 'boolean)
1192(put 'verilog-case-fold 'safe-local-variable 'verilog-booleanp)
1193
1189(defcustom verilog-typedef-regexp nil 1194(defcustom verilog-typedef-regexp nil
1190 "If non-nil, regular expression that matches Verilog-2001 typedef names. 1195 "If non-nil, regular expression that matches Verilog-2001 typedef names.
1191For example, \"_t$\" matches typedefs named with _t, as in the C language." 1196For example, \"_t$\" matches typedefs named with _t, as in the C language.
1197See also `verilog-case-fold'."
1192 :group 'verilog-mode-auto 1198 :group 'verilog-mode-auto
1193 :type '(choice (const nil) regexp)) 1199 :type '(choice (const nil) regexp))
1194(put 'verilog-typedef-regexp 'safe-local-variable 'stringp) 1200(put 'verilog-typedef-regexp 'safe-local-variable 'stringp)
@@ -1437,6 +1443,8 @@ If set will become buffer local.")
1437 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] 1443 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"]
1438 ["AUTOASSIGNMODPORT" (describe-function 'verilog-auto-assign-modport) 1444 ["AUTOASSIGNMODPORT" (describe-function 'verilog-auto-assign-modport)
1439 :help "Help on AUTOASSIGNMODPORT - creating assignments to/from modports"] 1445 :help "Help on AUTOASSIGNMODPORT - creating assignments to/from modports"]
1446 ["AUTOINOUT" (describe-function 'verilog-auto-inout)
1447 :help "Help on AUTOINOUT - adding inouts from cells"]
1440 ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp) 1448 ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp)
1441 :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"] 1449 :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"]
1442 ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in) 1450 ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in)
@@ -1447,12 +1455,10 @@ If set will become buffer local.")
1447 :help "Help on AUTOINOUTMODULE - copying i/o from another file"] 1455 :help "Help on AUTOINOUTMODULE - copying i/o from another file"]
1448 ["AUTOINOUTPARAM" (describe-function 'verilog-auto-inout-param) 1456 ["AUTOINOUTPARAM" (describe-function 'verilog-auto-inout-param)
1449 :help "Help on AUTOINOUTPARAM - copying parameters from another file"] 1457 :help "Help on AUTOINOUTPARAM - copying parameters from another file"]
1450 ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp)
1451 :help "Help on AUTOINSERTLISP - insert text from a lisp function"]
1452 ["AUTOINOUT" (describe-function 'verilog-auto-inout)
1453 :help "Help on AUTOINOUT - adding inouts from cells"]
1454 ["AUTOINPUT" (describe-function 'verilog-auto-input) 1458 ["AUTOINPUT" (describe-function 'verilog-auto-input)
1455 :help "Help on AUTOINPUT - adding inputs from cells"] 1459 :help "Help on AUTOINPUT - adding inputs from cells"]
1460 ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp)
1461 :help "Help on AUTOINSERTLISP - insert text from a lisp function"]
1456 ["AUTOINST" (describe-function 'verilog-auto-inst) 1462 ["AUTOINST" (describe-function 'verilog-auto-inst)
1457 :help "Help on AUTOINST - adding pins for cells"] 1463 :help "Help on AUTOINST - adding pins for cells"]
1458 ["AUTOINST (.*)" (describe-function 'verilog-auto-star) 1464 ["AUTOINST (.*)" (describe-function 'verilog-auto-star)
@@ -1471,7 +1477,7 @@ If set will become buffer local.")
1471 :help "Help on AUTOREGINPUT - declaring inputs for non-wires"] 1477 :help "Help on AUTOREGINPUT - declaring inputs for non-wires"]
1472 ["AUTORESET" (describe-function 'verilog-auto-reset) 1478 ["AUTORESET" (describe-function 'verilog-auto-reset)
1473 :help "Help on AUTORESET - resetting always blocks"] 1479 :help "Help on AUTORESET - resetting always blocks"]
1474 ["AUTOSENSE" (describe-function 'verilog-auto-sense) 1480 ["AUTOSENSE or AS" (describe-function 'verilog-auto-sense)
1475 :help "Help on AUTOSENSE - sensitivity lists for always blocks"] 1481 :help "Help on AUTOSENSE - sensitivity lists for always blocks"]
1476 ["AUTOTIEOFF" (describe-function 'verilog-auto-tieoff) 1482 ["AUTOTIEOFF" (describe-function 'verilog-auto-tieoff)
1477 :help "Help on AUTOTIEOFF - tying off unused outputs"] 1483 :help "Help on AUTOTIEOFF - tying off unused outputs"]
@@ -1505,8 +1511,10 @@ If set will become buffer local.")
1505 :help "Insert a module .. (/*AUTOARG*/);.. endmodule block"] 1511 :help "Insert a module .. (/*AUTOARG*/);.. endmodule block"]
1506 ["OVM Class" verilog-sk-ovm-class 1512 ["OVM Class" verilog-sk-ovm-class
1507 :help "Insert an OVM class block"] 1513 :help "Insert an OVM class block"]
1508 ["UVM Class" verilog-sk-uvm-class 1514 ["UVM Object" verilog-sk-uvm-object
1509 :help "Insert an UVM class block"] 1515 :help "Insert an UVM object block"]
1516 ["UVM Component" verilog-sk-uvm-component
1517 :help "Insert an UVM component block"]
1510 ["Primitive" verilog-sk-primitive 1518 ["Primitive" verilog-sk-primitive
1511 :help "Insert a primitive .. (.. );.. endprimitive block"] 1519 :help "Insert a primitive .. (.. );.. endprimitive block"]
1512 "----" 1520 "----"
@@ -1594,6 +1602,14 @@ If set will become buffer local.")
1594(defsubst verilog-within-string () 1602(defsubst verilog-within-string ()
1595 (nth 3 (parse-partial-sexp (point-at-bol) (point)))) 1603 (nth 3 (parse-partial-sexp (point-at-bol) (point))))
1596 1604
1605(defsubst verilog-string-match-fold (regexp string &optional start)
1606 "Like `string-match', but use `verilog-case-fold'.
1607Return index of start of first match for REGEXP in STRING, or nil.
1608Matching ignores case if `verilog-case-fold' is non-nil.
1609If third arg START is non-nil, start search at that index in STRING."
1610 (let ((case-fold-search verilog-case-fold))
1611 (string-match regexp string start)))
1612
1597(defsubst verilog-string-replace-matches (from-string to-string fixedcase literal string) 1613(defsubst verilog-string-replace-matches (from-string to-string fixedcase literal string)
1598 "Replace occurrences of FROM-STRING with TO-STRING. 1614 "Replace occurrences of FROM-STRING with TO-STRING.
1599FIXEDCASE and LITERAL as in `replace-match`. STRING is what to replace. 1615FIXEDCASE and LITERAL as in `replace-match`. STRING is what to replace.
@@ -2438,7 +2454,7 @@ find the errors."
2438;; verilog-forward-sexp and verilog-calc-indent 2454;; verilog-forward-sexp and verilog-calc-indent
2439(defconst verilog-beg-block-re-ordered 2455(defconst verilog-beg-block-re-ordered
2440 ( concat "\\(\\<begin\\>\\)" ;1 2456 ( concat "\\(\\<begin\\>\\)" ;1
2441 "\\|\\(\\<randcase\\>\\|\\(\\<unique\\s-+\\|priority\\s-+\\)?case[xz]?\\>\\)" ; 2,3 2457 "\\|\\(\\<randcase\\>\\|\\(\\<unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\>\\)" ; 2,3
2442 "\\|\\(\\(\\<disable\\>\\s-+\\|\\<wait\\>\\s-+\\)?fork\\>\\)" ;4,5 2458 "\\|\\(\\(\\<disable\\>\\s-+\\|\\<wait\\>\\s-+\\)?fork\\>\\)" ;4,5
2443 "\\|\\(\\<class\\>\\)" ;6 2459 "\\|\\(\\<class\\>\\)" ;6
2444 "\\|\\(\\<table\\>\\)" ;7 2460 "\\|\\(\\<table\\>\\)" ;7
@@ -2570,6 +2586,9 @@ find the errors."
2570 (eval-when-compile (verilog-regexp-words `("initial" "final" "always" "always_comb" "always_latch" "always_ff" 2586 (eval-when-compile (verilog-regexp-words `("initial" "final" "always" "always_comb" "always_latch" "always_ff"
2571 "function" "task")))) 2587 "function" "task"))))
2572(defconst verilog-coverpoint-re "\\w+\\s*:\\s*\\(coverpoint\\|cross\\constraint\\)" ) 2588(defconst verilog-coverpoint-re "\\w+\\s*:\\s*\\(coverpoint\\|cross\\constraint\\)" )
2589(defconst verilog-in-constraint-re ;; keywords legal in constraint blocks starting a statement/block
2590 (eval-when-compile (verilog-regexp-words `("if" "else" "solve" "foreach"))))
2591
2573(defconst verilog-indent-re 2592(defconst verilog-indent-re
2574 (eval-when-compile 2593 (eval-when-compile
2575 (verilog-regexp-words 2594 (verilog-regexp-words
@@ -2682,7 +2701,7 @@ find the errors."
2682 "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass" 2701 "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass"
2683 )))) 2702 ))))
2684(defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>") 2703(defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>")
2685(defconst verilog-extended-case-re "\\(\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)") 2704(defconst verilog-extended-case-re "\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)")
2686(defconst verilog-extended-complete-re 2705(defconst verilog-extended-complete-re
2687 (concat "\\(\\(\\<extern\\s-+\\|\\<\\(\\<pure\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)" 2706 (concat "\\(\\(\\<extern\\s-+\\|\\<\\(\\<pure\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)"
2688 "\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)" 2707 "\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)"
@@ -2766,6 +2785,8 @@ find the errors."
2766 "let" "nexttime" "reject_on" "restrict" "s_always" "s_eventually" 2785 "let" "nexttime" "reject_on" "restrict" "s_always" "s_eventually"
2767 "s_nexttime" "s_until" "s_until_with" "strong" "sync_accept_on" 2786 "s_nexttime" "s_until" "s_until_with" "strong" "sync_accept_on"
2768 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" 2787 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
2788 ;; 1800-2012
2789 "implements" "interconnect" "nettype" "soft"
2769 ) 2790 )
2770 "List of Verilog keywords.") 2791 "List of Verilog keywords.")
2771 2792
@@ -2786,7 +2807,7 @@ find the errors."
2786 (modify-syntax-entry ?| "." table) 2807 (modify-syntax-entry ?| "." table)
2787 ;; FIXME: This goes against Emacs conventions. Use "_" syntax instead and 2808 ;; FIXME: This goes against Emacs conventions. Use "_" syntax instead and
2788 ;; then use regexps with things like "\\_<...\\_>". 2809 ;; then use regexps with things like "\\_<...\\_>".
2789 (modify-syntax-entry ?` "w" table) 2810 (modify-syntax-entry ?` "w" table) ;; ` is part of definition symbols in Verilog
2790 (modify-syntax-entry ?_ "w" table) 2811 (modify-syntax-entry ?_ "w" table)
2791 (modify-syntax-entry ?\' "." table) 2812 (modify-syntax-entry ?\' "." table)
2792 2813
@@ -2932,6 +2953,11 @@ See also `verilog-font-lock-extra-types'.")
2932 "sync_accept_on" "sync_reject_on" "unique0" "until" 2953 "sync_accept_on" "sync_reject_on" "unique0" "until"
2933 "until_with" "untyped" "weak" ) nil ))) 2954 "until_with" "untyped" "weak" ) nil )))
2934 2955
2956 (verilog-1800-2012-keywords
2957 (eval-when-compile
2958 (verilog-regexp-opt
2959 '("implements" "interconnect" "nettype" "soft" ) nil )))
2960
2935 (verilog-ams-keywords 2961 (verilog-ams-keywords
2936 (eval-when-compile 2962 (eval-when-compile
2937 (verilog-regexp-opt 2963 (verilog-regexp-opt
@@ -2995,6 +3021,12 @@ See also `verilog-font-lock-extra-types'.")
2995 'verilog-font-lock-p1800-face) 3021 'verilog-font-lock-p1800-face)
2996 (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>") 3022 (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>")
2997 'font-lock-type-face)) 3023 'font-lock-type-face))
3024 ;; Fontify IEEE-1800-2012 keywords appropriately
3025 (if verilog-highlight-p1800-keywords
3026 (cons (concat "\\<\\(" verilog-1800-2012-keywords "\\)\\>")
3027 'verilog-font-lock-p1800-face)
3028 (cons (concat "\\<\\(" verilog-1800-2012-keywords "\\)\\>")
3029 'font-lock-type-face))
2998 ;; Fontify Verilog-AMS keywords 3030 ;; Fontify Verilog-AMS keywords
2999 (cons (concat "\\<\\(" verilog-ams-keywords "\\)\\>") 3031 (cons (concat "\\<\\(" verilog-ams-keywords "\\)\\>")
3000 'verilog-font-lock-ams-face))) 3032 'verilog-font-lock-ams-face)))
@@ -3113,7 +3145,7 @@ to full text form for parsing. Additional actions may be specified with
3113;; Comment detection and caching 3145;; Comment detection and caching
3114 3146
3115(defvar verilog-scan-cache-preserving nil 3147(defvar verilog-scan-cache-preserving nil
3116 "If set, the specified buffer's comment properties are static. 3148 "If true, the specified buffer's comment properties are static.
3117Buffer changes will be ignored. See `verilog-inside-comment-or-string-p' 3149Buffer changes will be ignored. See `verilog-inside-comment-or-string-p'
3118and `verilog-scan'.") 3150and `verilog-scan'.")
3119 3151
@@ -3350,7 +3382,7 @@ Use filename, if current buffer being edited shorten to just buffer name."
3350 (setq reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)" )) 3382 (setq reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)" ))
3351 ((match-end 2) 3383 ((match-end 2)
3352 ;; Search forward for matching endcase 3384 ;; Search forward for matching endcase
3353 (setq reg "\\(\\<randcase\\>\\|\\(\\<unique\\>\\s-+\\|\\<priority\\>\\s-+\\)?\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)" ) 3385 (setq reg "\\(\\<randcase\\>\\|\\(\\<unique0?\\>\\s-+\\|\\<priority\\>\\s-+\\)?\\<case[xz]?\\>[^:]\\)\\|\\(\\<endcase\\>\\)" )
3354 (setq md 3) ;; ender is third item in regexp 3386 (setq md 3) ;; ender is third item in regexp
3355 ) 3387 )
3356 ((match-end 4) 3388 ((match-end 4)
@@ -3590,7 +3622,8 @@ Some other functions are:
3590 \\[verilog-sk-fork] Insert a fork begin .. end .. join block. 3622 \\[verilog-sk-fork] Insert a fork begin .. end .. join block.
3591 \\[verilog-sk-module] Insert a module .. (/*AUTOARG*/);.. endmodule block. 3623 \\[verilog-sk-module] Insert a module .. (/*AUTOARG*/);.. endmodule block.
3592 \\[verilog-sk-ovm-class] Insert an OVM Class block. 3624 \\[verilog-sk-ovm-class] Insert an OVM Class block.
3593 \\[verilog-sk-uvm-class] Insert an UVM Class block. 3625 \\[verilog-sk-uvm-object] Insert an UVM Object block.
3626 \\[verilog-sk-uvm-component] Insert an UVM Component block.
3594 \\[verilog-sk-primitive] Insert a primitive .. (.. );.. endprimitive block. 3627 \\[verilog-sk-primitive] Insert a primitive .. (.. );.. endprimitive block.
3595 \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block. 3628 \\[verilog-sk-repeat] Insert a repeat (..) begin .. end block.
3596 \\[verilog-sk-specify] Insert a specify .. endspecify block. 3629 \\[verilog-sk-specify] Insert a specify .. endspecify block.
@@ -4062,9 +4095,8 @@ Uses `verilog-scan' cache."
4062 (error "%s: Can't find endmodule" (verilog-point-text)) 4095 (error "%s: Can't find endmodule" (verilog-point-text))
4063 (point-max))))) 4096 (point-max)))))
4064 4097
4065(defun verilog-label-be (&optional arg) 4098(defun verilog-label-be ()
4066 "Label matching begin ... end, fork ... join and case ... endcase statements. 4099 "Label matching begin ... end, fork ... join and case ... endcase statements."
4067With ARG, first kill any existing labels."
4068 (interactive) 4100 (interactive)
4069 (let ((cnt 0) 4101 (let ((cnt 0)
4070 (oldpos (point)) 4102 (oldpos (point))
@@ -4490,7 +4522,7 @@ primitive or interface named NAME."
4490 ((looking-at "\\<randcase\\>") 4522 ((looking-at "\\<randcase\\>")
4491 (setq str "randcase") 4523 (setq str "randcase")
4492 (setq err nil)) 4524 (setq err nil))
4493 ((looking-at "\\(\\(unique\\s-+\\|priority\\s-+\\)?case[xz]?\\)") 4525 ((looking-at "\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)")
4494 (goto-char (match-end 0)) 4526 (goto-char (match-end 0))
4495 (setq str (concat (match-string 0) " " (verilog-get-expr))) 4527 (setq str (concat (match-string 0) " " (verilog-get-expr)))
4496 (setq err nil)) 4528 (setq err nil))
@@ -5108,6 +5140,7 @@ Save the result unless optional NO-SAVE is t."
5108 (setq-default make-backup-files nil) 5140 (setq-default make-backup-files nil)
5109 (setq enable-local-variables t) 5141 (setq enable-local-variables t)
5110 (setq enable-local-eval t) 5142 (setq enable-local-eval t)
5143 (setq create-lockfiles nil)
5111 ;; Make sure any sub-files we read get proper mode 5144 ;; Make sure any sub-files we read get proper mode
5112 (setq-default major-mode 'verilog-mode) 5145 (setq-default major-mode 'verilog-mode)
5113 ;; Ditto files already read in 5146 ;; Ditto files already read in
@@ -5228,6 +5261,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5228 (par 0) 5261 (par 0)
5229 (begin (looking-at "[ \t]*begin\\>")) 5262 (begin (looking-at "[ \t]*begin\\>"))
5230 (lim (save-excursion (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)" nil t))) 5263 (lim (save-excursion (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)" nil t)))
5264 (structres nil)
5231 (type (catch 'nesting 5265 (type (catch 'nesting
5232 ;; Keep working backwards until we can figure out 5266 ;; Keep working backwards until we can figure out
5233 ;; what type of statement this is. 5267 ;; what type of statement this is.
@@ -5246,8 +5280,12 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5246 (looking-at "[ \t]*`vmm_"))))) 5280 (looking-at "[ \t]*`vmm_")))))
5247 (throw 'nesting 'directive)) 5281 (throw 'nesting 'directive))
5248 ;; indent structs as if there were module level 5282 ;; indent structs as if there were module level
5249 (if (verilog-in-struct-p) 5283 (setq structres (verilog-in-struct-nested-p))
5250 (throw 'nesting 'block)) 5284 (cond ((not structres) nil)
5285 ;;((and structres (equal (char-after) ?\})) (throw 'nesting 'struct-close))
5286 ((> structres 0) (throw 'nesting 'nested-struct))
5287 ((= structres 0) (throw 'nesting 'block))
5288 (t nil))
5251 5289
5252 ;; if we are in a parenthesized list, and the user likes to indent these, return. 5290 ;; if we are in a parenthesized list, and the user likes to indent these, return.
5253 ;; unless we are in the newfangled coverpoint or constraint blocks 5291 ;; unless we are in the newfangled coverpoint or constraint blocks
@@ -5264,7 +5302,9 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5264 ;; trap out if we crawl off the top of the buffer 5302 ;; trap out if we crawl off the top of the buffer
5265 (if (bobp) (throw 'nesting 'cpp)) 5303 (if (bobp) (throw 'nesting 'cpp))
5266 5304
5267 (if (verilog-continued-line-1 lim) 5305 (if (and (verilog-continued-line-1 lim)
5306 (or (not (verilog-in-coverage-p))
5307 (looking-at verilog-in-constraint-re) )) ;; may still get hosed if concat in constraint
5268 (let ((sp (point))) 5308 (let ((sp (point)))
5269 (if (and 5309 (if (and
5270 (not (looking-at verilog-complete-reg)) 5310 (not (looking-at verilog-complete-reg))
@@ -5273,10 +5313,15 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5273 (throw 'nesting 'cexp)) 5313 (throw 'nesting 'cexp))
5274 5314
5275 (goto-char sp)) 5315 (goto-char sp))
5276 5316 (if (and (verilog-in-coverage-p)
5317 (looking-at verilog-in-constraint-re))
5318 (progn
5319 (beginning-of-line)
5320 (skip-chars-forward " \t")
5321 (throw 'nesting 'constraint)))
5277 (if (and begin 5322 (if (and begin
5278 (not verilog-indent-begin-after-if) 5323 (not verilog-indent-begin-after-if)
5279 (looking-at verilog-no-indent-begin-re)) 5324 (looking-at verilog-no-indent-begin-re))
5280 (progn 5325 (progn
5281 (beginning-of-line) 5326 (beginning-of-line)
5282 (skip-chars-forward " \t") 5327 (skip-chars-forward " \t")
@@ -5373,6 +5418,10 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5373 (list type (current-column))) 5418 (list type (current-column)))
5374 ((eq type 'defun) 5419 ((eq type 'defun)
5375 (list type 0)) 5420 (list type 0))
5421 ((eq type 'constraint)
5422 (list 'block (current-column)))
5423 ((eq type 'nested-struct)
5424 (list 'block structres))
5376 (t 5425 (t
5377 (list type (verilog-current-indent-level)))))))) 5426 (list type (verilog-current-indent-level))))))))
5378 5427
@@ -5401,23 +5450,32 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5401 (t 5450 (t
5402 (setq depth (verilog-current-indent-level))))) 5451 (setq depth (verilog-current-indent-level)))))
5403 (message "You are at nesting %s depth %d" type depth)))) 5452 (message "You are at nesting %s depth %d" type depth))))
5453
5404(defun verilog-calc-1 () 5454(defun verilog-calc-1 ()
5405 (catch 'nesting 5455 (catch 'nesting
5406 (let ((re (concat "\\({\\|}\\|" verilog-indent-re "\\)"))) 5456 (let ((re (concat "\\({\\|}\\|" verilog-indent-re "\\)"))
5457 (inconstraint (verilog-in-coverage-p)))
5407 (while (verilog-re-search-backward re nil 'move) 5458 (while (verilog-re-search-backward re nil 'move)
5408 (catch 'continue 5459 (catch 'continue
5409 (cond 5460 (cond
5410 ((equal (char-after) ?\{) 5461 ((equal (char-after) ?\{)
5462 ;; block type returned based on outer contraint { or inner
5411 (if (verilog-at-constraint-p) 5463 (if (verilog-at-constraint-p)
5412 (throw 'nesting 'block))) 5464 (cond (inconstraint (throw 'nesting 'constraint))
5413 5465 (t (throw 'nesting 'statement)))))
5414 ((equal (char-after) ?\}) 5466 ((equal (char-after) ?\})
5415 (let ((there (verilog-at-close-constraint-p))) 5467 (let (par-pos
5468 (there (verilog-at-close-constraint-p)))
5416 (if there ;; we are at the } that closes a constraint. Find the { that opens it 5469 (if there ;; we are at the } that closes a constraint. Find the { that opens it
5417 (progn 5470 (progn
5418 (forward-char 1) 5471 (if (> (verilog-in-paren-count) 0)
5419 (backward-list 1) 5472 (forward-char 1))
5420 (verilog-beg-of-statement))))) 5473 (setq par-pos (verilog-parenthesis-depth))
5474 (cond (par-pos
5475 (goto-char par-pos)
5476 (forward-char 1))
5477 (t
5478 (backward-char 1)))))))
5421 5479
5422 ((looking-at verilog-beg-block-re-ordered) 5480 ((looking-at verilog-beg-block-re-ordered)
5423 (cond 5481 (cond
@@ -5535,7 +5593,7 @@ of the appropriate enclosing block."
5535 (while (/= 0 nest) 5593 (while (/= 0 nest)
5536 (verilog-re-search-backward 5594 (verilog-re-search-backward
5537 (concat 5595 (concat
5538 "\\(\\<randcase\\>\\|\\(\\<unique\\s-+\\|priority\\s-+\\)?\\<case[xz]?\\>\\)" 5596 "\\(\\<randcase\\>\\|\\(\\<unique0?\\s-+\\|priority\\s-+\\)?\\<case[xz]?\\>\\)"
5539 "\\|\\(\\<endcase\\>\\)" ) 5597 "\\|\\(\\<endcase\\>\\)" )
5540 nil 'move) 5598 nil 'move)
5541 (cond 5599 (cond
@@ -5951,6 +6009,14 @@ May cache result using `verilog-syntax-ppss'."
5951 (let ((state (save-excursion (verilog-syntax-ppss)))) 6009 (let ((state (save-excursion (verilog-syntax-ppss))))
5952 (> (nth 0 state) 0 ))) 6010 (> (nth 0 state) 0 )))
5953 6011
6012(defun verilog-in-paren-count ()
6013 "Return paren depth, floor to 0.
6014May cache result using `verilog-syntax-ppss'."
6015 (let ((state (save-excursion (verilog-syntax-ppss))))
6016 (if (> (nth 0 state) 0)
6017 (nth 0 state)
6018 0 )))
6019
5954(defun verilog-in-paren-quick () 6020(defun verilog-in-paren-quick ()
5955 "Return true if in a parenthetical expression. 6021 "Return true if in a parenthetical expression.
5956Always starts from `point-min', to allow inserts with hooks disabled." 6022Always starts from `point-min', to allow inserts with hooks disabled."
@@ -5970,6 +6036,21 @@ Always starts from `point-min', to allow inserts with hooks disabled."
5970 ) 6036 )
5971 nil))) 6037 nil)))
5972 6038
6039(defun verilog-in-struct-nested-p ()
6040 "Return nil for not in struct.
6041Return 0 for in non-nested struct.
6042Return >0 for nested struct."
6043 (interactive)
6044 (let (col)
6045 (save-excursion
6046 (if (verilog-in-paren)
6047 (progn
6048 (verilog-backward-up-list 1)
6049 (setq col (verilog-at-struct-mv-p))
6050 (if col
6051 (if (verilog-in-struct-p) (current-column) 0)))
6052 nil))))
6053
5973(defun verilog-in-coverage-p () 6054(defun verilog-in-coverage-p ()
5974 "Return true if in a constraint or coverpoint expression." 6055 "Return true if in a constraint or coverpoint expression."
5975 (interactive) 6056 (interactive)
@@ -5984,11 +6065,13 @@ Always starts from `point-min', to allow inserts with hooks disabled."
5984 "If at the } that closes a constraint or covergroup, return true." 6065 "If at the } that closes a constraint or covergroup, return true."
5985 (if (and 6066 (if (and
5986 (equal (char-after) ?\}) 6067 (equal (char-after) ?\})
5987 (verilog-in-paren)) 6068 (verilog-in-coverage-p))
5988 6069
5989 (save-excursion 6070 (save-excursion
5990 (verilog-backward-ws&directives) 6071 (verilog-backward-ws&directives)
5991 (if (equal (char-before) ?\;) 6072 (if (or (equal (char-before) ?\;)
6073 (equal (char-before) ?\}) ;; can end with inner constraint { } block or ;
6074 (equal (char-before) ?\{)) ;; empty constraint block
5992 (point) 6075 (point)
5993 nil)))) 6076 nil))))
5994 6077
@@ -6000,20 +6083,64 @@ Always starts from `point-min', to allow inserts with hooks disabled."
6000 (forward-list) 6083 (forward-list)
6001 (progn (backward-char 1) 6084 (progn (backward-char 1)
6002 (verilog-backward-ws&directives) 6085 (verilog-backward-ws&directives)
6003 (equal (char-before) ?\;)))) 6086 (or (equal (char-before) ?\{) ;; empty case
6004 ;; maybe 6087 (equal (char-before) ?\;)
6005 (verilog-re-search-backward "\\<constraint\\|coverpoint\\|cross\\>" nil 'move) 6088 (equal (char-before) ?\})))))
6089 (progn
6090 (let ( (pt (point)) (pass 0))
6091 (verilog-backward-ws&directives)
6092 (verilog-backward-token)
6093 (if (looking-at (concat "\\<constraint\\|coverpoint\\|cross\\|with\\>\\|" verilog-in-constraint-re))
6094 (progn (setq pass 1)
6095 (if (looking-at "\\<with\\>")
6096 (progn (verilog-backward-ws&directives)
6097 (beginning-of-line) ;; 1
6098 (verilog-forward-ws&directives)
6099 1 )
6100 (verilog-beg-of-statement)
6101 ))
6102 ;; if first word token not keyword, it maybe the instance name
6103 ;; check next word token
6104 (if (looking-at "\\<\\w+\\>\\|\\s-*(\\s-*\\w+")
6105 (progn (verilog-beg-of-statement)
6106 (if (looking-at (concat "\\<\\(constraint\\|"
6107 "\\(?:\\w+\\s-*:\\s-*\\)?\\(coverpoint\\|cross\\)"
6108 "\\|with\\)\\>\\|" verilog-in-constraint-re))
6109 (setq pass 1)))))
6110 (if (eq pass 0)
6111 (progn (goto-char pt) nil) 1)))
6006 ;; not 6112 ;; not
6007 nil)) 6113 nil))
6008 6114
6009(defun verilog-at-struct-p () 6115(defun verilog-at-struct-p ()
6010 "If at the { of a struct, return true, moving point to struct." 6116 "If at the { of a struct, return true, not moving point."
6011 (save-excursion 6117 (save-excursion
6012 (if (and (equal (char-after) ?\{) 6118 (if (and (equal (char-after) ?\{)
6013 (verilog-backward-token)) 6119 (verilog-backward-token))
6014 (looking-at "\\<struct\\|union\\|packed\\|\\(un\\)?signed\\>") 6120 (looking-at "\\<struct\\|union\\|packed\\|\\(un\\)?signed\\>")
6015 nil))) 6121 nil)))
6016 6122
6123(defun verilog-at-struct-mv-p ()
6124 "If at the { of a struct, return true, moving point to struct."
6125 (let ((pt (point)))
6126 (if (and (equal (char-after) ?\{)
6127 (verilog-backward-token))
6128 (if (looking-at "\\<struct\\|union\\|packed\\|\\(un\\)?signed\\>")
6129 (progn (verilog-beg-of-statement) (point))
6130 (progn (goto-char pt) nil))
6131 (progn (goto-char pt) nil))))
6132
6133(defun verilog-at-close-struct-p ()
6134 "If at the } that closes a struct, return true."
6135 (if (and
6136 (equal (char-after) ?\})
6137 (verilog-in-struct-p))
6138 ;; true
6139 (save-excursion
6140 (if (looking-at "}\\(?:\\s-*\\w+\\s-*\\)?;") 1))
6141 ;; false
6142 nil))
6143
6017(defun verilog-parenthesis-depth () 6144(defun verilog-parenthesis-depth ()
6018 "Return non zero if in parenthetical-expression." 6145 "Return non zero if in parenthetical-expression."
6019 (save-excursion (nth 1 (verilog-syntax-ppss)))) 6146 (save-excursion (nth 1 (verilog-syntax-ppss))))
@@ -6247,8 +6374,9 @@ Only look at a few lines to determine indent level."
6247 6374
6248 (;-- Handle the ends 6375 (;-- Handle the ends
6249 (or 6376 (or
6250 (looking-at verilog-end-block-re ) 6377 (looking-at verilog-end-block-re)
6251 (verilog-at-close-constraint-p)) 6378 (verilog-at-close-constraint-p)
6379 (verilog-at-close-struct-p))
6252 (let ((val (if (eq type 'statement) 6380 (let ((val (if (eq type 'statement)
6253 (- ind verilog-indent-level) 6381 (- ind verilog-indent-level)
6254 ind))) 6382 ind)))
@@ -7466,11 +7594,11 @@ See also `verilog-sk-header' for an alternative format."
7466 (list name bits comment mem enum signed type multidim modport)) 7594 (list name bits comment mem enum signed type multidim modport))
7467(defsubst verilog-sig-name (sig) 7595(defsubst verilog-sig-name (sig)
7468 (car sig)) 7596 (car sig))
7469(defsubst verilog-sig-bits (sig) 7597(defsubst verilog-sig-bits (sig) ;; First element of packed array (pre signal-name)
7470 (nth 1 sig)) 7598 (nth 1 sig))
7471(defsubst verilog-sig-comment (sig) 7599(defsubst verilog-sig-comment (sig)
7472 (nth 2 sig)) 7600 (nth 2 sig))
7473(defsubst verilog-sig-memory (sig) 7601(defsubst verilog-sig-memory (sig) ;; Unpacked array (post signal-name)
7474 (nth 3 sig)) 7602 (nth 3 sig))
7475(defsubst verilog-sig-enum (sig) 7603(defsubst verilog-sig-enum (sig)
7476 (nth 4 sig)) 7604 (nth 4 sig))
@@ -7480,7 +7608,7 @@ See also `verilog-sk-header' for an alternative format."
7480 (nth 6 sig)) 7608 (nth 6 sig))
7481(defsubst verilog-sig-type-set (sig type) 7609(defsubst verilog-sig-type-set (sig type)
7482 (setcar (nthcdr 6 sig) type)) 7610 (setcar (nthcdr 6 sig) type))
7483(defsubst verilog-sig-multidim (sig) 7611(defsubst verilog-sig-multidim (sig) ;; Second and additional elements of packed array
7484 (nth 7 sig)) 7612 (nth 7 sig))
7485(defsubst verilog-sig-multidim-string (sig) 7613(defsubst verilog-sig-multidim-string (sig)
7486 (if (verilog-sig-multidim sig) 7614 (if (verilog-sig-multidim sig)
@@ -7666,7 +7794,7 @@ Signals must be in standard (base vector) form."
7666 (nreverse out-list))) 7794 (nreverse out-list)))
7667 7795
7668(defun verilog-signals-with (func in-list) 7796(defun verilog-signals-with (func in-list)
7669 "Return IN-LIST with only signals where FUNC passed each signal is true." 7797 "Return list of signals where FUNC is true executed on each signal in IN-LIST."
7670 (let (out-list) 7798 (let (out-list)
7671 (while in-list 7799 (while in-list
7672 (when (funcall func (car in-list)) 7800 (when (funcall func (car in-list))
@@ -7764,7 +7892,7 @@ Tieoff value uses `verilog-active-low-regexp' and
7764`verilog-auto-reset-widths'." 7892`verilog-auto-reset-widths'."
7765 (concat 7893 (concat
7766 (if (and verilog-active-low-regexp 7894 (if (and verilog-active-low-regexp
7767 (string-match verilog-active-low-regexp (verilog-sig-name sig))) 7895 (verilog-string-match-fold verilog-active-low-regexp (verilog-sig-name sig)))
7768 "~" "") 7896 "~" "")
7769 (cond ((not verilog-auto-reset-widths) 7897 (cond ((not verilog-auto-reset-widths)
7770 "0") 7898 "0")
@@ -7871,6 +7999,12 @@ Tieoff value uses `verilog-active-low-regexp' and
7871 (verilog-backward-open-paren) 7999 (verilog-backward-open-paren)
7872 (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_\$]" nil nil)) 8000 (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_\$]" nil nil))
7873 (skip-chars-backward "a-zA-Z0-9'_$") 8001 (skip-chars-backward "a-zA-Z0-9'_$")
8002 ;; #1 is legal syntax for gate primitives
8003 (when (save-excursion
8004 (verilog-backward-syntactic-ws-quick)
8005 (eq ?# (char-before)))
8006 (verilog-re-search-backward-quick "\\b[a-zA-Z0-9`_\$]" nil nil)
8007 (skip-chars-backward "a-zA-Z0-9'_$"))
7874 (looking-at "[a-zA-Z0-9`_\$]+") 8008 (looking-at "[a-zA-Z0-9`_\$]+")
7875 ;; Important: don't use match string, this must work with Emacs 19 font-lock on 8009 ;; Important: don't use match string, this must work with Emacs 19 font-lock on
7876 (buffer-substring-no-properties (match-beginning 0) (match-end 0)) 8010 (buffer-substring-no-properties (match-beginning 0) (match-end 0))
@@ -8108,7 +8242,12 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8108 ;; Type? 8242 ;; Type?
8109 ((unless ptype 8243 ((unless ptype
8110 (verilog-typedef-name-p keywd)) 8244 (verilog-typedef-name-p keywd))
8111 (setq typedefed keywd)) 8245 (cond (io
8246 (setq typedefed
8247 (if typedefed (concat typedefed " " keywd) keywd)))
8248 (t (setq vec nil enum nil rvalue nil signed nil
8249 typedefed nil multidim nil sig-paren paren
8250 expect-signal 'sigs-var modport nil))))
8112 ;; Interface with optional modport in v2k arglist? 8251 ;; Interface with optional modport in v2k arglist?
8113 ;; Skip over parsing modport, and take the interface name as the type 8252 ;; Skip over parsing modport, and take the interface name as the type
8114 ((and v2kargs-ok 8253 ((and v2kargs-ok
@@ -8199,9 +8338,18 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8199 ;; - we want an error when we are debugging this code if they are refed. 8338 ;; - we want an error when we are debugging this code if they are refed.
8200 (defvar sigs-in) 8339 (defvar sigs-in)
8201 (defvar sigs-inout) 8340 (defvar sigs-inout)
8202 (defvar sigs-out)
8203 (defvar sigs-intf) 8341 (defvar sigs-intf)
8204 (defvar sigs-intfd)) 8342 (defvar sigs-intfd)
8343 (defvar sigs-out)
8344 (defvar sigs-out-d)
8345 (defvar sigs-out-i)
8346 (defvar sigs-out-unk)
8347 (defvar sigs-temp)
8348 ;; These are known to be from other packages and may not be defined
8349 (defvar diff-command nil)
8350 (defvar vector-skip-list)
8351 ;; There are known to be from newer versions of Emacs
8352 (defvar create-lockfiles))
8205 8353
8206(defun verilog-read-sub-decls-sig (submoddecls comment port sig vec multidim) 8354(defun verilog-read-sub-decls-sig (submoddecls comment port sig vec multidim)
8207 "For `verilog-read-sub-decls-line', add a signal." 8355 "For `verilog-read-sub-decls-line', add a signal."
@@ -8458,7 +8606,7 @@ Outputs comments above subcell signals, for example:
8458 (subprim (member submod verilog-gate-keywords)) 8606 (subprim (member submod verilog-gate-keywords))
8459 (comment (concat inst " of " submod ".v")) 8607 (comment (concat inst " of " submod ".v"))
8460 submodi submoddecls) 8608 submodi submoddecls)
8461 (cond 8609 (cond
8462 (subprim 8610 (subprim
8463 (setq submodi `primitive 8611 (setq submodi `primitive
8464 submoddecls (verilog-decls-new nil nil nil nil nil nil nil nil nil) 8612 submoddecls (verilog-decls-new nil nil nil nil nil nil nil nil nil)
@@ -8575,17 +8723,6 @@ Must call `verilog-read-auto-lisp-present' before this function."
8575 (verilog-in-hooks t)) 8723 (verilog-in-hooks t))
8576 (eval-region beg-pt end-pt nil)))))) 8724 (eval-region beg-pt end-pt nil))))))
8577 8725
8578(eval-when-compile
8579 ;; Prevent compile warnings; these are let's, not globals
8580 ;; Do not remove the eval-when-compile
8581 ;; - we want an error when we are debugging this code if they are refed.
8582 (defvar sigs-in)
8583 (defvar sigs-out-d)
8584 (defvar sigs-out-i)
8585 (defvar sigs-out-unk)
8586 (defvar sigs-temp)
8587 (defvar vector-skip-list))
8588
8589(defun verilog-read-always-signals-recurse 8726(defun verilog-read-always-signals-recurse
8590 (exit-keywd rvalue temp-next) 8727 (exit-keywd rvalue temp-next)
8591 "Recursive routine for parentheses/bracket matching. 8728 "Recursive routine for parentheses/bracket matching.
@@ -8971,8 +9108,9 @@ warning message, you need to add to your init file:
8971 (while (re-search-forward "^\\s-*`define\\s-+\\([a-zA-Z0-9_$]+\\)\\s-+\\(.*\\)$" nil t) 9108 (while (re-search-forward "^\\s-*`define\\s-+\\([a-zA-Z0-9_$]+\\)\\s-+\\(.*\\)$" nil t)
8972 (let ((defname (match-string-no-properties 1)) 9109 (let ((defname (match-string-no-properties 1))
8973 (defvalue (match-string-no-properties 2))) 9110 (defvalue (match-string-no-properties 2)))
8974 (setq defvalue (verilog-string-replace-matches "\\s-*/[/*].*$" "" nil nil defvalue)) 9111 (unless (verilog-inside-comment-or-string-p (match-beginning 0))
8975 (verilog-set-define defname defvalue origbuf))) 9112 (setq defvalue (verilog-string-replace-matches "\\s-*/[/*].*$" "" nil nil defvalue))
9113 (verilog-set-define defname defvalue origbuf))))
8976 ;; Hack: Read parameters 9114 ;; Hack: Read parameters
8977 (goto-char (point-min)) 9115 (goto-char (point-min))
8978 (while (re-search-forward 9116 (while (re-search-forward
@@ -8985,8 +9123,9 @@ warning message, you need to add to your init file:
8985 (forward-comment 99999) 9123 (forward-comment 99999)
8986 (while (looking-at (concat "\\s-*,?\\s-*\\(?:/[/*].*?$\\)?\\s-*\\([a-zA-Z0-9_$]+\\)" 9124 (while (looking-at (concat "\\s-*,?\\s-*\\(?:/[/*].*?$\\)?\\s-*\\([a-zA-Z0-9_$]+\\)"
8987 "\\s-*=\\s-*\\([^;,]*\\),?\\s-*\\(/[/*].*?$\\)?\\s-*")) 9125 "\\s-*=\\s-*\\([^;,]*\\),?\\s-*\\(/[/*].*?$\\)?\\s-*"))
8988 (verilog-set-define (match-string-no-properties 1) 9126 (unless (verilog-inside-comment-or-string-p (match-beginning 0))
8989 (match-string-no-properties 2) origbuf enumname) 9127 (verilog-set-define (match-string-no-properties 1)
9128 (match-string-no-properties 2) origbuf enumname))
8990 (goto-char (match-end 0)) 9129 (goto-char (match-end 0))
8991 (forward-comment 99999))))))) 9130 (forward-comment 99999)))))))
8992 9131
@@ -9189,7 +9328,7 @@ Used for __FLAGS__ in `verilog-expand-command'."
9189;; 9328;;
9190 9329
9191(defvar verilog-dir-cache-preserving nil 9330(defvar verilog-dir-cache-preserving nil
9192 "If set, the directory cache is enabled, and file system changes are ignored. 9331 "If true, the directory cache is enabled, and file system changes are ignored.
9193See `verilog-dir-exists-p' and `verilog-dir-files'.") 9332See `verilog-dir-exists-p' and `verilog-dir-files'.")
9194 9333
9195;; If adding new cached variable, add also to verilog-preserve-dir-cache 9334;; If adding new cached variable, add also to verilog-preserve-dir-cache
@@ -9678,7 +9817,8 @@ those clocking block's signals."
9678 "Return all signals in IN-LIST matching the given REGEXP, if non-nil." 9817 "Return all signals in IN-LIST matching the given REGEXP, if non-nil."
9679 (if (or (not regexp) (equal regexp "")) 9818 (if (or (not regexp) (equal regexp ""))
9680 in-list 9819 in-list
9681 (let (out-list) 9820 (let ((case-fold-search verilog-case-fold)
9821 out-list)
9682 (while in-list 9822 (while in-list
9683 (if (string-match regexp (verilog-sig-name (car in-list))) 9823 (if (string-match regexp (verilog-sig-name (car in-list)))
9684 (setq out-list (cons (car in-list) out-list))) 9824 (setq out-list (cons (car in-list) out-list)))
@@ -9689,7 +9829,8 @@ those clocking block's signals."
9689 "Return all signals in IN-LIST not matching the given REGEXP, if non-nil." 9829 "Return all signals in IN-LIST not matching the given REGEXP, if non-nil."
9690 (if (or (not regexp) (equal regexp "")) 9830 (if (or (not regexp) (equal regexp ""))
9691 in-list 9831 in-list
9692 (let (out-list) 9832 (let ((case-fold-search verilog-case-fold)
9833 out-list)
9693 (while in-list 9834 (while in-list
9694 (if (not (string-match regexp (verilog-sig-name (car in-list)))) 9835 (if (not (string-match regexp (verilog-sig-name (car in-list))))
9695 (setq out-list (cons (car in-list) out-list))) 9836 (setq out-list (cons (car in-list) out-list)))
@@ -10019,7 +10160,7 @@ This repairs those mis-inserted by an AUTOARG."
10019(defun verilog-typedef-name-p (variable-name) 10160(defun verilog-typedef-name-p (variable-name)
10020 "Return true if the VARIABLE-NAME is a type definition." 10161 "Return true if the VARIABLE-NAME is a type definition."
10021 (when verilog-typedef-regexp 10162 (when verilog-typedef-regexp
10022 (string-match verilog-typedef-regexp variable-name))) 10163 (verilog-string-match-fold verilog-typedef-regexp variable-name)))
10023 10164
10024;; 10165;;
10025;; Auto deletion 10166;; Auto deletion
@@ -10388,7 +10529,7 @@ DIFFPT. This function is called via `verilog-diff-function'."
10388 (let ((name1 (with-current-buffer b1 (buffer-file-name)))) 10529 (let ((name1 (with-current-buffer b1 (buffer-file-name))))
10389 (verilog-warn "%s:%d: Difference in AUTO expansion found" 10530 (verilog-warn "%s:%d: Difference in AUTO expansion found"
10390 name1 (with-current-buffer b1 10531 name1 (with-current-buffer b1
10391 (1+ (count-lines (point-min) (point))))) 10532 (count-lines (point-min) diffpt)))
10392 (cond (noninteractive 10533 (cond (noninteractive
10393 (verilog-diff-file-with-buffer name1 b2 t t)) 10534 (verilog-diff-file-with-buffer name1 b2 t t))
10394 (t 10535 (t
@@ -10617,7 +10758,6 @@ See the example in `verilog-auto-inout-modport'."
10617 ;; Note this may raise an error 10758 ;; Note this may raise an error
10618 (when (setq submodi (verilog-modi-lookup submod t)) 10759 (when (setq submodi (verilog-modi-lookup submod t))
10619 (let* ((indent-pt (current-indentation)) 10760 (let* ((indent-pt (current-indentation))
10620 (modi (verilog-modi-current))
10621 (submoddecls (verilog-modi-get-decls submodi)) 10761 (submoddecls (verilog-modi-get-decls submodi))
10622 (submodportdecls (verilog-modi-modport-lookup submodi modport-re)) 10762 (submodportdecls (verilog-modi-modport-lookup submodi modport-re))
10623 (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve 10763 (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve
@@ -10694,7 +10834,7 @@ If PAR-VALUES replace final strings with these parameter values."
10694 "")) 10834 ""))
10695 (case-fold-search nil) 10835 (case-fold-search nil)
10696 (check-values par-values) 10836 (check-values par-values)
10697 tpl-net) 10837 tpl-net dflt-bits)
10698 ;; Replace parameters in bit-width 10838 ;; Replace parameters in bit-width
10699 (when (and check-values 10839 (when (and check-values
10700 (not (equal vl-bits ""))) 10840 (not (equal vl-bits "")))
@@ -10712,11 +10852,14 @@ If PAR-VALUES replace final strings with these parameter values."
10712 vl-mbits (verilog-simplify-range-expression vl-mbits) 10852 vl-mbits (verilog-simplify-range-expression vl-mbits)
10713 vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed 10853 vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed
10714 ;; Default net value if not found 10854 ;; Default net value if not found
10715 (setq tpl-net (concat port 10855 (setq dflt-bits (if (and (verilog-sig-bits port-st)
10856 (or (verilog-sig-multidim port-st)
10857 (verilog-sig-memory port-st)))
10858 (concat "/*" vl-mbits vl-bits "*/")
10859 (concat vl-bits))
10860 tpl-net (concat port
10716 (if vl-modport (concat "." vl-modport) "") 10861 (if vl-modport (concat "." vl-modport) "")
10717 (if (verilog-sig-multidim port-st) 10862 dflt-bits))
10718 (concat "/*" vl-mbits vl-bits "*/")
10719 (concat vl-bits))))
10720 ;; Find template 10863 ;; Find template
10721 (cond (tpl-ass ; Template of exact port name 10864 (cond (tpl-ass ; Template of exact port name
10722 (setq tpl-net (nth 1 tpl-ass))) 10865 (setq tpl-net (nth 1 tpl-ass)))
@@ -10749,6 +10892,7 @@ If PAR-VALUES replace final strings with these parameter values."
10749 (substring tpl-net (match-end 0)))))) 10892 (substring tpl-net (match-end 0))))))
10750 ;; Replace @ and [] magic variables in final output 10893 ;; Replace @ and [] magic variables in final output
10751 (setq tpl-net (verilog-string-replace-matches "@" tpl-num nil nil tpl-net)) 10894 (setq tpl-net (verilog-string-replace-matches "@" tpl-num nil nil tpl-net))
10895 (setq tpl-net (verilog-string-replace-matches "\\[\\]\\[\\]" dflt-bits nil nil tpl-net))
10752 (setq tpl-net (verilog-string-replace-matches "\\[\\]" vl-bits nil nil tpl-net))) 10896 (setq tpl-net (verilog-string-replace-matches "\\[\\]" vl-bits nil nil tpl-net)))
10753 ;; Insert it 10897 ;; Insert it
10754 (indent-to indent-pt) 10898 (indent-to indent-pt)
@@ -10861,6 +11005,10 @@ Limitations:
10861 AUTOWIRE declarations, etc. Gates are the only case when 11005 AUTOWIRE declarations, etc. Gates are the only case when
10862 position based connections are passed. 11006 position based connections are passed.
10863 11007
11008 The array part of arrayed instances are ignored; this may
11009 result in undesirable default AUTOINST connections; use a
11010 template instead.
11011
10864For example, first take the submodule InstModule.v: 11012For example, first take the submodule InstModule.v:
10865 11013
10866 module InstModule (o,i); 11014 module InstModule (o,i);
@@ -10940,6 +11088,19 @@ Templates:
10940 words and capitalized. Only signals that must be different for each 11088 words and capitalized. Only signals that must be different for each
10941 instantiation need to be listed. 11089 instantiation need to be listed.
10942 11090
11091 Inside a template, a [] in a connection name (with nothing else
11092 inside the brackets) will be replaced by the same bus subscript
11093 as it is being connected to, or the [] will be removed if it is
11094 a single bit signal.
11095
11096 Inside a template, a [][] in a connection name will behave
11097 similarly to a [] for scalar or single-dimensional connection;
11098 for a multidimensional connection it will print a comment
11099 similar to that printed when a template is not used. Generally
11100 it is a good idea to do this for all connections in a template,
11101 as then they will work for any width signal, and with AUTOWIRE.
11102 See PTL_BUS becoming PTL_BUSNEW below.
11103
10943 Inside a template, a [] in a connection name (with nothing else inside 11104 Inside a template, a [] in a connection name (with nothing else inside
10944 the brackets) will be replaced by the same bus subscript as it is being 11105 the brackets) will be replaced by the same bus subscript as it is being
10945 connected to, or the [] will be removed if it is a single bit signal. 11106 connected to, or the [] will be removed if it is a single bit signal.
@@ -11159,7 +11320,7 @@ For more information see the \\[verilog-faq] and forums at URL
11159 ;; automatic variable instantiation program. 11320 ;; automatic variable instantiation program.
11160 (let* ((tpl-info (verilog-read-auto-template submod)) 11321 (let* ((tpl-info (verilog-read-auto-template submod))
11161 (tpl-regexp (aref tpl-info 0))) 11322 (tpl-regexp (aref tpl-info 0)))
11162 (setq tpl-num (if (string-match tpl-regexp inst) 11323 (setq tpl-num (if (verilog-string-match-fold tpl-regexp inst)
11163 (match-string 1 inst) 11324 (match-string 1 inst)
11164 "") 11325 "")
11165 tpl-list (aref tpl-info 1))) 11326 tpl-list (aref tpl-info 1)))
@@ -11302,7 +11463,7 @@ Templates:
11302 ;; automatic variable instantiation program. 11463 ;; automatic variable instantiation program.
11303 (let* ((tpl-info (verilog-read-auto-template submod)) 11464 (let* ((tpl-info (verilog-read-auto-template submod))
11304 (tpl-regexp (aref tpl-info 0))) 11465 (tpl-regexp (aref tpl-info 0)))
11305 (setq tpl-num (if (string-match tpl-regexp inst) 11466 (setq tpl-num (if (verilog-string-match-fold tpl-regexp inst)
11306 (match-string 1 inst) 11467 (match-string 1 inst)
11307 "") 11468 "")
11308 tpl-list (aref tpl-info 1))) 11469 tpl-list (aref tpl-info 1)))
@@ -11593,6 +11754,7 @@ same expansion will result from only extracting outputs starting with ov:
11593 (verilog-subdecls-get-outputs modsubdecls) 11754 (verilog-subdecls-get-outputs modsubdecls)
11594 (append (verilog-decls-get-outputs moddecls) 11755 (append (verilog-decls-get-outputs moddecls)
11595 (verilog-decls-get-inouts moddecls) 11756 (verilog-decls-get-inouts moddecls)
11757 (verilog-decls-get-inputs moddecls)
11596 (verilog-subdecls-get-inputs modsubdecls) 11758 (verilog-subdecls-get-inputs modsubdecls)
11597 (verilog-subdecls-get-inouts modsubdecls))))) 11759 (verilog-subdecls-get-inouts modsubdecls)))))
11598 (when regexp 11760 (when regexp
@@ -11719,6 +11881,7 @@ same expansion will result from only extracting inputs starting with i:
11719 (verilog-subdecls-get-inputs modsubdecls) 11881 (verilog-subdecls-get-inputs modsubdecls)
11720 (append (verilog-decls-get-inputs moddecls) 11882 (append (verilog-decls-get-inputs moddecls)
11721 (verilog-decls-get-inouts moddecls) 11883 (verilog-decls-get-inouts moddecls)
11884 (verilog-decls-get-outputs moddecls)
11722 (verilog-decls-get-vars moddecls) 11885 (verilog-decls-get-vars moddecls)
11723 (verilog-decls-get-consts moddecls) 11886 (verilog-decls-get-consts moddecls)
11724 (verilog-decls-get-gparams moddecls) 11887 (verilog-decls-get-gparams moddecls)
@@ -12062,67 +12225,36 @@ Limitations:
12062 If placed inside the parenthesis of a module declaration, it creates 12225 If placed inside the parenthesis of a module declaration, it creates
12063 Verilog 2001 style, else uses Verilog 1995 style. 12226 Verilog 2001 style, else uses Verilog 1995 style.
12064 12227
12065 Concatenation and outputting partial buses is not supported.
12066
12067 Module names must be resolvable to filenames. See `verilog-auto-inst'. 12228 Module names must be resolvable to filenames. See `verilog-auto-inst'.
12068 12229
12069 Signals are not inserted in the same order as in the original module, 12230 Parameters are inserted in the same order as in the original module.
12070 though they will appear to be in the same order to an AUTOINST
12071 instantiating either module.
12072 12231
12073 Signals declared as \"output reg\" or \"output wire\" etc will 12232 Parameters do not have values, which is SystemVerilog 2009 syntax.
12074 lose the wire/reg declaration so that shell modules may
12075 generate those outputs differently. However, \"output logic\"
12076 is propagated.
12077 12233
12078An example: 12234An example:
12079 12235
12080 module ExampShell (/*AUTOARG*/); 12236 module ExampShell ();
12081 /*AUTOINOUTMODULE(\"ExampMain\")*/ 12237 /*AUTOINOUTPARAM(\"ExampMain\")*/
12082 endmodule 12238 endmodule
12083 12239
12084 module ExampMain (i,o,io); 12240 module ExampMain ();
12085 input i; 12241 parameter PARAM = 22;
12086 output o;
12087 inout io;
12088 endmodule 12242 endmodule
12089 12243
12090Typing \\[verilog-auto] will make this into: 12244Typing \\[verilog-auto] will make this into:
12091 12245
12092 module ExampShell (/*AUTOARG*/i,o,io); 12246 module ExampShell (/*AUTOARG*/i,o,io);
12093 /*AUTOINOUTMODULE(\"ExampMain\")*/ 12247 /*AUTOINOUTPARAM(\"ExampMain\")*/
12094 // Beginning of automatic in/out/inouts (from specific module) 12248 // Beginning of automatic parameters (from specific module)
12095 output o; 12249 parameter PARAM;
12096 inout io;
12097 input i;
12098 // End of automatics 12250 // End of automatics
12099 endmodule 12251 endmodule
12100 12252
12101You may also provide an optional regular expression, in which case only 12253You may also provide an optional regular expression, in which case only
12102signals matching the regular expression will be included. For example the 12254parameters matching the regular expression will be included. For example the
12103same expansion will result from only extracting signals starting with i: 12255same expansion will result from only extracting parameters starting with i:
12104
12105 /*AUTOINOUTMODULE(\"ExampMain\",\"^i\")*/
12106
12107You may also provide an optional second regular expression, in
12108which case only signals which have that pin direction and data
12109type will be included. This matches against everything before
12110the signal name in the declaration, for example against
12111\"input\" (single bit), \"output logic\" (direction and type) or
12112\"output [1:0]\" (direction and implicit type). You also
12113probably want to skip spaces in your regexp.
12114
12115For example, the below will result in matching the output \"o\"
12116against the previous example's module:
12117
12118 /*AUTOINOUTMODULE(\"ExampMain\",\"\",\"^output.*\")*/
12119 12256
12120You may also provide an optional third regular expression, in 12257 /*AUTOINOUTPARAM(\"ExampMain\",\"^i\")*/"
12121which case any parameter names that match the given regexp will
12122be included. Including parameters is off by default. To include
12123all signals and parameters, use:
12124
12125 /*AUTOINOUTMODULE(\"ExampMain\",\".*\",\".*\",\".*\")*/"
12126 (save-excursion 12258 (save-excursion
12127 (let* ((params (verilog-read-auto-params 1 2)) 12259 (let* ((params (verilog-read-auto-params 1 2))
12128 (submod (nth 0 params)) 12260 (submod (nth 0 params))
@@ -12896,7 +13028,7 @@ Typing \\[verilog-auto] will make this into:
12896 ;; count(enums) == width(sig) 13028 ;; count(enums) == width(sig)
12897 (equal (number-to-string (length enum-sigs)) 13029 (equal (number-to-string (length enum-sigs))
12898 (verilog-sig-width undecode-sig))))) 13030 (verilog-sig-width undecode-sig)))))
12899 (enum-chars 0) 13031 (enum-chars 0)
12900 (ascii-chars 0)) 13032 (ascii-chars 0))
12901 ;; 13033 ;;
12902 ;; Find number of ascii chars needed 13034 ;; Find number of ascii chars needed
@@ -13019,6 +13151,9 @@ Use \\[verilog-inject-auto] to insert AUTOs for the first time.
13019 13151
13020Use \\[verilog-faq] for a pointer to frequently asked questions. 13152Use \\[verilog-faq] for a pointer to frequently asked questions.
13021 13153
13154For new users, we recommend setting `verilog-case-fold' to nil
13155and `verilog-auto-arg-sort' to t.
13156
13022The hooks `verilog-before-auto-hook' and `verilog-auto-hook' are 13157The hooks `verilog-before-auto-hook' and `verilog-auto-hook' are
13023called before and after this function, respectively. 13158called before and after this function, respectively.
13024 13159
@@ -13044,12 +13179,12 @@ Using \\[describe-function], see also:
13044 `verilog-auto-arg' for AUTOARG module instantiations 13179 `verilog-auto-arg' for AUTOARG module instantiations
13045 `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding 13180 `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding
13046 `verilog-auto-assign-modport' for AUTOASSIGNMODPORT assignment to/from modport 13181 `verilog-auto-assign-modport' for AUTOASSIGNMODPORT assignment to/from modport
13182 `verilog-auto-inout' for AUTOINOUT making hierarchy inouts
13047 `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o 13183 `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o
13048 `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o 13184 `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o
13049 `verilog-auto-inout-modport' for AUTOINOUTMODPORT i/o from an interface modport 13185 `verilog-auto-inout-modport' for AUTOINOUTMODPORT i/o from an interface modport
13050 `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere 13186 `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere
13051 `verilog-auto-inout-param' for AUTOINOUTPARAM copying params from elsewhere 13187 `verilog-auto-inout-param' for AUTOINOUTPARAM copying params from elsewhere
13052 `verilog-auto-inout' for AUTOINOUT making hierarchy inouts
13053 `verilog-auto-input' for AUTOINPUT making hierarchy inputs 13188 `verilog-auto-input' for AUTOINPUT making hierarchy inputs
13054 `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function 13189 `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function
13055 `verilog-auto-inst' for AUTOINST instantiation pins 13190 `verilog-auto-inst' for AUTOINST instantiation pins
@@ -13061,7 +13196,7 @@ Using \\[describe-function], see also:
13061 `verilog-auto-reg' for AUTOREG registers 13196 `verilog-auto-reg' for AUTOREG registers
13062 `verilog-auto-reg-input' for AUTOREGINPUT instantiation registers 13197 `verilog-auto-reg-input' for AUTOREGINPUT instantiation registers
13063 `verilog-auto-reset' for AUTORESET flop resets 13198 `verilog-auto-reset' for AUTORESET flop resets
13064 `verilog-auto-sense' for AUTOSENSE always sensitivity lists 13199 `verilog-auto-sense' for AUTOSENSE or AS always sensitivity lists
13065 `verilog-auto-tieoff' for AUTOTIEOFF output tieoffs 13200 `verilog-auto-tieoff' for AUTOTIEOFF output tieoffs
13066 `verilog-auto-undef' for AUTOUNDEF `undef of local `defines 13201 `verilog-auto-undef' for AUTOUNDEF `undef of local `defines
13067 `verilog-auto-unused' for AUTOUNUSED unused inputs/inouts 13202 `verilog-auto-unused' for AUTOUNUSED unused inputs/inouts
@@ -13080,6 +13215,7 @@ Wilson Snyder (wsnyder@wsnyder.org)."
13080 (verilog-save-font-mods 13215 (verilog-save-font-mods
13081 (let ((oldbuf (if (not (buffer-modified-p)) 13216 (let ((oldbuf (if (not (buffer-modified-p))
13082 (buffer-string))) 13217 (buffer-string)))
13218 (case-fold-search verilog-case-fold)
13083 ;; Cache directories; we don't write new files, so can't change 13219 ;; Cache directories; we don't write new files, so can't change
13084 (verilog-dir-cache-preserving t) 13220 (verilog-dir-cache-preserving t)
13085 ;; Cache current module 13221 ;; Cache current module
@@ -13210,7 +13346,7 @@ Wilson Snyder (wsnyder@wsnyder.org)."
13210 (define-key map "r" 'verilog-sk-repeat) 13346 (define-key map "r" 'verilog-sk-repeat)
13211 (define-key map "s" 'verilog-sk-specify) 13347 (define-key map "s" 'verilog-sk-specify)
13212 (define-key map "t" 'verilog-sk-task) 13348 (define-key map "t" 'verilog-sk-task)
13213 (define-key map "u" 'verilog-sk-uvm-class) 13349 (define-key map "u" 'verilog-sk-uvm-object)
13214 (define-key map "w" 'verilog-sk-while) 13350 (define-key map "w" 'verilog-sk-while)
13215 (define-key map "x" 'verilog-sk-casex) 13351 (define-key map "x" 'verilog-sk-casex)
13216 (define-key map "z" 'verilog-sk-casez) 13352 (define-key map "z" 'verilog-sk-casez)
@@ -13223,6 +13359,7 @@ Wilson Snyder (wsnyder@wsnyder.org)."
13223 (define-key map "O" 'verilog-sk-output) 13359 (define-key map "O" 'verilog-sk-output)
13224 (define-key map "S" 'verilog-sk-state-machine) 13360 (define-key map "S" 'verilog-sk-state-machine)
13225 (define-key map "=" 'verilog-sk-inout) 13361 (define-key map "=" 'verilog-sk-inout)
13362 (define-key map "U" 'verilog-sk-uvm-component)
13226 (define-key map "W" 'verilog-sk-wire) 13363 (define-key map "W" 'verilog-sk-wire)
13227 (define-key map "R" 'verilog-sk-reg) 13364 (define-key map "R" 'verilog-sk-reg)
13228 (define-key map "D" 'verilog-sk-define-signal) 13365 (define-key map "D" 'verilog-sk-define-signal)
@@ -13339,13 +13476,13 @@ See also `verilog-header' for an alternative format."
13339 > _ \n 13476 > _ \n
13340 > "endclass" (progn (electric-verilog-terminate-line) nil)) 13477 > "endclass" (progn (electric-verilog-terminate-line) nil))
13341 13478
13342(define-skeleton verilog-sk-uvm-class 13479(define-skeleton verilog-sk-uvm-object
13343 "Insert a class definition" 13480 "Insert a class definition"
13344 () 13481 ()
13345 > "class " (setq name (skeleton-read "Name: ")) " extends " (skeleton-read "Extends: ") ";" \n 13482 > "class " (setq name (skeleton-read "Name: ")) " extends " (skeleton-read "Extends: ") ";" \n
13346 > _ \n 13483 > _ \n
13347 > "`uvm_object_utils_begin(" name ")" \n 13484 > "`uvm_object_utils_begin(" name ")" \n
13348 > (- verilog-indent-level) " `uvm_object_utils_end" \n 13485 > (- verilog-indent-level) "`uvm_object_utils_end" \n
13349 > _ \n 13486 > _ \n
13350 > "function new(name=\"" name "\");" \n 13487 > "function new(name=\"" name "\");" \n
13351 > "super.new(name);" \n 13488 > "super.new(name);" \n
@@ -13353,6 +13490,20 @@ See also `verilog-header' for an alternative format."
13353 > _ \n 13490 > _ \n
13354 > "endclass" (progn (electric-verilog-terminate-line) nil)) 13491 > "endclass" (progn (electric-verilog-terminate-line) nil))
13355 13492
13493(define-skeleton verilog-sk-uvm-component
13494 "Insert a class definition"
13495 ()
13496 > "class " (setq name (skeleton-read "Name: ")) " extends " (skeleton-read "Extends: ") ";" \n
13497 > _ \n
13498 > "`uvm_component_utils_begin(" name ")" \n
13499 > (- verilog-indent-level) "`uvm_component_utils_end" \n
13500 > _ \n
13501 > "function new(name=\"\", uvm_component parent);" \n
13502 > "super.new(name, parent);" \n
13503 > (- verilog-indent-level) "endfunction" \n
13504 > _ \n
13505 > "endclass" (progn (electric-verilog-terminate-line) nil))
13506
13356(define-skeleton verilog-sk-primitive 13507(define-skeleton verilog-sk-primitive
13357 "Insert a task definition." 13508 "Insert a task definition."
13358 () 13509 ()
@@ -13797,6 +13948,7 @@ Files are checked based on `verilog-library-flags'."
13797 verilog-before-getopt-flags-hook 13948 verilog-before-getopt-flags-hook
13798 verilog-before-save-font-hook 13949 verilog-before-save-font-hook
13799 verilog-cache-enabled 13950 verilog-cache-enabled
13951 verilog-case-fold
13800 verilog-case-indent 13952 verilog-case-indent
13801 verilog-cexp-indent 13953 verilog-cexp-indent
13802 verilog-compiler 13954 verilog-compiler
@@ -13823,7 +13975,6 @@ Files are checked based on `verilog-library-flags'."
13823 verilog-linter 13975 verilog-linter
13824 verilog-minimum-comment-distance 13976 verilog-minimum-comment-distance
13825 verilog-mode-hook 13977 verilog-mode-hook
13826 verilog-mode-release-date
13827 verilog-mode-release-emacs 13978 verilog-mode-release-emacs
13828 verilog-mode-version 13979 verilog-mode-version
13829 verilog-preprocessor 13980 verilog-preprocessor