aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilson Snyder2015-05-14 21:37:32 -0400
committerWilson Snyder2015-05-14 21:37:32 -0400
commitca6a7774c533d87ad8d8e17624bbd70e9d086bc0 (patch)
tree687ec332603d612c6e465c14f363074f4de17cfe
parent1d1581a2de6c6378cdf730197c6886d0e036805e (diff)
downloademacs-ca6a7774c533d87ad8d8e17624bbd70e9d086bc0.tar.gz
emacs-ca6a7774c533d87ad8d8e17624bbd70e9d086bc0.zip
Sync with upstream verilog-mode revision 6232468
* lisp/progmodes/verilog-mode.el (verilog-font-lock-grouping-keywords-face) (verilog-highlight-grouping-keywords): Fix use of face when `verilog-highlight-grouping-keywords' set. Reported by Jeff Pompa. (verilog-auto-reset): Fix AUTORESET to ignore member resets if parent is reset, bug906. Reported by Ken Schmidt. (verilog-auto-inout-module): Add fourth regexp argument to AUTOINOUTMODULE and AUTOINOUTCOMP for signals to not match, bug856. Reported by John Tillema. (verilog-auto-inst-port): Fix AUTOINST interfaces to not show modport if signal attachment is itself a modport. Reported by Matthew Lovell. (verilog-auto-reset, verilog-auto-sense-sigs): Fix AUTORESET with always_comb and always_latch, bug844. Reported by Greg Hilton. (verilog-at-constraint-p, verilog-beg-of-statement-1): Fix hanging with many curly-bracket pairs, bug663. (verilog-set-auto-endcomments): Fix end comments for functions of type void, etc. Reported by Alex Reed. (verilog-do-indent): Fix electric tab deleting form-feeds. Note caused by indent-line-to deleting tabls pre 24.5. (verilog-nameable-item-re): Fix nameable items that can have an end-identifier to include endchecker, endgroup, endprogram, endproperty, and endsequence. Reported by Alex Reed. (verilog-label-be): When auto-commenting a buffer, consider auto-comments on all known keywords (not just a subset thereof). Reported by Alex Reed. (verilog-auto-end-comment-lines-re) (verilog-end-block-ordered-re, verilog-set-auto-endcomments): Automatically comment property/endproperty blocks to match other similar blocks like sequence/endsequence, function/endfunction, etc. Reported by Alex Reed. (verilog-set-auto-endcomments): Detect the function- or task-name when auto-commenting blocks that lack an explicit portlist. Reported by Alex Reed. (verilog-auto, verilog-auto-insert-last): Add AUTOINSERTLAST to allow post-AUTO user fixups, bug826. Reported by Dennis Muhlestein. (verilog-no-indent-begin-re): When `verilog-indent-begin-after-if' is nil, fix indenting initial/final to match always statements, bug825. Reported by Tim Clapp. (verilog-extended-complete-re): Fix indentation of DPI-C imports with c_identifiers, and DPI-C imports, bug557. Reported by ZeDong Mao and Jason Forkey. (verilog-read-decls): Fix parsing typed interfaces. Fix AUTOINOUTMODPORT missing types. Reported by Stephan Bourduas. Fix localparam not being ignored in AUTOINSTPARAM, bug889. Reported by Shannon Hill. (verilog-auto-output-every): Add regexp to AUTOOUTPUTEVERY, bug793. Reported by Pierre-David Pfister. (verilog-auto-arg-format, verilog-auto-arg-ports): Add verilog-auto-arg-format to support newlines in AUTOARG. Reported by Jie Xiao. (verilog-batch-execute-func): Do not batch re-auto files loaded by Local Variables. Fix printing "no changes to be saved" with verilog-batch. Reported by Dan Dever. (verilog-auto-inout-module): Fix AUTOINOUTMODULE not inserting interface-only modules, bug721. Reported by Dean Hoyt. Author: Alex Reed <acreed4@gmail.com> * lisp/progmodes/verilog-mode.el (verilog-beg-of-statement): Don't treat '<keyword>:<identifier>' as the start of a labeled statement, bug905. Reported by Enzo Chi. (verilog-directive-re, verilog-compiler-directives) (verilog-keywords): Match full set of IEEE 2012-1800 compiler directives (plus some extras) when determining indentation, bug 901. Reported by Bernd Beuster. (verilog-at-constraint-p): Fix indentation of coverpoint bins if iff expression doesn't start with word-character, bug900. (verilog-optional-signed-range-re, verilog-optional-signed-re): Fix incorrect indentation/alignment of unsigned declarations, bug897. (verilog-looking-back, verilog-in-attribute-p): Fix labling of always constructs, bug895. (verilog-calc-1): Fix verilog-mode constraint indentation, bug324. Reported by Eric Mastromarchi. (verilog-beg-of-statement): Fix indenting for some forms of constraintsm bug433. Reported by Brad Parker. Fix indentation of continued assignment incorrect if first line ends with ']', bug437. Reported by Dan Dever. Fix indention of cover inside an ifdef, bug 862. Reported by Bernd Beuster Fix labeling do-while blocks, bug842. (verilog-preprocessor-re): Fix fork/end UNMATCHED warning, bug859. Reported by Kaushal Modi. (verilog-set-auto-endcomments): Fix endlabel end comments, bug888. (verilog-backward-token): Fix indenting sensitivity lists with named events, bug840. Reed. (verilog-no-indent-begin-re): Fix `verilog-indent-begin-after-if' nil not honoring 'forever', 'foreach', and 'do' keywords.
-rw-r--r--lisp/progmodes/verilog-mode.el282
1 files changed, 208 insertions, 74 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 57206544b9b..a1ad49e9a2c 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -123,7 +123,7 @@
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 "2015-02-20-0d6420b-vpo" 126(defconst verilog-mode-version "2015-05-14-6232468-vpo-GNU"
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-emacs t 128(defconst verilog-mode-release-emacs t
129 "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.")
@@ -282,6 +282,50 @@ STRING should be given if the last search was by `string-match' on STRING."
282 ;; Emacs. 282 ;; Emacs.
283 (defalias 'verilog-regexp-opt 'regexp-opt))) 283 (defalias 'verilog-regexp-opt 'regexp-opt)))
284 284
285;; emacs >=22 has looking-back, but older emacs and xemacs don't.
286;; This function is lifted directly from emacs's subr.el
287;; so that it can be used by xemacs.
288;; The idea for this was borrowed from org-mode via this link:
289;; https://lists.gnu.org/archive/html/emacs-orgmode/2009-12/msg00032.html
290(eval-and-compile
291 (cond
292 ((fboundp 'looking-back)
293 (defalias 'verilog-looking-back 'looking-back))
294 (t
295 (defun verilog-looking-back (regexp limit &optional greedy)
296 "Return non-nil if text before point matches regular expression REGEXP.
297Like `looking-at' except matches before point, and is slower.
298LIMIT if non-nil speeds up the search by specifying a minimum
299starting position, to avoid checking matches that would start
300before LIMIT.
301
302If GREEDY is non-nil, extend the match backwards as far as
303possible, stopping when a single additional previous character
304cannot be part of a match for REGEXP. When the match is
305extended, its starting position is allowed to occur before
306LIMIT.
307
308As a general recommendation, try to avoid using `looking-back'
309wherever possible, since it is slow."
310 (let ((start (point))
311 (pos
312 (save-excursion
313 (and (re-search-backward (concat "\\(?:" regexp "\\)\\=") limit t)
314 (point)))))
315 (if (and greedy pos)
316 (save-restriction
317 (narrow-to-region (point-min) start)
318 (while (and (> pos (point-min))
319 (save-excursion
320 (goto-char pos)
321 (backward-char 1)
322 (looking-at (concat "\\(?:" regexp "\\)\\'"))))
323 (setq pos (1- pos)))
324 (save-excursion
325 (goto-char pos)
326 (looking-at (concat "\\(?:" regexp "\\)\\'")))))
327 (not (null pos)))))))
328
285(eval-and-compile 329(eval-and-compile
286 ;; Both xemacs and emacs 330 ;; Both xemacs and emacs
287 (condition-case nil 331 (condition-case nil
@@ -662,9 +706,10 @@ to see the effect as font color choices are cached by Emacs."
662 706
663(defcustom verilog-highlight-grouping-keywords nil 707(defcustom verilog-highlight-grouping-keywords nil
664 "Non-nil means highlight grouping keywords more dramatically. 708 "Non-nil means highlight grouping keywords more dramatically.
665If false, these words are in the `font-lock-type-face'; if True then they are in 709If false, these words are in the `font-lock-type-face'; if True
666`verilog-font-lock-ams-face'. Some find that special highlighting on these 710then they are in `verilog-font-lock-grouping-keywords-face'.
667grouping constructs allow the structure of the code to be understood at a glance." 711Some find that special highlighting on these grouping constructs
712allow the structure of the code to be understood at a glance."
668 :group 'verilog-mode-indent 713 :group 'verilog-mode-indent
669 :type 'boolean) 714 :type 'boolean)
670(put 'verilog-highlight-grouping-keywords 'safe-local-variable 'verilog-booleanp) 715(put 'verilog-highlight-grouping-keywords 'safe-local-variable 'verilog-booleanp)
@@ -1880,14 +1925,22 @@ find the errors."
1880(if (featurep 'xemacs) (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-xemacs)) 1925(if (featurep 'xemacs) (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-xemacs))
1881(if (featurep 'emacs) (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-emacs)) 1926(if (featurep 'emacs) (add-hook 'compilation-mode-hook 'verilog-error-regexp-add-emacs))
1882 1927
1883(defconst verilog-directive-re 1928(defconst verilog-compiler-directives
1884 (eval-when-compile 1929 (eval-when-compile
1885 (verilog-regexp-words 1930 '( ;; compiler directives, from IEEE 1800-2012 section 22.1
1886 '( 1931 "`__FILE__" "`__LINE" "`begin_keywords" "`celldefine" "`default_nettype"
1887 "`case" "`default" "`define" "`else" "`elsif" "`endfor" "`endif" 1932 "`define" "`else" "`elsif" "`end_keywords" "`endcelldefine" "`endif"
1888 "`endprotect" "`endswitch" "`endwhile" "`for" "`format" "`if" "`ifdef" 1933 "`ifdef" "`ifndef" "`include" "`line" "`nounconnected_drive" "`pragma"
1889 "`ifndef" "`include" "`let" "`protect" "`switch" "`timescale" 1934 "`resetall" "`timescale" "`unconnected_drive" "`undef" "`undefineall"
1890 "`time_scale" "`undef" "`while" )))) 1935 ;; compiler directives not covered by IEEE 1800
1936 "`case" "`default" "`endfor" "`endprotect" "`endswitch" "`endwhile" "`for"
1937 "`format" "`if" "`let" "`protect" "`switch" "`timescale" "`time_scale"
1938 "`while"
1939 ))
1940 "List of Verilog compiler directives.")
1941
1942(defconst verilog-directive-re
1943 (verilog-regexp-words verilog-compiler-directives))
1891 1944
1892(defconst verilog-directive-re-1 1945(defconst verilog-directive-re-1
1893 (concat "[ \t]*" verilog-directive-re)) 1946 (concat "[ \t]*" verilog-directive-re))
@@ -2411,11 +2464,9 @@ find the errors."
2411 "\\(\\<begin\\>\\)\\|" ; 1 2464 "\\(\\<begin\\>\\)\\|" ; 1
2412 "\\(\\<else\\>\\)\\|" ; 2 2465 "\\(\\<else\\>\\)\\|" ; 2
2413 "\\(\\<end\\>\\s-+\\<else\\>\\)\\|" ; 3 2466 "\\(\\<end\\>\\s-+\\<else\\>\\)\\|" ; 3
2414 "\\(\\<always_comb\\>\\(\[ \t\]*@\\)?\\)\\|" ; 4 2467 "\\(\\<always\\(?:_ff\\)?\\>\\(?:\[ \t\]*@\\)\\)\\|" ; 4 (matches always or always_ff w/ @...)
2415 "\\(\\<always_ff\\>\\(\[ \t\]*@\\)?\\)\\|" ; 5 2468 "\\(\\<always\\(?:_comb\\|_latch\\)?\\>\\)\\|" ; 5 (matches always, always_comb, always_latch w/o @...)
2416 "\\(\\<always_latch\\>\\(\[ \t\]*@\\)?\\)\\|" ; 6
2417 "\\(\\<fork\\>\\)\\|" ; 7 2469 "\\(\\<fork\\>\\)\\|" ; 7
2418 "\\(\\<always\\>\\(\[ \t\]*@\\)?\\)\\|"
2419 "\\(\\<if\\>\\)\\|" 2470 "\\(\\<if\\>\\)\\|"
2420 verilog-property-re "\\|" 2471 verilog-property-re "\\|"
2421 "\\(\\(" verilog-label-re "\\)?\\<assert\\>\\)\\|" 2472 "\\(\\(" verilog-label-re "\\)?\\<assert\\>\\)\\|"
@@ -2581,10 +2632,10 @@ find the errors."
2581(defconst verilog-declaration-re 2632(defconst verilog-declaration-re
2582 (concat "\\(" verilog-declaration-prefix-re "\\s-*\\)?" verilog-declaration-core-re)) 2633 (concat "\\(" verilog-declaration-prefix-re "\\s-*\\)?" verilog-declaration-core-re))
2583(defconst verilog-range-re "\\(\\[[^]]*\\]\\s-*\\)+") 2634(defconst verilog-range-re "\\(\\[[^]]*\\]\\s-*\\)+")
2584(defconst verilog-optional-signed-re "\\s-*\\(signed\\)?") 2635(defconst verilog-optional-signed-re "\\s-*\\(\\(un\\)?signed\\)?")
2585(defconst verilog-optional-signed-range-re 2636(defconst verilog-optional-signed-range-re
2586 (concat 2637 (concat
2587 "\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<signed\\>\\s-*\\)?\\(" verilog-range-re "\\)?")) 2638 "\\s-*\\(\\<\\(reg\\|wire\\)\\>\\s-*\\)?\\(\\<\\(un\\)?signed\\>\\s-*\\)?\\(" verilog-range-re "\\)?"))
2588(defconst verilog-macroexp-re "`\\sw+") 2639(defconst verilog-macroexp-re "`\\sw+")
2589 2640
2590(defconst verilog-delay-re "#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)") 2641(defconst verilog-delay-re "#\\s-*\\(\\([0-9_]+\\('s?[hdxbo][0-9a-fA-F_xz]+\\)?\\)\\|\\(([^()]*)\\)\\|\\(\\sw+\\)\\)")
@@ -2799,17 +2850,23 @@ find the errors."
2799 ;; from http://www.emacswiki.org/emacs/MultilineRegexp 2850 ;; from http://www.emacswiki.org/emacs/MultilineRegexp
2800 (concat "\\<\\(`define\\|`if\\)\\>" ;; directive 2851 (concat "\\<\\(`define\\|`if\\)\\>" ;; directive
2801 "\\s-+" ;; separator 2852 "\\s-+" ;; separator
2802 "\\(.*\\(?:\n.*\\)*?\\)" ;; definition: to tend of line, the maybe more lines (excludes any trailing \n) 2853 "\\(?:.*?\\(?:\n.*\\)*?\\)" ;; definition: to end of line, then maybe more lines (excludes any trailing \n)
2854 "\\(?:\n\\s-*\n\\|\\'\\)") ;; blank line or EOF
2855 "\\)\\|\\(?:"
2856 ;; `<macro>() : i.e. `uvm_info(a,b,c) or any other pre-defined macro
2857 ;; Since parameters inside the macro can have parentheses, and
2858 ;; the macro can span multiple lines, just look for the opening
2859 ;; parentheses and then continue to the end of the first
2860 ;; non-escaped EOL
2861 (concat "\\<`\\w+\\>\\s-*("
2862 "\\(?:.*?\\(?:\n.*\\)*?\\)" ;; definition: to end of line, then maybe more lines (excludes any trailing \n)
2803 "\\(?:\n\\s-*\n\\|\\'\\)") ;; blank line or EOF 2863 "\\(?:\n\\s-*\n\\|\\'\\)") ;; blank line or EOF
2804 "\\)" 2864 "\\)"
2805 ))) 2865 )))
2806 2866
2807(defconst verilog-keywords 2867(defconst verilog-keywords
2808 '( "`case" "`default" "`define" "`else" "`endfor" "`endif" 2868 (append verilog-compiler-directives
2809 "`endprotect" "`endswitch" "`endwhile" "`for" "`format" "`if" "`ifdef" 2869 '(
2810 "`ifndef" "`include" "`let" "`protect" "`switch" "`timescale"
2811 "`time_scale" "`undef" "`while"
2812
2813 "after" "alias" "always" "always_comb" "always_ff" "always_latch" "and" 2870 "after" "alias" "always" "always_comb" "always_ff" "always_latch" "and"
2814 "assert" "assign" "assume" "automatic" "before" "begin" "bind" 2871 "assert" "assign" "assume" "automatic" "before" "begin" "bind"
2815 "bins" "binsof" "bit" "break" "buf" "bufif0" "bufif1" "byte" 2872 "bins" "binsof" "bit" "break" "buf" "bufif0" "bufif1" "byte"
@@ -2851,7 +2908,7 @@ find the errors."
2851 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" 2908 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
2852 ;; 1800-2012 2909 ;; 1800-2012
2853 "implements" "interconnect" "nettype" "soft" 2910 "implements" "interconnect" "nettype" "soft"
2854 ) 2911 ))
2855 "List of Verilog keywords.") 2912 "List of Verilog keywords.")
2856 2913
2857(defconst verilog-comment-start-regexp "//\\|/\\*" 2914(defconst verilog-comment-start-regexp "//\\|/\\*"
@@ -2955,10 +3012,10 @@ See also `verilog-font-lock-extra-types'.")
2955(defface verilog-font-lock-grouping-keywords-face 3012(defface verilog-font-lock-grouping-keywords-face
2956 '((((class color) 3013 '((((class color)
2957 (background light)) 3014 (background light))
2958 (:foreground "red4" :bold t )) 3015 (:foreground "Purple" :bold t ))
2959 (((class color) 3016 (((class color)
2960 (background dark)) 3017 (background dark))
2961 (:foreground "red4" :bold t )) 3018 (:foreground "orange1" :bold t ))
2962 (t (:italic t))) 3019 (t (:italic t)))
2963 "Font lock mode face used to highlight verilog grouping keywords." 3020 "Font lock mode face used to highlight verilog grouping keywords."
2964 :group 'font-lock-highlighting-faces) 3021 :group 'font-lock-highlighting-faces)
@@ -3068,7 +3125,7 @@ See also `verilog-font-lock-extra-types'.")
3068 ;; Fontify all types 3125 ;; Fontify all types
3069 (if verilog-highlight-grouping-keywords 3126 (if verilog-highlight-grouping-keywords
3070 (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>") 3127 (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
3071 'verilog-font-lock-ams-face) 3128 'verilog-font-lock-grouping-keywords-face)
3072 (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>") 3129 (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
3073 'font-lock-type-face)) 3130 'font-lock-type-face))
3074 (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>") 3131 (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>")
@@ -4200,6 +4257,8 @@ Uses `verilog-scan' cache."
4200 (not (or 4257 (not (or
4201 ;; stop if beginning of buffer 4258 ;; stop if beginning of buffer
4202 (bobp) 4259 (bobp)
4260 ;; stop if looking at a pre-processor directive
4261 (looking-at "`\\w+")
4203 ;; stop if we find a ; 4262 ;; stop if we find a ;
4204 (= (preceding-char) ?\;) 4263 (= (preceding-char) ?\;)
4205 ;; stop if we see a named coverpoint 4264 ;; stop if we see a named coverpoint
@@ -4208,12 +4267,13 @@ Uses `verilog-scan' cache."
4208 (not (or (looking-at "\\<") (forward-word -1))) 4267 (not (or (looking-at "\\<") (forward-word -1)))
4209 ;; stop if we see an assertion (perhaps labeled) 4268 ;; stop if we see an assertion (perhaps labeled)
4210 (and 4269 (and
4211 (looking-at "\\(\\<\\(assert\\|assume\\|cover\\)\\>\\s-+\\<property\\>\\)\\|\\(\\<assert\\>\\)") 4270 (looking-at "\\(\\w+\\W*:\\W*\\)?\\(\\<\\(assert\\|assume\\|cover\\)\\>\\s-+\\<property\\>\\)\\|\\(\\<assert\\>\\)")
4212 (progn 4271 (progn
4213 (setq h (point)) 4272 (setq h (point))
4214 (save-excursion 4273 (save-excursion
4215 (verilog-backward-token) 4274 (verilog-backward-token)
4216 (if (looking-at verilog-label-re) 4275 (if (and (looking-at verilog-label-re)
4276 (not (looking-at verilog-end-block-re)))
4217 (setq h (point)))) 4277 (setq h (point))))
4218 (goto-char h))) 4278 (goto-char h)))
4219 ;; stop if we see an extended complete reg, perhaps a complete one 4279 ;; stop if we see an extended complete reg, perhaps a complete one
@@ -4715,8 +4775,8 @@ primitive or interface named NAME."
4715 (setq str (concat " // else: !assert " str )) 4775 (setq str (concat " // else: !assert " str ))
4716 (throw 'skip 1))))))))) 4776 (throw 'skip 1)))))))))
4717 4777
4718 (; always_comb, always_ff, always_latch 4778 (; always, always_comb, always_latch w/o @...
4719 (or (match-end 4) (match-end 5) (match-end 6)) 4779 (match-end 5)
4720 (goto-char (match-end 0)) 4780 (goto-char (match-end 0))
4721 (setq there (point)) 4781 (setq there (point))
4722 (setq err nil) 4782 (setq err nil)
@@ -4800,6 +4860,9 @@ primitive or interface named NAME."
4800 (throw 'skip 1)))) 4860 (throw 'skip 1))))
4801 )))) 4861 ))))
4802 (end-of-line) 4862 (end-of-line)
4863 (if kill-existing-comment
4864 (verilog-kill-existing-comment))
4865 (delete-horizontal-space)
4803 (insert (concat " // " string )))) 4866 (insert (concat " // " string ))))
4804 4867
4805 (;- this is end{function,generate,task,module,primitive,table,generate} 4868 (;- this is end{function,generate,task,module,primitive,table,generate}
@@ -5161,7 +5224,8 @@ FILENAME to find directory to run in, or defaults to `buffer-file-name`."
5161 ;; We should use font-lock-ensure in preference to 5224 ;; We should use font-lock-ensure in preference to
5162 ;; font-lock-fontify-buffer, but IIUC the problem this is supposed to 5225 ;; font-lock-fontify-buffer, but IIUC the problem this is supposed to
5163 ;; solve only appears in Emacsen older than font-lock-ensure anyway. 5226 ;; solve only appears in Emacsen older than font-lock-ensure anyway.
5164 (when fontlocked (font-lock-fontify-buffer))))))) 5227 ;; So avoid bytecomp's interactive-only by going through intern.
5228 (when fontlocked (funcall (intern "font-lock-fontify-buffer"))))))))
5165 5229
5166 5230
5167;; 5231;;
@@ -5530,8 +5594,12 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5530 ((equal (char-after) ?\{) 5594 ((equal (char-after) ?\{)
5531 ;; block type returned based on outer constraint { or inner 5595 ;; block type returned based on outer constraint { or inner
5532 (if (verilog-at-constraint-p) 5596 (if (verilog-at-constraint-p)
5533 (cond (inconstraint (throw 'nesting 'constraint)) 5597 (cond (inconstraint
5534 (t (throw 'nesting 'statement))))) 5598 (beginning-of-line nil)
5599 (skip-chars-forward " \t")
5600 (throw 'nesting 'constraint))
5601 (t
5602 (throw 'nesting 'statement)))))
5535 ((equal (char-after) ?\}) 5603 ((equal (char-after) ?\})
5536 (let (par-pos 5604 (let (par-pos
5537 (there (verilog-at-close-constraint-p))) 5605 (there (verilog-at-close-constraint-p)))
@@ -6044,7 +6112,16 @@ Optional BOUND limits search."
6044 (save-match-data 6112 (save-match-data
6045 (save-excursion 6113 (save-excursion
6046 (verilog-re-search-backward "\\((\\*\\)\\|\\(\\*)\\)" nil 'move) 6114 (verilog-re-search-backward "\\((\\*\\)\\|\\(\\*)\\)" nil 'move)
6047 (numberp (match-beginning 1))))) 6115 (cond
6116 ((match-end 1)
6117 (progn (goto-char (match-end 1))
6118 (not (looking-at "\\s-*)")))
6119 nil)
6120 ((match-end 2)
6121 (progn (goto-char (match-beginning 2))
6122 (not (looking-at "(\\s-*")))
6123 nil)
6124 (t nil)))))
6048 6125
6049(defun verilog-in-parameter-p () 6126(defun verilog-in-parameter-p ()
6050 "Return true if point is in a parameter assignment #( p1=1, p2=5)." 6127 "Return true if point is in a parameter assignment #( p1=1, p2=5)."
@@ -6176,7 +6253,7 @@ Return >0 for nested struct."
6176 )) 6253 ))
6177 ;; if first word token not keyword, it maybe the instance name 6254 ;; if first word token not keyword, it maybe the instance name
6178 ;; check next word token 6255 ;; check next word token
6179 (if (looking-at "\\<\\w+\\>\\|\\s-*(\\s-*\\w+") 6256 (if (looking-at "\\<\\w+\\>\\|\\s-*(\\s-*\\S-+")
6180 (progn (verilog-beg-of-statement) 6257 (progn (verilog-beg-of-statement)
6181 (if (looking-at (concat "\\<\\(constraint\\|" 6258 (if (looking-at (concat "\\<\\(constraint\\|"
6182 "\\(?:\\w+\\s-*:\\s-*\\)?\\(coverpoint\\|cross\\)" 6259 "\\(?:\\w+\\s-*:\\s-*\\)?\\(coverpoint\\|cross\\)"
@@ -6275,8 +6352,8 @@ Return >0 for nested struct."
6275 (goto-char (- (point) 2)) 6352 (goto-char (- (point) 2))
6276 t) ;; Let nth 4 state handle the rest 6353 t) ;; Let nth 4 state handle the rest
6277 ((and (not (bobp)) 6354 ((and (not (bobp))
6278 (= (char-before) ?\)) 6355 (verilog-looking-back "\\*)" nil)
6279 (= (char-before (1- (point))) ?\*)) 6356 (not (verilog-looking-back "(\\s-*\\*)" nil)))
6280 (goto-char (- (point) 2)) 6357 (goto-char (- (point) 2))
6281 (if (search-backward "(*" nil t) 6358 (if (search-backward "(*" nil t)
6282 (progn 6359 (progn
@@ -6320,7 +6397,8 @@ Return >0 for nested struct."
6320 (progn 6397 (progn
6321 (goto-char h) 6398 (goto-char h)
6322 nil)))) 6399 nil))))
6323 ((looking-at "(\\*") 6400 ((and (looking-at "(\\*") ;; attribute start, but not an event (*) or (* )
6401 (not (looking-at "(\\*\\s-*)")))
6324 (progn 6402 (progn
6325 (setq h (point)) 6403 (setq h (point))
6326 (goto-char (match-end 0)) 6404 (goto-char (match-end 0))
@@ -6375,7 +6453,6 @@ Only look at a few lines to determine indent level."
6375 (cond 6453 (cond
6376 ((or 6454 ((or
6377 (= (preceding-char) ?\,) 6455 (= (preceding-char) ?\,)
6378 (= (preceding-char) ?\])
6379 (save-excursion 6456 (save-excursion
6380 (verilog-beg-of-statement-1) 6457 (verilog-beg-of-statement-1)
6381 (looking-at verilog-declaration-re))) 6458 (looking-at verilog-declaration-re)))
@@ -7830,6 +7907,48 @@ Signals must be in standard (base vector) form."
7830 (nreverse out-list))))) 7907 (nreverse out-list)))))
7831;;(verilog-signals-not-in '(("A" "") ("B" "") ("DEL" "[2:3]")) '(("DEL" "") ("EXT" ""))) 7908;;(verilog-signals-not-in '(("A" "") ("B" "") ("DEL" "[2:3]")) '(("DEL" "") ("EXT" "")))
7832 7909
7910(defun verilog-signals-not-in-struct (in-list not-list)
7911 "Return list of signals in IN-LIST that aren't also in NOT-LIST.
7912Also remove any duplicates in IN-LIST.
7913Any structure in not-list will remove all members in in-list.
7914Signals must be in standard (base vector) form."
7915 (cond ((eval-when-compile (fboundp 'make-hash-table))
7916 (let ((ht (make-hash-table :test 'equal :rehash-size 4.0))
7917 out-list addit nm)
7918 (while not-list
7919 (puthash (car (car not-list)) t ht)
7920 (setq not-list (cdr not-list)))
7921 (while in-list
7922 (setq nm (verilog-sig-name (car in-list)))
7923 (when (not (gethash nm ht))
7924 (setq addit t)
7925 (while (string-match "^\\([^\\].*\\)\\.[^.]+$" nm)
7926 (setq nm (match-string 1 nm))
7927 (setq addit (and addit
7928 (not (gethash nm ht)))))
7929 (when addit
7930 (setq out-list (cons (car in-list) out-list))
7931 (puthash (verilog-sig-name (car in-list)) t ht)))
7932 (setq in-list (cdr in-list)))
7933 (nreverse out-list)))
7934 ;; Slower Fallback if no hash tables (pre Emacs 21.1/XEmacs 21.4)
7935 (t
7936 (let (out-list addit nm)
7937 (while in-list
7938 (setq nm (verilog-sig-name (car in-list)))
7939 (when (and (not (assoc nm not-list))
7940 (not (assoc nm out-list)))
7941 (setq addit t)
7942 (while (string-match "^\\([^\\].*\\)\\.[^.]+$" nm)
7943 (setq nm (match-string 1 nm))
7944 (setq addit (and addit
7945 (not (assoc nm not-list)))))
7946 (when addit
7947 (setq out-list (cons (car in-list) out-list))))
7948 (setq in-list (cdr in-list)))
7949 (nreverse out-list)))))
7950;;(verilog-signals-not-in-struct '(("A" "") ("B" "") ("DEL.SUB.A" "[2:3]")) '(("DEL.SUB" "") ("EXT" "")))
7951
7833(defun verilog-signals-memory (in-list) 7952(defun verilog-signals-memory (in-list)
7834 "Return list of signals in IN-LIST that are memorized (multidimensional)." 7953 "Return list of signals in IN-LIST that are memorized (multidimensional)."
7835 (let (out-list) 7954 (let (out-list)
@@ -8281,10 +8400,9 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8281 typedefed nil multidim nil ptype nil modport nil 8400 typedefed nil multidim nil ptype nil modport nil
8282 expect-signal 'sigs-assign sig-paren paren)) 8401 expect-signal 'sigs-assign sig-paren paren))
8283 ((member keywd '("localparam" "genvar")) 8402 ((member keywd '("localparam" "genvar"))
8284 (unless io 8403 (setq vec nil enum nil rvalue nil signed nil
8285 (setq vec nil enum nil rvalue nil signed nil 8404 typedefed nil multidim nil ptype nil modport nil
8286 typedefed nil multidim nil ptype nil modport nil 8405 expect-signal 'sigs-const sig-paren paren))
8287 expect-signal 'sigs-const sig-paren paren)))
8288 ((member keywd '("signed" "unsigned")) 8406 ((member keywd '("signed" "unsigned"))
8289 (setq signed keywd)) 8407 (setq signed keywd))
8290 ((member keywd '("assert" "assume" "cover" "expect" "restrict")) 8408 ((member keywd '("assert" "assume" "cover" "expect" "restrict"))
@@ -12134,20 +12252,26 @@ You may also provide an optional third argument regular
12134expression, in which case only signals which have that pin 12252expression, in which case only signals which have that pin
12135direction and data type matching that regular expression will be 12253direction and data type matching that regular expression will be
12136included. This matches against everything before the signal name 12254included. This matches against everything before the signal name
12137in the declaration, for example against \"input\" (single bit), 12255in the declaration, for example against \"input\" (single
12138\"output logic\" (direction and type) or \"output 12256bit), \"output logic\" (direction and type) or
12139[1:0]\" (direction and implicit type). You also probably want to 12257\"output [1:0]\" (direction and implicit type). You also
12140skip spaces in your regexp. 12258probably want to skip spaces in your regexp.
12141 12259
12142For example, the below will result in matching the output \"o\" 12260For example, the below will result in matching the output \"o\"
12143against the previous example's module: 12261against the previous example's module:
12144 12262
12145 /*AUTOINOUTMODULE(\"ExampMain\",\"\",\"^output.*\")*/" 12263 /*AUTOINOUTMODULE(\"ExampMain\",\"\",\"^output.*\")*/
12264
12265You may also provide an optional fourth argument regular
12266expression, which if not \"\" only signals which do NOT match
12267that expression are included."
12268 ;; Beware spacing of quotes in above as can mess up Emacs indenter
12146 (save-excursion 12269 (save-excursion
12147 (let* ((params (verilog-read-auto-params 1 3)) 12270 (let* ((params (verilog-read-auto-params 1 4))
12148 (submod (nth 0 params)) 12271 (submod (nth 0 params))
12149 (regexp (nth 1 params)) 12272 (regexp (nth 1 params))
12150 (direction-re (nth 2 params)) 12273 (direction-re (nth 2 params))
12274 (not-re (nth 3 params))
12151 submodi) 12275 submodi)
12152 ;; Lookup position, etc of co-module 12276 ;; Lookup position, etc of co-module
12153 ;; Note this may raise an error 12277 ;; Note this may raise an error
@@ -12182,20 +12306,24 @@ against the previous example's module:
12182 (append (verilog-decls-get-interfaces moddecls))))) 12306 (append (verilog-decls-get-interfaces moddecls)))))
12183 (forward-line 1) 12307 (forward-line 1)
12184 (setq sig-list-i (verilog-signals-edit-wire-reg 12308 (setq sig-list-i (verilog-signals-edit-wire-reg
12185 (verilog-signals-matching-dir-re 12309 (verilog-signals-not-matching-regexp
12186 (verilog-signals-matching-regexp sig-list-i regexp) 12310 (verilog-signals-matching-dir-re
12187 "input" direction-re)) 12311 (verilog-signals-matching-regexp sig-list-i regexp)
12312 "input" direction-re) not-re))
12188 sig-list-o (verilog-signals-edit-wire-reg 12313 sig-list-o (verilog-signals-edit-wire-reg
12189 (verilog-signals-matching-dir-re 12314 (verilog-signals-not-matching-regexp
12190 (verilog-signals-matching-regexp sig-list-o regexp) 12315 (verilog-signals-matching-dir-re
12191 "output" direction-re)) 12316 (verilog-signals-matching-regexp sig-list-o regexp)
12317 "output" direction-re) not-re))
12192 sig-list-io (verilog-signals-edit-wire-reg 12318 sig-list-io (verilog-signals-edit-wire-reg
12319 (verilog-signals-not-matching-regexp
12320 (verilog-signals-matching-dir-re
12321 (verilog-signals-matching-regexp sig-list-io regexp)
12322 "inout" direction-re) not-re))
12323 sig-list-if (verilog-signals-not-matching-regexp
12193 (verilog-signals-matching-dir-re 12324 (verilog-signals-matching-dir-re
12194 (verilog-signals-matching-regexp sig-list-io regexp) 12325 (verilog-signals-matching-regexp sig-list-if regexp)
12195 "inout" direction-re)) 12326 "interface" direction-re) not-re))
12196 sig-list-if (verilog-signals-matching-dir-re
12197 (verilog-signals-matching-regexp sig-list-if regexp)
12198 "interface" direction-re))
12199 (when v2k (verilog-repair-open-comma)) 12327 (when v2k (verilog-repair-open-comma))
12200 (when (or sig-list-i sig-list-o sig-list-io sig-list-if) 12328 (when (or sig-list-i sig-list-o sig-list-io sig-list-if)
12201 (verilog-insert-indent "// Beginning of automatic in/out/inouts (from specific module)\n") 12329 (verilog-insert-indent "// Beginning of automatic in/out/inouts (from specific module)\n")
@@ -12262,15 +12390,20 @@ You may also provide an optional third argument regular
12262expression, in which case only signals which have that pin 12390expression, in which case only signals which have that pin
12263direction and data type matching that regular expression will be 12391direction and data type matching that regular expression will be
12264included. This matches against everything before the signal name 12392included. This matches against everything before the signal name
12265in the declaration, for example against \"input\" (single bit), 12393in the declaration, for example against \"input\" (single
12266\"output logic\" (direction and type) or \"output 12394bit), \"output logic\" (direction and type)
12267[1:0]\" (direction and implicit type). You also probably want to 12395or \"output [1:0]\" (direction and implicit type). You also
12268skip spaces in your regexp. 12396probably want to skip spaces in your regexp.
12269 12397
12270For example, the below will result in matching the output \"o\" 12398For example, the below will result in matching the output \"o\"
12271against the previous example's module: 12399against the previous example's module:
12272 12400
12273 /*AUTOINOUTCOMP(\"ExampMain\",\"\",\"^output.*\")*/" 12401 /*AUTOINOUTCOMP(\"ExampMain\",\"\",\"^output.*\")*/
12402
12403You may also provide an optional fourth argument regular
12404expression, which if not \"\" only signals which do NOT match
12405that expression are included."
12406 ;; Beware spacing of quotes in above as can mess up Emacs indenter
12274 (verilog-auto-inout-module t nil)) 12407 (verilog-auto-inout-module t nil))
12275 12408
12276(defun verilog-auto-inout-in () 12409(defun verilog-auto-inout-in ()
@@ -12793,14 +12926,15 @@ Typing \\[verilog-auto] will make this into:
12793 (verilog-re-search-backward-quick "\\(@\\|\\<\\(always\\(_latch\\|_ff\\|_comb\\)?\\)\\>\\)" nil t) 12926 (verilog-re-search-backward-quick "\\(@\\|\\<\\(always\\(_latch\\|_ff\\|_comb\\)?\\)\\>\\)" nil t)
12794 (setq sigss (verilog-read-always-signals))) 12927 (setq sigss (verilog-read-always-signals)))
12795 (setq dly-list (verilog-alw-get-outputs-delayed sigss)) 12928 (setq dly-list (verilog-alw-get-outputs-delayed sigss))
12796 (setq sig-list (verilog-signals-not-in (append 12929 (setq sig-list (verilog-signals-not-in-struct
12797 (verilog-alw-get-outputs-delayed sigss) 12930 (append
12798 (when (or (not (verilog-alw-get-uses-delayed sigss)) 12931 (verilog-alw-get-outputs-delayed sigss)
12799 verilog-auto-reset-blocking-in-non) 12932 (when (or (not (verilog-alw-get-uses-delayed sigss))
12800 (verilog-alw-get-outputs-immediate sigss))) 12933 verilog-auto-reset-blocking-in-non)
12801 (append 12934 (verilog-alw-get-outputs-immediate sigss)))
12802 (verilog-alw-get-temps sigss) 12935 (append
12803 prereset-sigs))) 12936 (verilog-alw-get-temps sigss)
12937 prereset-sigs)))
12804 (setq sig-list (sort sig-list `verilog-signals-sort-compare)) 12938 (setq sig-list (sort sig-list `verilog-signals-sort-compare))
12805 (when sig-list 12939 (when sig-list
12806 (insert "\n"); 12940 (insert "\n");