aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilson Snyder2020-07-05 13:31:39 -0400
committerWilson Snyder2020-07-05 13:31:39 -0400
commite3ada2063aa286ea6898a60d95061a77fb752ca8 (patch)
tree812453cc1d81d1e35e161e143833e05f981d333f
parent58e27ebb9210cbbd0c3a10992627bc1e1de89f32 (diff)
downloademacs-e3ada2063aa286ea6898a60d95061a77fb752ca8.tar.gz
emacs-e3ada2063aa286ea6898a60d95061a77fb752ca8.zip
Verilog-Mode collected updates.
* lisp/progmodes/verilog-mode.el (verilog-auto-inst): Support regexp of what AUTOINST I/O to include, issue #1682. Reported by Mrainy. (verilog-font-lock-keywords-1): Fix highlighting module names with no following (, issue #1679. Reported by Vinam Arora. (verilog-font-lock-keywords) Adds syntax highlighting for identifiers in declaration statements, #1678. (verilog-calculate-indent, verilog-inject-arg) (verilog-keywords, verilog-showscopes): Support AMS connectmodule/endconnectmodule, #1665. Reported by Dan McMahill.
-rw-r--r--lisp/progmodes/verilog-mode.el112
1 files changed, 76 insertions, 36 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 6400e1e6cd9..5a469bb9677 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -9,7 +9,7 @@
9;; Keywords: languages 9;; Keywords: languages
10;; The "Version" is the date followed by the decimal rendition of the Git 10;; The "Version" is the date followed by the decimal rendition of the Git
11;; commit hex. 11;; commit hex.
12;; Version: 2020.02.23.232634261 12;; Version: 2020.06.27.014326051
13 13
14;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this 14;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this
15;; file on 19/3/2008, and the maintainer agreed that when a bug is 15;; file on 19/3/2008, and the maintainer agreed that when a bug is
@@ -124,7 +124,7 @@
124;; 124;;
125 125
126;; This variable will always hold the version number of the mode 126;; This variable will always hold the version number of the mode
127(defconst verilog-mode-version "2020-02-23-dddb795-vpo-GNU" 127(defconst verilog-mode-version "2020-06-27-0da9923-vpo-GNU"
128 "Version of this Verilog mode.") 128 "Version of this Verilog mode.")
129(defconst verilog-mode-release-emacs t 129(defconst verilog-mode-release-emacs t
130 "If non-nil, this version of Verilog mode was released with Emacs itself.") 130 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -1430,7 +1430,7 @@ See also `verilog-case-fold'."
1430 :type 'hook) 1430 :type 'hook)
1431 1431
1432(defvar verilog-imenu-generic-expression 1432(defvar verilog-imenu-generic-expression
1433 '((nil "^\\s-*\\(?:m\\(?:odule\\|acromodule\\)\\|p\\(?:rimitive\\|rogram\\|ackage\\)\\)\\s-+\\([a-zA-Z0-9_.:]+\\)" 1) 1433 '((nil "^\\s-*\\(?:connectmodule\\|m\\(?:odule\\|acromodule\\)\\|p\\(?:rimitive\\|rogram\\|ackage\\)\\)\\s-+\\([a-zA-Z0-9_.:]+\\)" 1)
1434 ("*Variables*" "^\\s-*\\(reg\\|wire\\|logic\\)\\s-+\\(\\|\\[[^]]+\\]\\s-+\\)\\([A-Za-z0-9_]+\\)" 3) 1434 ("*Variables*" "^\\s-*\\(reg\\|wire\\|logic\\)\\s-+\\(\\|\\[[^]]+\\]\\s-+\\)\\([A-Za-z0-9_]+\\)" 3)
1435 ("*Classes*" "^\\s-*\\(?:\\(?:virtual\\|interface\\)\\s-+\\)?class\\s-+\\([A-Za-z_][A-Za-z0-9_]+\\)" 1) 1435 ("*Classes*" "^\\s-*\\(?:\\(?:virtual\\|interface\\)\\s-+\\)?class\\s-+\\([A-Za-z_][A-Za-z0-9_]+\\)" 1)
1436 ("*Tasks*" "^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*task\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)" 1) 1436 ("*Tasks*" "^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*task\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)" 1)
@@ -2515,11 +2515,13 @@ find the errors."
2515 (eval-when-compile 2515 (eval-when-compile
2516 (verilog-regexp-words 2516 (verilog-regexp-words
2517 '( "begin" 2517 '( "begin"
2518 "connectmodule"
2518 "else" 2519 "else"
2519 "end" 2520 "end"
2520 "endcase" 2521 "endcase"
2521 "endclass" 2522 "endclass"
2522 "endclocking" 2523 "endclocking"
2524 "endconnectmodule"
2523 "endgroup" 2525 "endgroup"
2524 "endfunction" 2526 "endfunction"
2525 "endmodule" 2527 "endmodule"
@@ -2562,6 +2564,7 @@ find the errors."
2562 "\\(sequence\\)\\|" ; 14 2564 "\\(sequence\\)\\|" ; 14
2563 "\\(clocking\\)\\|" ; 15 2565 "\\(clocking\\)\\|" ; 15
2564 "\\(property\\)\\|" ; 16 2566 "\\(property\\)\\|" ; 16
2567 "\\(connectmodule\\)\\|" ; 17
2565 "\\)\\>\\)")) 2568 "\\)\\>\\)"))
2566(defconst verilog-end-block-re 2569(defconst verilog-end-block-re
2567 (eval-when-compile 2570 (eval-when-compile
@@ -2722,6 +2725,7 @@ find the errors."
2722 "endclass" 2725 "endclass"
2723 "endclocking" 2726 "endclocking"
2724 "endconfig" 2727 "endconfig"
2728 "endconnectmodule"
2725 "endfunction" 2729 "endfunction"
2726 "endgenerate" 2730 "endgenerate"
2727 "endgroup" 2731 "endgroup"
@@ -2740,7 +2744,7 @@ find the errors."
2740(defconst verilog-declaration-opener 2744(defconst verilog-declaration-opener
2741 (eval-when-compile 2745 (eval-when-compile
2742 (verilog-regexp-words 2746 (verilog-regexp-words
2743 '("module" "begin" "task" "function")))) 2747 '("connectmodule" "module" "begin" "task" "function"))))
2744 2748
2745(defconst verilog-declaration-prefix-re 2749(defconst verilog-declaration-prefix-re
2746 (eval-when-compile 2750 (eval-when-compile
@@ -2802,9 +2806,9 @@ find the errors."
2802(defconst verilog-declaration-re-1-no-macro (concat "^" verilog-declaration-re-2-no-macro)) 2806(defconst verilog-declaration-re-1-no-macro (concat "^" verilog-declaration-re-2-no-macro))
2803 2807
2804(defconst verilog-defun-re 2808(defconst verilog-defun-re
2805 (eval-when-compile (verilog-regexp-words '("macromodule" "module" "class" "program" "interface" "package" "primitive" "config")))) 2809 (eval-when-compile (verilog-regexp-words '("macromodule" "connectmodule" "module" "class" "program" "interface" "package" "primitive" "config"))))
2806(defconst verilog-end-defun-re 2810(defconst verilog-end-defun-re
2807 (eval-when-compile (verilog-regexp-words '("endmodule" "endclass" "endprogram" "endinterface" "endpackage" "endprimitive" "endconfig")))) 2811 (eval-when-compile (verilog-regexp-words '("endconnectmodule" "endmodule" "endclass" "endprogram" "endinterface" "endpackage" "endprimitive" "endconfig"))))
2808(defconst verilog-zero-indent-re 2812(defconst verilog-zero-indent-re
2809 (concat verilog-defun-re "\\|" verilog-end-defun-re)) 2813 (concat verilog-defun-re "\\|" verilog-end-defun-re))
2810(defconst verilog-inst-comment-re 2814(defconst verilog-inst-comment-re
@@ -2836,7 +2840,7 @@ find the errors."
2836 "generate" "endgenerate" 2840 "generate" "endgenerate"
2837 "initial" 2841 "initial"
2838 "interface" "endinterface" 2842 "interface" "endinterface"
2839 "module" "macromodule" "endmodule" 2843 "connectmodule" "module" "macromodule" "endconnectmodule" "endmodule"
2840 "package" "endpackage" 2844 "package" "endpackage"
2841 "primitive" "endprimitive" 2845 "primitive" "endprimitive"
2842 "program" "endprogram" 2846 "program" "endprogram"
@@ -2904,14 +2908,14 @@ find the errors."
2904(defconst verilog-defun-level-not-generate-re 2908(defconst verilog-defun-level-not-generate-re
2905 (eval-when-compile 2909 (eval-when-compile
2906 (verilog-regexp-words 2910 (verilog-regexp-words
2907 '( "module" "macromodule" "primitive" "class" "program" 2911 '( "connectmodule" "module" "macromodule" "primitive" "class" "program"
2908 "interface" "package" "config")))) 2912 "interface" "package" "config"))))
2909 2913
2910(defconst verilog-defun-level-re 2914(defconst verilog-defun-level-re
2911 (eval-when-compile 2915 (eval-when-compile
2912 (verilog-regexp-words 2916 (verilog-regexp-words
2913 (append 2917 (append
2914 '( "module" "macromodule" "primitive" "class" "program" 2918 '( "connectmodule" "module" "macromodule" "primitive" "class" "program"
2915 "interface" "package" "config") 2919 "interface" "package" "config")
2916 '( "initial" "final" "always" "always_comb" "always_ff" 2920 '( "initial" "final" "always" "always_comb" "always_ff"
2917 "always_latch" "endtask" "endfunction" ))))) 2921 "always_latch" "endtask" "endfunction" )))))
@@ -2926,7 +2930,7 @@ find the errors."
2926 (eval-when-compile 2930 (eval-when-compile
2927 (verilog-regexp-words 2931 (verilog-regexp-words
2928 '( 2932 '(
2929 "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass" 2933 "endconnectmodule" "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" "endclass"
2930 )))) 2934 ))))
2931 2935
2932(defconst verilog-dpi-import-export-re 2936(defconst verilog-dpi-import-export-re
@@ -2947,7 +2951,7 @@ find the errors."
2947 (eval-when-compile 2951 (eval-when-compile
2948 (verilog-regexp-words 2952 (verilog-regexp-words
2949 '( 2953 '(
2950 "always" "assign" "always_latch" "always_ff" "always_comb" "constraint" 2954 "always" "assign" "always_latch" "always_ff" "always_comb" "connectmodule" "constraint"
2951 "import" "initial" "final" "module" "macromodule" "repeat" "randcase" "while" 2955 "import" "initial" "final" "module" "macromodule" "repeat" "randcase" "while"
2952 "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" "assert" 2956 "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" "assert"
2953 )))) 2957 ))))
@@ -3065,6 +3069,8 @@ find the errors."
3065 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" 3069 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
3066 ;; 1800-2012 3070 ;; 1800-2012
3067 "implements" "interconnect" "nettype" "soft" 3071 "implements" "interconnect" "nettype" "soft"
3072 ;; AMS
3073 "connectmodule" "endconnectmodule"
3068 )) 3074 ))
3069 "List of Verilog keywords.") 3075 "List of Verilog keywords.")
3070 3076
@@ -3211,7 +3217,7 @@ See also `verilog-font-lock-extra-types'.")
3211 "atan2" "atanh" "branch" "ceil" "connect" "connectmodule" 3217 "atan2" "atanh" "branch" "ceil" "connect" "connectmodule"
3212 "connectrules" "continuous" "cos" "cosh" "ddt" "ddt_nature" 3218 "connectrules" "continuous" "cos" "cosh" "ddt" "ddt_nature"
3213 "ddx" "discipline" "discrete" "domain" "driver_update" 3219 "ddx" "discipline" "discrete" "domain" "driver_update"
3214 "endconnectrules" "enddiscipline" "endnature" "endparamset" 3220 "endconnectmodule" "endconnectrules" "enddiscipline" "endnature" "endparamset"
3215 "exclude" "exp" "final_step" "flicker_noise" "floor" "flow" 3221 "exclude" "exp" "final_step" "flicker_noise" "floor" "flow"
3216 "from" "ground" "hypot" "idt" "idt_nature" "idtmod" "inf" 3222 "from" "ground" "hypot" "idt" "idt_nature" "idtmod" "inf"
3217 "initial_step" "laplace_nd" "laplace_np" "laplace_zd" 3223 "initial_step" "laplace_nd" "laplace_np" "laplace_zd"
@@ -3290,9 +3296,9 @@ See also `verilog-font-lock-extra-types'.")
3290 (list 3296 (list
3291 ;; Fontify module definitions 3297 ;; Fontify module definitions
3292 (list 3298 (list
3293 "\\<\\(\\(macro\\)?module\\|primitive\\|class\\|program\\|interface\\|package\\|task\\)\\>\\s-*\\(\\sw+\\)" 3299 "\\<\\(\\(macro\\|connect\\)?module\\|primitive\\|class\\|program\\|interface\\|package\\|task\\)\\>\\s-*\\(\\sw+\\)"
3294 '(1 font-lock-keyword-face) 3300 '(1 font-lock-keyword-face)
3295 '(3 font-lock-function-name-face 'prepend)) 3301 '(3 font-lock-function-name-face prepend))
3296 ;; Fontify function definitions 3302 ;; Fontify function definitions
3297 (list 3303 (list
3298 (concat "\\<function\\>\\s-+\\(integer\\|real\\(time\\)?\\|time\\)\\s-+\\(\\sw+\\)" ) 3304 (concat "\\<function\\>\\s-+\\(integer\\|real\\(time\\)?\\|time\\)\\s-+\\(\\sw+\\)" )
@@ -3302,7 +3308,16 @@ See also `verilog-font-lock-extra-types'.")
3302 (1 font-lock-keyword-face) 3308 (1 font-lock-keyword-face)
3303 (2 font-lock-constant-face append)) 3309 (2 font-lock-constant-face append))
3304 '("\\<function\\>\\s-+\\(\\sw+\\)" 3310 '("\\<function\\>\\s-+\\(\\sw+\\)"
3305 1 'font-lock-constant-face append)))) 3311 1 'font-lock-constant-face append)
3312 ;; Fontify variable names in declarations
3313 (list ;; Implemented as an anchored-matcher
3314 (concat verilog-declaration-re
3315 " *\\(" verilog-range-re "\\)?")
3316 (list ;; anchored-highlighter
3317 (concat "\\_<\\(" verilog-symbol-re "\\)"
3318 " *\\(" verilog-range-re "\\)?*")
3319 nil nil '(1 font-lock-variable-name-face))))))
3320
3306 3321
3307 (setq verilog-font-lock-keywords-2 3322 (setq verilog-font-lock-keywords-2
3308 (append verilog-font-lock-keywords-1 3323 (append verilog-font-lock-keywords-1
@@ -3608,7 +3623,7 @@ Use filename, if current buffer being edited shorten to just buffer name."
3608 (setq found 't)))))) 3623 (setq found 't))))))
3609 ((looking-at verilog-end-block-re) 3624 ((looking-at verilog-end-block-re)
3610 (verilog-leap-to-head)) 3625 (verilog-leap-to-head))
3611 ((looking-at "\\(endmodule\\>\\)\\|\\(\\<endprimitive\\>\\)\\|\\(\\<endclass\\>\\)\\|\\(\\<endprogram\\>\\)\\|\\(\\<endinterface\\>\\)\\|\\(\\<endpackage\\>\\)") 3626 ((looking-at "\\(endmodule\\>\\)\\|\\(\\<endprimitive\\>\\)\\|\\(\\<endclass\\>\\)\\|\\(\\<endprogram\\>\\)\\|\\(\\<endinterface\\>\\)\\|\\(\\<endpackage\\>\\)\\|\\(\\<endconnectmodule\\>\\)")
3612 (cond 3627 (cond
3613 ((match-end 1) 3628 ((match-end 1)
3614 (verilog-re-search-backward "\\<\\(macro\\)?module\\>" nil 'move)) 3629 (verilog-re-search-backward "\\<\\(macro\\)?module\\>" nil 'move))
@@ -3622,6 +3637,8 @@ Use filename, if current buffer being edited shorten to just buffer name."
3622 (verilog-re-search-backward "\\<interface\\>" nil 'move)) 3637 (verilog-re-search-backward "\\<interface\\>" nil 'move))
3623 ((match-end 6) 3638 ((match-end 6)
3624 (verilog-re-search-backward "\\<package\\>" nil 'move)) 3639 (verilog-re-search-backward "\\<package\\>" nil 'move))
3640 ((match-end 7)
3641 (verilog-re-search-backward "\\<connectmodule\\>" nil 'move))
3625 (t 3642 (t
3626 (goto-char st) 3643 (goto-char st)
3627 (backward-sexp 1)))) 3644 (backward-sexp 1))))
@@ -3747,7 +3764,8 @@ Use filename, if current buffer being edited shorten to just buffer name."
3747 "\\(\\<class\\>\\)\\|" 3764 "\\(\\<class\\>\\)\\|"
3748 "\\(\\<program\\>\\)\\|" 3765 "\\(\\<program\\>\\)\\|"
3749 "\\(\\<interface\\>\\)\\|" 3766 "\\(\\<interface\\>\\)\\|"
3750 "\\(\\<package\\>\\)")) 3767 "\\(\\<package\\>\\)\\|"
3768 "\\(\\<connectmodule\\>\\)"))
3751 (cond 3769 (cond
3752 ((match-end 1) 3770 ((match-end 1)
3753 (verilog-re-search-forward "\\<endmodule\\>" nil 'move)) 3771 (verilog-re-search-forward "\\<endmodule\\>" nil 'move))
@@ -3761,6 +3779,8 @@ Use filename, if current buffer being edited shorten to just buffer name."
3761 (verilog-re-search-forward "\\<endinterface\\>" nil 'move)) 3779 (verilog-re-search-forward "\\<endinterface\\>" nil 'move))
3762 ((match-end 6) 3780 ((match-end 6)
3763 (verilog-re-search-forward "\\<endpackage\\>" nil 'move)) 3781 (verilog-re-search-forward "\\<endpackage\\>" nil 'move))
3782 ((match-end 7)
3783 (verilog-re-search-forward "\\<endconnectmodule\\>" nil 'move))
3764 (t 3784 (t
3765 (goto-char st) 3785 (goto-char st)
3766 (if (= (following-char) ?\) ) 3786 (if (= (following-char) ?\) )
@@ -4568,13 +4588,13 @@ More specifically, point @ in the line foo : @ begin"
4568 (let ((nest 1)) 4588 (let ((nest 1))
4569 (while t 4589 (while t
4570 (verilog-re-search-backward 4590 (verilog-re-search-backward
4571 (concat "\\(\\<module\\>\\)\\|\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|" 4591 (concat "\\(\\<module\\>\\)\\|\\(\\<connectmodule\\>\\)\\|\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|"
4572 "\\(\\<endcase\\>\\)\\>") 4592 "\\(\\<endcase\\>\\)\\>")
4573 nil 'move) 4593 nil 'move)
4574 (cond 4594 (cond
4575 ((match-end 3) 4595 ((match-end 4)
4576 (setq nest (1+ nest))) 4596 (setq nest (1+ nest)))
4577 ((match-end 2) 4597 ((match-end 3)
4578 (if (= nest 1) 4598 (if (= nest 1)
4579 (throw 'found 1)) 4599 (throw 'found 1))
4580 (setq nest (1- nest))) 4600 (setq nest (1- nest)))
@@ -4609,13 +4629,15 @@ More specifically, after a generate and before an endgenerate."
4609 (while (and 4629 (while (and
4610 (/= nest 0) 4630 (/= nest 0)
4611 (verilog-re-search-backward 4631 (verilog-re-search-backward
4612 "\\<\\(module\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\>" nil 'move) 4632 "\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\>" nil 'move)
4613 (cond 4633 (cond
4614 ((match-end 1) ; module - we have crawled out 4634 ((match-end 1) ; module - we have crawled out
4615 (throw 'done 1)) 4635 (throw 'done 1))
4616 ((match-end 2) ; generate 4636 ((match-end 2) ; connectmodule - we have crawled out
4637 (throw 'done 1))
4638 ((match-end 3) ; generate
4617 (setq nest (1- nest))) 4639 (setq nest (1- nest)))
4618 ((match-end 3) ; endgenerate 4640 ((match-end 4) ; endgenerate
4619 (setq nest (1+ nest)))))))) 4641 (setq nest (1+ nest))))))))
4620 (= nest 0) )) ; return nest 4642 (= nest 0) )) ; return nest
4621 4643
@@ -5078,6 +5100,8 @@ primitive or interface named NAME."
5078 (setq reg "\\(\\<clocking\\>\\)\\|\\<endclocking\\>")) 5100 (setq reg "\\(\\<clocking\\>\\)\\|\\<endclocking\\>"))
5079 ((match-end 16) ; of verilog-end-block-ordered-re 5101 ((match-end 16) ; of verilog-end-block-ordered-re
5080 (setq reg "\\(\\<property\\>\\)\\|\\<endproperty\\>")) 5102 (setq reg "\\(\\<property\\>\\)\\|\\<endproperty\\>"))
5103 ((match-end 17) ; of verilog-end-block-ordered-re
5104 (setq reg "\\(\\<connectmodule\\>\\)\\|\\<endconnectmodule\\>"))
5081 5105
5082 (t (error "Problem in verilog-set-auto-endcomments"))) 5106 (t (error "Problem in verilog-set-auto-endcomments")))
5083 (let (b e) 5107 (let (b e)
@@ -5103,7 +5127,7 @@ primitive or interface named NAME."
5103 (setq string (buffer-substring b e))) 5127 (setq string (buffer-substring b e)))
5104 (t 5128 (t
5105 (ding 't) 5129 (ding 't)
5106 (setq string "unmatched end(function|task|module|primitive|interface|package|class|clocking)"))))) 5130 (setq string "unmatched end(function|task|module|connectmodule|primitive|interface|package|class|clocking)")))))
5107 (end-of-line) 5131 (end-of-line)
5108 (insert (concat " // " string ))) 5132 (insert (concat " // " string )))
5109 )))))))))) 5133 ))))))))))
@@ -5574,7 +5598,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5574 (case-fold-search nil) 5598 (case-fold-search nil)
5575 (par 0) 5599 (par 0)
5576 (begin (looking-at "[ \t]*begin\\>")) 5600 (begin (looking-at "[ \t]*begin\\>"))
5577 (lim (save-excursion (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)" nil t))) 5601 (lim (save-excursion (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<\\(connect\\)?module\\>\\)" nil t)))
5578 (structres nil) 5602 (structres nil)
5579 (type (catch 'nesting 5603 (type (catch 'nesting
5580 ;; Keep working backwards until we can figure out 5604 ;; Keep working backwards until we can figure out
@@ -7127,7 +7151,7 @@ BASEIND is the base indent to offset everything."
7127 (let ((pos (point-marker)) 7151 (let ((pos (point-marker))
7128 (lim (save-excursion 7152 (lim (save-excursion
7129 ;; (verilog-re-search-backward verilog-declaration-opener nil 'move) 7153 ;; (verilog-re-search-backward verilog-declaration-opener nil 'move)
7130 (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<module\\>\\)\\|\\(\\<task\\>\\)" nil 'move) 7154 (verilog-re-search-backward "\\(\\<begin\\>\\)\\|\\(\\<\\(connect\\)?module\\>\\)\\|\\(\\<task\\>\\)" nil 'move)
7131 (point))) 7155 (point)))
7132 (ind) 7156 (ind)
7133 (val) 7157 (val)
@@ -7286,7 +7310,7 @@ it displays a list of all possible completions.")
7286\(integer, real, reg...)") 7310\(integer, real, reg...)")
7287 7311
7288(defvar verilog-cpp-keywords 7312(defvar verilog-cpp-keywords
7289 '("module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else" 7313 '("connectmodule" "module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else"
7290 "endif") 7314 "endif")
7291 "Keywords to complete when at first word of a line in declarative scope. 7315 "Keywords to complete when at first word of a line in declarative scope.
7292\(initial, always, begin, assign...) 7316\(initial, always, begin, assign...)
@@ -7297,7 +7321,7 @@ will be completed at runtime and should not be added to this list.")
7297 (append 7321 (append
7298 '( 7322 '(
7299 "always" "always_comb" "always_ff" "always_latch" "assign" 7323 "always" "always_comb" "always_ff" "always_latch" "assign"
7300 "begin" "end" "generate" "endgenerate" "module" "endmodule" 7324 "begin" "end" "connectmodule" "endconnectmodule" "generate" "endgenerate" "module" "endmodule"
7301 "specify" "endspecify" "function" "endfunction" "initial" "final" 7325 "specify" "endspecify" "function" "endfunction" "initial" "final"
7302 "task" "endtask" "primitive" "endprimitive" 7326 "task" "endtask" "primitive" "endprimitive"
7303 ) 7327 )
@@ -7394,9 +7418,9 @@ TYPE is `module', `tf' for task or function, or t if unknown."
7394 (if (string= verilog-str "") 7418 (if (string= verilog-str "")
7395 (setq verilog-str "[a-zA-Z_]")) 7419 (setq verilog-str "[a-zA-Z_]"))
7396 (let ((verilog-str (concat (cond 7420 (let ((verilog-str (concat (cond
7397 ((eq type 'module) "\\<\\(module\\)\\s +") 7421 ((eq type 'module) "\\<\\(module\\|connectmodule\\)\\s +")
7398 ((eq type 'tf) "\\<\\(task\\|function\\)\\s +") 7422 ((eq type 'tf) "\\<\\(task\\|function\\)\\s +")
7399 (t "\\<\\(task\\|function\\|module\\)\\s +")) 7423 (t "\\<\\(task\\|function\\|module\\|connectmodule\\)\\s +"))
7400 "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>")) 7424 "\\<\\(" verilog-str "[a-zA-Z0-9_.]*\\)\\>"))
7401 match) 7425 match)
7402 7426
@@ -7738,7 +7762,7 @@ If search fails, other files are checked based on
7738 (first 1) 7762 (first 1)
7739 (prevpos (point-min)) 7763 (prevpos (point-min))
7740 (final-context-start (make-marker)) 7764 (final-context-start (make-marker))
7741 (regexp "\\(module\\s-+\\w+\\s-*(\\)\\|\\(\\w+\\s-+\\w+\\s-*(\\)")) 7765 (regexp "\\(\\(connect\\)?module\\s-+\\w+\\s-*(\\)\\|\\(\\w+\\s-+\\w+\\s-*(\\)"))
7742 (with-output-to-temp-buffer "*Occur*" 7766 (with-output-to-temp-buffer "*Occur*"
7743 (save-excursion 7767 (save-excursion
7744 (message "Searching for %s ..." regexp) 7768 (message "Searching for %s ..." regexp)
@@ -8459,7 +8483,8 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
8459 (let ((olist)) 8483 (let ((olist))
8460 (save-excursion 8484 (save-excursion
8461 ;; /*AUTOPUNT("parameter", "parameter")*/ 8485 ;; /*AUTOPUNT("parameter", "parameter")*/
8462 (backward-sexp 1) 8486 (when (not (eq (char-before) ?\*)) ; Not .*
8487 (backward-sexp 1))
8463 (while (looking-at "(?\\s *\"\\([^\"]*\\)\"\\s *,?") 8488 (while (looking-at "(?\\s *\"\\([^\"]*\\)\"\\s *,?")
8464 (setq olist (cons (match-string-no-properties 1) olist)) 8489 (setq olist (cons (match-string-no-properties 1) olist))
8465 (goto-char (match-end 0)))) 8490 (goto-char (match-end 0))))
@@ -9909,7 +9934,7 @@ Allows version control to check out the file if need be."
9909 (while (and 9934 (while (and
9910 ;; It may be tempting to look for verilog-defun-re, 9935 ;; It may be tempting to look for verilog-defun-re,
9911 ;; don't, it slows things down a lot! 9936 ;; don't, it slows things down a lot!
9912 (verilog-re-search-forward-quick "\\<\\(module\\|interface\\|program\\)\\>" nil t) 9937 (verilog-re-search-forward-quick "\\<\\(connectmodule\\|module\\|interface\\|program\\)\\>" nil t)
9913 (setq type (match-string-no-properties 0)) 9938 (setq type (match-string-no-properties 0))
9914 (verilog-re-search-forward-quick "[(;]" nil t)) 9939 (verilog-re-search-forward-quick "[(;]" nil t))
9915 (if (equal module (verilog-read-module-name)) 9940 (if (equal module (verilog-read-module-name))
@@ -10937,9 +10962,9 @@ shown) will make this into:
10937 ;; Presume one module per file. 10962 ;; Presume one module per file.
10938 (save-excursion 10963 (save-excursion
10939 (goto-char (point-min)) 10964 (goto-char (point-min))
10940 (while (verilog-re-search-forward-quick "\\<module\\>" nil t) 10965 (while (verilog-re-search-forward-quick "\\<\\(connect\\)?module\\>" nil t)
10941 (let ((endmodp (save-excursion 10966 (let ((endmodp (save-excursion
10942 (verilog-re-search-forward-quick "\\<endmodule\\>" nil t) 10967 (verilog-re-search-forward-quick "\\<end\\(connect\\)?module\\>" nil t)
10943 (point)))) 10968 (point))))
10944 ;; See if there's already a comment .. inside a comment so not verilog-re-search 10969 ;; See if there's already a comment .. inside a comment so not verilog-re-search
10945 (when (not (re-search-forward "/\\*AUTOARG\\*/" endmodp t)) 10970 (when (not (re-search-forward "/\\*AUTOARG\\*/" endmodp t))
@@ -11583,6 +11608,9 @@ Replace the pin connections to an instantiation or interface
11583declaration with ones automatically derived from the module or 11608declaration with ones automatically derived from the module or
11584interface header of the instantiated item. 11609interface header of the instantiated item.
11585 11610
11611You may also provide an optional regular expression, in which
11612case only I/O matching the regular expression will be included.
11613
11586If `verilog-auto-star-expand' is set, also expand SystemVerilog .* ports, 11614If `verilog-auto-star-expand' is set, also expand SystemVerilog .* ports,
11587and delete them before saving unless `verilog-auto-star-save' is set. 11615and delete them before saving unless `verilog-auto-star-save' is set.
11588See `verilog-auto-star' for more information. 11616See `verilog-auto-star' for more information.
@@ -11901,7 +11929,9 @@ For more information see the \\[verilog-faq] and forums at URL
11901`https://www.veripool.org'." 11929`https://www.veripool.org'."
11902 (save-excursion 11930 (save-excursion
11903 ;; Find beginning 11931 ;; Find beginning
11904 (let* ((pt (point)) 11932 (let* ((params (verilog-read-auto-params 0 1))
11933 (regexp (nth 0 params))
11934 (pt (point))
11905 (for-star (save-excursion (backward-char 2) (looking-at "\\.\\*"))) 11935 (for-star (save-excursion (backward-char 2) (looking-at "\\.\\*")))
11906 (indent-pt (save-excursion (verilog-backward-open-paren) 11936 (indent-pt (save-excursion (verilog-backward-open-paren)
11907 (1+ (current-column)))) 11937 (1+ (current-column))))
@@ -11946,6 +11976,8 @@ For more information see the \\[verilog-faq] and forums at URL
11946 (verilog-decls-get-vars submoddecls) 11976 (verilog-decls-get-vars submoddecls)
11947 skip-pins))) 11977 skip-pins)))
11948 (vl-dir "interfaced")) 11978 (vl-dir "interfaced"))
11979 (when regexp
11980 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11949 (when (and sig-list 11981 (when (and sig-list
11950 verilog-auto-inst-interfaced-ports) 11982 verilog-auto-inst-interfaced-ports)
11951 ;; Note these are searched for in verilog-read-sub-decls. 11983 ;; Note these are searched for in verilog-read-sub-decls.
@@ -11956,6 +11988,8 @@ For more information see the \\[verilog-faq] and forums at URL
11956 (verilog-decls-get-interfaces submoddecls) 11988 (verilog-decls-get-interfaces submoddecls)
11957 skip-pins)) 11989 skip-pins))
11958 (vl-dir "interface")) 11990 (vl-dir "interface"))
11991 (when regexp
11992 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11959 (when sig-list 11993 (when sig-list
11960 ;; Note these are searched for in verilog-read-sub-decls. 11994 ;; Note these are searched for in verilog-read-sub-decls.
11961 (verilog-auto-inst-port-list "// Interfaces\n" 11995 (verilog-auto-inst-port-list "// Interfaces\n"
@@ -11965,6 +11999,8 @@ For more information see the \\[verilog-faq] and forums at URL
11965 (verilog-decls-get-outputs submoddecls) 11999 (verilog-decls-get-outputs submoddecls)
11966 skip-pins)) 12000 skip-pins))
11967 (vl-dir "output")) 12001 (vl-dir "output"))
12002 (when regexp
12003 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11968 (when sig-list 12004 (when sig-list
11969 (verilog-auto-inst-port-list "// Outputs\n" 12005 (verilog-auto-inst-port-list "// Outputs\n"
11970 sig-list indent-pt moddecls 12006 sig-list indent-pt moddecls
@@ -11973,6 +12009,8 @@ For more information see the \\[verilog-faq] and forums at URL
11973 (verilog-decls-get-inouts submoddecls) 12009 (verilog-decls-get-inouts submoddecls)
11974 skip-pins)) 12010 skip-pins))
11975 (vl-dir "inout")) 12011 (vl-dir "inout"))
12012 (when regexp
12013 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11976 (when sig-list 12014 (when sig-list
11977 (verilog-auto-inst-port-list "// Inouts\n" 12015 (verilog-auto-inst-port-list "// Inouts\n"
11978 sig-list indent-pt moddecls 12016 sig-list indent-pt moddecls
@@ -11981,6 +12019,8 @@ For more information see the \\[verilog-faq] and forums at URL
11981 (verilog-decls-get-inputs submoddecls) 12019 (verilog-decls-get-inputs submoddecls)
11982 skip-pins)) 12020 skip-pins))
11983 (vl-dir "input")) 12021 (vl-dir "input"))
12022 (when regexp
12023 (setq sig-list (verilog-signals-matching-regexp sig-list regexp)))
11984 (when sig-list 12024 (when sig-list
11985 (verilog-auto-inst-port-list "// Inputs\n" 12025 (verilog-auto-inst-port-list "// Inputs\n"
11986 sig-list indent-pt moddecls 12026 sig-list indent-pt moddecls