aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorWilson Snyder2012-09-26 11:32:51 +0800
committerChong Yidong2012-09-26 11:32:51 +0800
commit179f044b55d802f675c1dc9e744d9803a9f8aaeb (patch)
treee9298bdd2c4025011e58aa13f3cfe53ec6917dae /lisp
parent5c11868cad512379b408e28d4880ba7589b3d5a0 (diff)
downloademacs-179f044b55d802f675c1dc9e744d9803a9f8aaeb.tar.gz
emacs-179f044b55d802f675c1dc9e744d9803a9f8aaeb.zip
Synch verilog-mode.el to latest upstream version.
* verilog-mode.el (verilog-auto-ascii-enum, verilog-auto-inout) (verilog-auto-input, verilog-auto-insert-lisp) (verilog-auto-output, verilog-auto-output-every, verilog-auto-reg) (verilog-auto-reg-input, verilog-auto-tieoff, verilog-auto-undef) (verilog-auto-unused, verilog-auto-wire) (verilog-forward-or-insert-line): Fix AUTOs with no trailing newline. Reported by Andrew Jones. (verilog-auto-inst) Support expanding $clog2 in AUTOINST. Reported by Brad Dobbie. (verilog-batch-delete-trailing-whitespace): Create verilog-batch-delete-trailing-whitespace. Reported by Brad Dobbie. (verilog-auto-inout-param): Support AUTOINOUTPARAM for copying parameters from another module. Reported by Dan Katz. (verilog-auto, verilog-auto-assign-modport) (verilog-auto-inout-modport): Add AUTOASSIGNMODPORT and AUTOINOUTMODPORT for UVM interface module shell generation. Reported by Brad Dobbie. (verilog-auto-inst-interfaced-ports): Make default nil, as more standard behavior. (verilog-auto): Fix AUTO parameters with parenthesis arguments. Reported by Matt Martin.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog25
-rw-r--r--lisp/progmodes/verilog-mode.el703
2 files changed, 636 insertions, 92 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 283e1844a98..c2168a33398 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,28 @@
12012-09-25 Wilson Snyder <wsnyder@wsnyder.org>
2
3 * verilog-mode.el (verilog-auto-ascii-enum, verilog-auto-inout)
4 (verilog-auto-input, verilog-auto-insert-lisp)
5 (verilog-auto-output, verilog-auto-output-every, verilog-auto-reg)
6 (verilog-auto-reg-input, verilog-auto-tieoff, verilog-auto-undef)
7 (verilog-auto-unused, verilog-auto-wire)
8 (verilog-forward-or-insert-line): Fix AUTOs with no trailing
9 newline. Reported by Andrew Jones.
10 (verilog-auto-inst) Support expanding $clog2 in AUTOINST.
11 Reported by Brad Dobbie.
12 (verilog-batch-delete-trailing-whitespace): Create
13 verilog-batch-delete-trailing-whitespace. Reported by Brad
14 Dobbie.
15 (verilog-auto-inout-param): Support AUTOINOUTPARAM for copying
16 parameters from another module. Reported by Dan Katz.
17 (verilog-auto, verilog-auto-assign-modport)
18 (verilog-auto-inout-modport): Add AUTOASSIGNMODPORT and
19 AUTOINOUTMODPORT for UVM interface module shell generation.
20 Reported by Brad Dobbie.
21 (verilog-auto-inst-interfaced-ports): Make default nil, as more
22 standard behavior.
23 (verilog-auto): Fix AUTO parameters with parenthesis arguments.
24 Reported by Matt Martin.
25
12012-09-25 Martin Rudalics <rudalics@gmx.at> 262012-09-25 Martin Rudalics <rudalics@gmx.at>
2 27
3 * window.el (window--resize-child-windows): When resizing child 28 * window.el (window--resize-child-windows): When resizing child
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 835d548c19f..6a5060f2552 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -123,11 +123,11 @@
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 "800" 126(defconst verilog-mode-version (substring "$$Revision: 820 $$" 12 -3)
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-date "2012-04-23-GNU" 128(defconst verilog-mode-release-date (substring "$$Date: 2012-09-17 20:43:10 -0400 (Mon, 17 Sep 2012) $$" 8 -3)
129 "Release date of this Verilog mode.") 129 "Release date of this Verilog mode.")
130(defconst verilog-mode-release-emacs t 130(defconst verilog-mode-release-emacs nil
131 "If non-nil, this version of Verilog mode was released with Emacs itself.") 131 "If non-nil, this version of Verilog mode was released with Emacs itself.")
132 132
133(defun verilog-version () 133(defun verilog-version ()
@@ -1127,7 +1127,7 @@ won't merge conflict."
1127 :type 'integer) 1127 :type 'integer)
1128(put 'verilog-auto-inst-column 'safe-local-variable 'integerp) 1128(put 'verilog-auto-inst-column 'safe-local-variable 'integerp)
1129 1129
1130(defcustom verilog-auto-inst-interfaced-ports t 1130(defcustom verilog-auto-inst-interfaced-ports nil
1131 "Non-nil means include interfaced ports in AUTOINST expansions." 1131 "Non-nil means include interfaced ports in AUTOINST expansions."
1132 :group 'verilog-mode-auto 1132 :group 'verilog-mode-auto
1133 :type 'boolean) 1133 :type 'boolean)
@@ -1431,12 +1431,18 @@ If set will become buffer local.")
1431 :help "Help on AUTOARG - declaring module port list"] 1431 :help "Help on AUTOARG - declaring module port list"]
1432 ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum) 1432 ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum)
1433 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] 1433 :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"]
1434 ["AUTOASSIGNMODPORT" (describe-function 'verilog-auto-assign-modport)
1435 :help "Help on AUTOASSIGNMODPORT - creating assignments to/from modports"]
1434 ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp) 1436 ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-comp)
1435 :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"] 1437 :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"]
1436 ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in) 1438 ["AUTOINOUTIN" (describe-function 'verilog-auto-inout-in)
1437 :help "Help on AUTOINOUTCOMP - copying i/o from another file as all inputs"] 1439 :help "Help on AUTOINOUTIN - copying i/o from another file as all inputs"]
1440 ["AUTOINOUTMODPORT" (describe-function 'verilog-auto-inout-modport)
1441 :help "Help on AUTOINOUTMODPORT - copying i/o from an interface modport"]
1438 ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module) 1442 ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module)
1439 :help "Help on AUTOINOUTMODULE - copying i/o from another file"] 1443 :help "Help on AUTOINOUTMODULE - copying i/o from another file"]
1444 ["AUTOINOUTPARAM" (describe-function 'verilog-auto-inout-param)
1445 :help "Help on AUTOINOUTPARAM - copying parameters from another file"]
1440 ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp) 1446 ["AUTOINSERTLISP" (describe-function 'verilog-auto-insert-lisp)
1441 :help "Help on AUTOINSERTLISP - insert text from a lisp function"] 1447 :help "Help on AUTOINSERTLISP - insert text from a lisp function"]
1442 ["AUTOINOUT" (describe-function 'verilog-auto-inout) 1448 ["AUTOINOUT" (describe-function 'verilog-auto-inout)
@@ -1706,12 +1712,19 @@ This speeds up complicated regexp matches."
1706;;(verilog-re-search-backward-substr "-end" "get-end-of" nil t) ;;-end (test bait) 1712;;(verilog-re-search-backward-substr "-end" "get-end-of" nil t) ;;-end (test bait)
1707 1713
1708(defun verilog-delete-trailing-whitespace () 1714(defun verilog-delete-trailing-whitespace ()
1709 "Delete trailing spaces or tabs, but not newlines nor linefeeds." 1715 "Delete trailing spaces or tabs, but not newlines nor linefeeds.
1716Also add missing final newline.
1717
1718To call this from the command line, see \\[verilog-batch-diff-auto].
1719
1720To call on \\[verilog-auto], set `verilog-auto-delete-trailing-whitespace'."
1710 ;; Similar to `delete-trailing-whitespace' but that's not present in XEmacs 1721 ;; Similar to `delete-trailing-whitespace' but that's not present in XEmacs
1711 (save-excursion 1722 (save-excursion
1712 (goto-char (point-min)) 1723 (goto-char (point-min))
1713 (while (re-search-forward "[ \t]+$" nil t) ;; Not syntactic WS as no formfeed 1724 (while (re-search-forward "[ \t]+$" nil t) ;; Not syntactic WS as no formfeed
1714 (replace-match "" nil nil)))) 1725 (replace-match "" nil nil))
1726 (goto-char (point-max))
1727 (unless (bolp) (insert "\n"))))
1715 1728
1716(defvar compile-command) 1729(defvar compile-command)
1717 1730
@@ -5128,6 +5141,15 @@ with \\[verilog-delete-auto] on all command-line files, and saves the buffers."
5128 (error "Use verilog-batch-delete-auto only with --batch")) ;; Otherwise we'd mess up buffer modes 5141 (error "Use verilog-batch-delete-auto only with --batch")) ;; Otherwise we'd mess up buffer modes
5129 (verilog-batch-execute-func `verilog-delete-auto)) 5142 (verilog-batch-execute-func `verilog-delete-auto))
5130 5143
5144(defun verilog-batch-delete-trailing-whitespace ()
5145 "For use with --batch, perform whitespace deletion as a stand-alone tool.
5146This sets up the appropriate Verilog mode environment, removes
5147whitespace with \\[verilog-delete-trailing-whitespace] on all
5148command-line files, and saves the buffers."
5149 (unless noninteractive
5150 (error "Use verilog-batch-delete-trailing-whitepace only with --batch")) ;; Otherwise we'd mess up buffer modes
5151 (verilog-batch-execute-func `verilog-delete-trailing-whitespace))
5152
5131(defun verilog-batch-diff-auto () 5153(defun verilog-batch-diff-auto ()
5132 "For use with --batch, perform automatic differences as a stand-alone tool. 5154 "For use with --batch, perform automatic differences as a stand-alone tool.
5133This sets up the appropriate Verilog mode environment, expand automatics 5155This sets up the appropriate Verilog mode environment, expand automatics
@@ -7479,6 +7501,19 @@ See also `verilog-sk-header' for an alternative format."
7479(defsubst verilog-alw-get-uses-delayed (sigs) 7501(defsubst verilog-alw-get-uses-delayed (sigs)
7480 (aref sigs 0)) 7502 (aref sigs 0))
7481 7503
7504(defsubst verilog-modport-new (name clockings decls)
7505 (list name clockings decls))
7506(defsubst verilog-modport-name (sig)
7507 (car sig))
7508(defsubst verilog-modport-clockings (sig)
7509 (nth 1 sig)) ;; Returns list of names
7510(defsubst verilog-modport-clockings-add (sig val)
7511 (setcar (nthcdr 1 sig) (cons val (nth 1 sig))))
7512(defsubst verilog-modport-decls (sig)
7513 (nth 2 sig)) ;; Returns verilog-decls-* structure
7514(defsubst verilog-modport-decls-set (sig val)
7515 (setcar (nthcdr 2 sig) val))
7516
7482(defsubst verilog-modi-new (name fob pt type) 7517(defsubst verilog-modi-new (name fob pt type)
7483 (vector name fob pt type)) 7518 (vector name fob pt type))
7484(defsubst verilog-modi-name (modi) 7519(defsubst verilog-modi-name (modi)
@@ -7496,8 +7531,15 @@ See also `verilog-sk-header' for an alternative format."
7496 7531
7497;; Signal reading for given module 7532;; Signal reading for given module
7498;; Note these all take modi's - as returned from verilog-modi-current 7533;; Note these all take modi's - as returned from verilog-modi-current
7499(defsubst verilog-decls-new (out inout in vars unuseds assigns consts gparams interfaces) 7534(defsubst verilog-decls-new (out inout in vars modports assigns consts gparams interfaces)
7500 (vector out inout in vars unuseds assigns consts gparams interfaces)) 7535 (vector out inout in vars modports assigns consts gparams interfaces))
7536(defsubst verilog-decls-append (a b)
7537 (cond ((not a) b) ((not b) a)
7538 (t (vector (append (aref a 0) (aref b 0)) (append (aref a 1) (aref b 1))
7539 (append (aref a 2) (aref b 2)) (append (aref a 3) (aref b 3))
7540 (append (aref a 4) (aref b 4)) (append (aref a 5) (aref b 5))
7541 (append (aref a 6) (aref b 6)) (append (aref a 7) (aref b 7))
7542 (append (aref a 8) (aref b 8))))))
7501(defsubst verilog-decls-get-outputs (decls) 7543(defsubst verilog-decls-get-outputs (decls)
7502 (aref decls 0)) 7544 (aref decls 0))
7503(defsubst verilog-decls-get-inouts (decls) 7545(defsubst verilog-decls-get-inouts (decls)
@@ -7506,8 +7548,8 @@ See also `verilog-sk-header' for an alternative format."
7506 (aref decls 2)) 7548 (aref decls 2))
7507(defsubst verilog-decls-get-vars (decls) 7549(defsubst verilog-decls-get-vars (decls)
7508 (aref decls 3)) 7550 (aref decls 3))
7509;;(defsubst verilog-decls-get-unused (decls) 7551(defsubst verilog-decls-get-modports (decls) ;; Also for clocking blocks; contains another verilog-decls struct
7510;; (aref decls 4)) 7552 (aref decls 4)) ;; Returns verilog-modport* structure
7511(defsubst verilog-decls-get-assigns (decls) 7553(defsubst verilog-decls-get-assigns (decls)
7512 (aref decls 5)) 7554 (aref decls 5))
7513(defsubst verilog-decls-get-consts (decls) 7555(defsubst verilog-decls-get-consts (decls)
@@ -7517,6 +7559,7 @@ See also `verilog-sk-header' for an alternative format."
7517(defsubst verilog-decls-get-interfaces (decls) 7559(defsubst verilog-decls-get-interfaces (decls)
7518 (aref decls 8)) 7560 (aref decls 8))
7519 7561
7562
7520(defsubst verilog-subdecls-new (out inout in intf intfd) 7563(defsubst verilog-subdecls-new (out inout in intf intfd)
7521 (vector out inout in intf intfd)) 7564 (vector out inout in intf intfd))
7522(defsubst verilog-subdecls-get-outputs (subdecls) 7565(defsubst verilog-subdecls-get-outputs (subdecls)
@@ -7535,6 +7578,36 @@ See also `verilog-sk-header' for an alternative format."
7535 (mapcar (lambda (name) (verilog-sig-new name nil nil nil nil nil nil nil nil)) 7578 (mapcar (lambda (name) (verilog-sig-new name nil nil nil nil nil nil nil nil))
7536 signame-list)) 7579 signame-list))
7537 7580
7581(defun verilog-signals-in (in-list not-list)
7582 "Return list of signals in IN-LIST that are also in NOT-LIST.
7583Also remove any duplicates in IN-LIST.
7584Signals must be in standard (base vector) form."
7585 ;; This function is hot, so implemented as O(1)
7586 (cond ((eval-when-compile (fboundp 'make-hash-table))
7587 (let ((ht (make-hash-table :test 'equal :rehash-size 4.0))
7588 (ht-not (make-hash-table :test 'equal :rehash-size 4.0))
7589 out-list)
7590 (while not-list
7591 (puthash (car (car not-list)) t ht-not)
7592 (setq not-list (cdr not-list)))
7593 (while in-list
7594 (when (and (gethash (verilog-sig-name (car in-list)) ht-not)
7595 (not (gethash (verilog-sig-name (car in-list)) ht)))
7596 (setq out-list (cons (car in-list) out-list))
7597 (puthash (verilog-sig-name (car in-list)) t ht))
7598 (setq in-list (cdr in-list)))
7599 (nreverse out-list)))
7600 ;; Slower Fallback if no hash tables (pre Emacs 21.1/XEmacs 21.4)
7601 (t
7602 (let (out-list)
7603 (while in-list
7604 (if (and (assoc (verilog-sig-name (car in-list)) not-list)
7605 (not (assoc (verilog-sig-name (car in-list)) out-list)))
7606 (setq out-list (cons (car in-list) out-list)))
7607 (setq in-list (cdr in-list)))
7608 (nreverse out-list)))))
7609;;(verilog-signals-in '(("A" "") ("B" "") ("DEL" "[2:3]")) '(("DEL" "") ("C" "")))
7610
7538(defun verilog-signals-not-in (in-list not-list) 7611(defun verilog-signals-not-in (in-list not-list)
7539 "Return list of signals in IN-LIST that aren't also in NOT-LIST. 7612 "Return list of signals in IN-LIST that aren't also in NOT-LIST.
7540Also remove any duplicates in IN-LIST. 7613Also remove any duplicates in IN-LIST.
@@ -7556,8 +7629,8 @@ Signals must be in standard (base vector) form."
7556 (t 7629 (t
7557 (let (out-list) 7630 (let (out-list)
7558 (while in-list 7631 (while in-list
7559 (if (not (or (assoc (verilog-sig-name (car in-list)) not-list) 7632 (if (and (not (assoc (verilog-sig-name (car in-list)) not-list))
7560 (assoc (verilog-sig-name (car in-list)) out-list))) 7633 (not (assoc (verilog-sig-name (car in-list)) out-list)))
7561 (setq out-list (cons (car in-list) out-list))) 7634 (setq out-list (cons (car in-list) out-list)))
7562 (setq in-list (cdr in-list))) 7635 (setq in-list (cdr in-list)))
7563 (nreverse out-list))))) 7636 (nreverse out-list)))))
@@ -7702,30 +7775,35 @@ Tieoff value uses `verilog-active-low-regexp' and
7702;; Dumping 7775;; Dumping
7703;; 7776;;
7704 7777
7705(defun verilog-decls-princ (decls) 7778(defun verilog-decls-princ (decls &optional header prefix)
7706 "For debug, dump the `verilog-read-decls' structure DECLS." 7779 "For debug, dump the `verilog-read-decls' structure DECLS."
7707 (verilog-signals-princ (verilog-decls-get-outputs decls) 7780 (when decls
7708 "Outputs:\n" " ") 7781 (if header (princ header))
7709 (verilog-signals-princ (verilog-decls-get-inouts decls) 7782 (setq prefix (or prefix ""))
7710 "Inout:\n" " ") 7783 (verilog-signals-princ (verilog-decls-get-outputs decls)
7711 (verilog-signals-princ (verilog-decls-get-inputs decls) 7784 (concat prefix "Outputs:\n") (concat prefix " "))
7712 "Inputs:\n" " ") 7785 (verilog-signals-princ (verilog-decls-get-inouts decls)
7713 (verilog-signals-princ (verilog-decls-get-vars decls) 7786 (concat prefix "Inout:\n") (concat prefix " "))
7714 "Vars:\n" " ") 7787 (verilog-signals-princ (verilog-decls-get-inputs decls)
7715 (verilog-signals-princ (verilog-decls-get-assigns decls) 7788 (concat prefix "Inputs:\n") (concat prefix " "))
7716 "Assigns:\n" " ") 7789 (verilog-signals-princ (verilog-decls-get-vars decls)
7717 (verilog-signals-princ (verilog-decls-get-consts decls) 7790 (concat prefix "Vars:\n") (concat prefix " "))
7718 "Consts:\n" " ") 7791 (verilog-signals-princ (verilog-decls-get-assigns decls)
7719 (verilog-signals-princ (verilog-decls-get-gparams decls) 7792 (concat prefix "Assigns:\n") (concat prefix " "))
7720 "Gparams:\n" " ") 7793 (verilog-signals-princ (verilog-decls-get-consts decls)
7721 (verilog-signals-princ (verilog-decls-get-interfaces decls) 7794 (concat prefix "Consts:\n") (concat prefix " "))
7722 "Interfaces:\n" " ") 7795 (verilog-signals-princ (verilog-decls-get-gparams decls)
7723 (princ "\n")) 7796 (concat prefix "Gparams:\n") (concat prefix " "))
7797 (verilog-signals-princ (verilog-decls-get-interfaces decls)
7798 (concat prefix "Interfaces:\n") (concat prefix " "))
7799 (verilog-modport-princ (verilog-decls-get-modports decls)
7800 (concat prefix "Modports:\n") (concat prefix " "))
7801 (princ "\n")))
7724 7802
7725(defun verilog-signals-princ (signals &optional header prefix) 7803(defun verilog-signals-princ (signals &optional header prefix)
7726 "For debug, dump internal SIGNALS structures, with HEADER and PREFIX." 7804 "For debug, dump internal SIGNALS structures, with HEADER and PREFIX."
7727 (when signals 7805 (when signals
7728 (princ header) 7806 (if header (princ header))
7729 (while signals 7807 (while signals
7730 (let ((sig (car signals))) 7808 (let ((sig (car signals)))
7731 (setq signals (cdr signals)) 7809 (setq signals (cdr signals))
@@ -7741,6 +7819,21 @@ Tieoff value uses `verilog-active-low-regexp' and
7741 (princ " modp=") (princ (verilog-sig-modport sig)) 7819 (princ " modp=") (princ (verilog-sig-modport sig))
7742 (princ "\n"))))) 7820 (princ "\n")))))
7743 7821
7822(defun verilog-modport-princ (modports &optional header prefix)
7823 "For debug, dump internal MODPORT structures, with HEADER and PREFIX."
7824 (when modports
7825 (if header (princ header))
7826 (while modports
7827 (let ((sig (car modports)))
7828 (setq modports (cdr modports))
7829 (princ prefix)
7830 (princ "\"") (princ (verilog-modport-name sig)) (princ "\"")
7831 (princ " clockings=") (princ (verilog-modport-clockings sig))
7832 (princ "\n")
7833 (verilog-decls-princ (verilog-modport-decls sig)
7834 (concat prefix " syms:\n")
7835 (concat prefix " "))))))
7836
7744;; 7837;;
7745;; Port/Wire/Etc Reading 7838;; Port/Wire/Etc Reading
7746;; 7839;;
@@ -7851,11 +7944,12 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
7851Return an array of [outputs inouts inputs wire reg assign const]." 7944Return an array of [outputs inouts inputs wire reg assign const]."
7852 (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max))) 7945 (let ((end-mod-point (or (verilog-get-end-of-defun t) (point-max)))
7853 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t) 7946 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t)
7854 in-modport ptype ign-prop 7947 in-modport in-clocking ptype ign-prop
7855 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const 7948 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const
7856 sigs-gparam sigs-intf 7949 sigs-gparam sigs-intf sigs-modports
7857 vec expect-signal keywd newsig rvalue enum io signed typedefed multidim 7950 vec expect-signal keywd newsig rvalue enum io signed typedefed multidim
7858 modport) 7951 modport
7952 varstack tmp)
7859 (save-excursion 7953 (save-excursion
7860 (verilog-beg-of-defun-quick) 7954 (verilog-beg-of-defun-quick)
7861 (setq sigs-const (verilog-read-auto-constants (point) end-mod-point)) 7955 (setq sigs-const (verilog-read-auto-constants (point) end-mod-point))
@@ -7881,6 +7975,17 @@ Return an array of [outputs inouts inputs wire reg assign const]."
7881 (or (re-search-forward "[^\\]\"" nil t) ;; don't forward-char first, since we look for a non backslash first 7975 (or (re-search-forward "[^\\]\"" nil t) ;; don't forward-char first, since we look for a non backslash first
7882 (error "%s: Unmatched quotes, at char %d" (verilog-point-text) (point)))) 7976 (error "%s: Unmatched quotes, at char %d" (verilog-point-text) (point))))
7883 ((eq ?\; (following-char)) 7977 ((eq ?\; (following-char))
7978 (when (and in-modport (not (eq in-modport t))) ;; end of a modport declaration
7979 (verilog-modport-decls-set
7980 in-modport
7981 (verilog-decls-new sigs-out sigs-inout sigs-in
7982 nil nil nil nil nil nil))
7983 ;; Pop from varstack to restore state to pre-clocking
7984 (setq tmp (car varstack)
7985 varstack (cdr varstack)
7986 sigs-out (aref tmp 0)
7987 sigs-inout (aref tmp 1)
7988 sigs-in (aref tmp 2)))
7884 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil 7989 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil
7885 v2kargs-ok nil in-modport nil ign-prop nil) 7990 v2kargs-ok nil in-modport nil ign-prop nil)
7886 (forward-char 1)) 7991 (forward-char 1))
@@ -7974,15 +8079,17 @@ Return an array of [outputs inouts inputs wire reg assign const]."
7974 (setq signed keywd)) 8079 (setq signed keywd))
7975 ((member keywd '("assert" "assume" "cover" "expect" "restrict")) 8080 ((member keywd '("assert" "assume" "cover" "expect" "restrict"))
7976 (setq ign-prop t)) 8081 (setq ign-prop t))
7977 ((member keywd '("class" "clocking" "covergroup" "function" 8082 ((member keywd '("class" "covergroup" "function"
7978 "property" "randsequence" "sequence" "task")) 8083 "property" "randsequence" "sequence" "task"))
7979 (unless ign-prop 8084 (unless ign-prop
7980 (setq functask (1+ functask)))) 8085 (setq functask (1+ functask))))
7981 ((member keywd '("endclass" "endclocking" "endgroup" "endfunction" 8086 ((member keywd '("endclass" "endgroup" "endfunction"
7982 "endproperty" "endsequence" "endtask")) 8087 "endproperty" "endsequence" "endtask"))
7983 (setq functask (1- functask))) 8088 (setq functask (1- functask)))
7984 ((equal keywd "modport") 8089 ((equal keywd "modport")
7985 (setq in-modport t)) 8090 (setq in-modport t))
8091 ((equal keywd "clocking")
8092 (setq in-clocking t))
7986 ((equal keywd "type") 8093 ((equal keywd "type")
7987 (setq ptype t)) 8094 (setq ptype t))
7988 ;; Ifdef? Ignore name of define 8095 ;; Ifdef? Ignore name of define
@@ -8008,11 +8115,47 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8008 (goto-char (match-end 0)) 8115 (goto-char (match-end 0))
8009 (when (not rvalue) 8116 (when (not rvalue)
8010 (setq expect-signal nil))) 8117 (setq expect-signal nil)))
8118 ;; "modport <keywd>"
8119 ((and (eq in-modport t)
8120 (not (member keywd verilog-keywords)))
8121 (setq in-modport (verilog-modport-new keywd nil nil))
8122 (setq sigs-modports (cons in-modport sigs-modports))
8123 ;; Push old sig values to stack and point to new signal list
8124 (setq varstack (cons (vector sigs-out sigs-inout sigs-in)
8125 varstack))
8126 (setq sigs-in nil sigs-inout nil sigs-out nil))
8127 ;; "modport x (clocking <keywd>)"
8128 ((and in-modport in-clocking)
8129 (verilog-modport-clockings-add in-modport keywd)
8130 (setq in-clocking nil))
8131 ;; endclocking
8132 ((and in-clocking
8133 (equal keywd "endclocking"))
8134 (unless (eq in-clocking t)
8135 (verilog-modport-decls-set
8136 in-clocking
8137 (verilog-decls-new sigs-out sigs-inout sigs-in
8138 nil nil nil nil nil nil))
8139 ;; Pop from varstack to restore state to pre-clocking
8140 (setq tmp (car varstack)
8141 varstack (cdr varstack)
8142 sigs-out (aref tmp 0)
8143 sigs-inout (aref tmp 1)
8144 sigs-in (aref tmp 2)))
8145 (setq in-clocking nil))
8146 ;; "clocking <keywd>"
8147 ((and (eq in-clocking t)
8148 (not (member keywd verilog-keywords)))
8149 (setq in-clocking (verilog-modport-new keywd nil nil))
8150 (setq sigs-modports (cons in-clocking sigs-modports))
8151 ;; Push old sig values to stack and point to new signal list
8152 (setq varstack (cons (vector sigs-out sigs-inout sigs-in)
8153 varstack))
8154 (setq sigs-in nil sigs-inout nil sigs-out nil))
8011 ;; New signal, maybe? 8155 ;; New signal, maybe?
8012 ((and expect-signal 8156 ((and expect-signal
8013 (not rvalue) 8157 (not rvalue)
8014 (eq functask 0) 8158 (eq functask 0)
8015 (not in-modport)
8016 (not (member keywd verilog-keywords))) 8159 (not (member keywd verilog-keywords)))
8017 ;; Add new signal to expect-signal's variable 8160 ;; Add new signal to expect-signal's variable
8018 (setq newsig (verilog-sig-new keywd vec nil nil enum signed typedefed multidim modport)) 8161 (setq newsig (verilog-sig-new keywd vec nil nil enum signed typedefed multidim modport))
@@ -8022,15 +8165,17 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8022 (forward-char 1))) 8165 (forward-char 1)))
8023 (skip-syntax-forward " ")) 8166 (skip-syntax-forward " "))
8024 ;; Return arguments 8167 ;; Return arguments
8025 (verilog-decls-new (nreverse sigs-out) 8168 (setq tmp (verilog-decls-new (nreverse sigs-out)
8026 (nreverse sigs-inout) 8169 (nreverse sigs-inout)
8027 (nreverse sigs-in) 8170 (nreverse sigs-in)
8028 (nreverse sigs-var) 8171 (nreverse sigs-var)
8029 nil 8172 (nreverse sigs-modports)
8030 (nreverse sigs-assign) 8173 (nreverse sigs-assign)
8031 (nreverse sigs-const) 8174 (nreverse sigs-const)
8032 (nreverse sigs-gparam) 8175 (nreverse sigs-gparam)
8033 (nreverse sigs-intf))))) 8176 (nreverse sigs-intf)))
8177 ;;(if dbg (verilog-decls-princ tmp))
8178 tmp)))
8034 8179
8035(defvar verilog-read-sub-decls-in-interfaced nil 8180(defvar verilog-read-sub-decls-in-interfaced nil
8036 "For `verilog-read-sub-decls', process next signal as under interfaced block.") 8181 "For `verilog-read-sub-decls', process next signal as under interfaced block.")
@@ -9352,12 +9497,12 @@ Return modi if successful, else print message unless IGNORE-ERROR is true."
9352 ;;(message "verilog-modi-lookup: HIT %S" modi) 9497 ;;(message "verilog-modi-lookup: HIT %S" modi)
9353 modi) 9498 modi)
9354 ;; Miss 9499 ;; Miss
9355 (t (let* ((realmod (verilog-symbol-detick module t)) 9500 (t (let* ((realname (verilog-symbol-detick module t))
9356 (orig-filenames (verilog-module-filenames realmod current)) 9501 (orig-filenames (verilog-module-filenames realname current))
9357 (filenames orig-filenames) 9502 (filenames orig-filenames)
9358 mif) 9503 mif)
9359 (while (and filenames (not mif)) 9504 (while (and filenames (not mif))
9360 (if (not (setq mif (verilog-module-inside-filename-p realmod (car filenames)))) 9505 (if (not (setq mif (verilog-module-inside-filename-p realname (car filenames))))
9361 (setq filenames (cdr filenames)))) 9506 (setq filenames (cdr filenames))))
9362 ;; mif has correct form to become later elements of modi 9507 ;; mif has correct form to become later elements of modi
9363 (cond (mif (setq modi mif)) 9508 (cond (mif (setq modi mif))
@@ -9365,8 +9510,8 @@ Return modi if successful, else print message unless IGNORE-ERROR is true."
9365 (or ignore-error 9510 (or ignore-error
9366 (error (concat (verilog-point-text) 9511 (error (concat (verilog-point-text)
9367 ": Can't locate " module " module definition" 9512 ": Can't locate " module " module definition"
9368 (if (not (equal module realmod)) 9513 (if (not (equal module realname))
9369 (concat " (Expanded macro to " realmod ")") 9514 (concat " (Expanded macro to " realname ")")
9370 "") 9515 "")
9371 "\n Check the verilog-library-directories variable." 9516 "\n Check the verilog-library-directories variable."
9372 "\n I looked in (if not listed, doesn't exist):\n\t" 9517 "\n I looked in (if not listed, doesn't exist):\n\t"
@@ -9465,6 +9610,45 @@ and invalidating the cache."
9465 (progn ,@body))) 9610 (progn ,@body)))
9466 9611
9467 9612
9613(defun verilog-modi-modport-lookup-one (modi name &optional ignore-error)
9614 "Given a MODI, return the declarations related to the given modport NAME."
9615 ;; Recursive routine - see below
9616 (let* ((realname (verilog-symbol-detick name t))
9617 (modport (assoc name (verilog-decls-get-modports (verilog-modi-get-decls modi)))))
9618 (or modport ignore-error
9619 (error (concat (verilog-point-text)
9620 ": Can't locate " name " modport definition"
9621 (if (not (equal name realname))
9622 (concat " (Expanded macro to " realname ")")
9623 ""))))
9624 (let* ((decls (verilog-modport-decls modport))
9625 (clks (verilog-modport-clockings modport)))
9626 ;; Now expand any clocking's
9627 (while clks
9628 (setq decls (verilog-decls-append
9629 decls
9630 (verilog-modi-modport-lookup-one modi (car clks) ignore-error)))
9631 (setq clks (cdr clks)))
9632 decls)))
9633
9634(defun verilog-modi-modport-lookup (modi name-re &optional ignore-error)
9635 "Given a MODI, return the declarations related to the given modport NAME-RE.
9636If the modport points to any clocking blocks, expand the signals to include
9637those clocking block's signals."
9638 ;; Recursive routine - see below
9639 (let* ((mod-decls (verilog-modi-get-decls modi))
9640 (clks (verilog-decls-get-modports mod-decls))
9641 (name-re (concat "^" name-re "$"))
9642 (decls (verilog-decls-new nil nil nil nil nil nil nil nil nil)))
9643 ;; Pull in all modports
9644 (while clks
9645 (when (string-match name-re (verilog-modport-name (car clks)))
9646 (setq decls (verilog-decls-append
9647 decls
9648 (verilog-modi-modport-lookup-one modi (verilog-modport-name (car clks)) ignore-error))))
9649 (setq clks (cdr clks)))
9650 decls))
9651
9468(defun verilog-signals-matching-enum (in-list enum) 9652(defun verilog-signals-matching-enum (in-list enum)
9469 "Return all signals in IN-LIST matching the given ENUM." 9653 "Return all signals in IN-LIST matching the given ENUM."
9470 (let (out-list) 9654 (let (out-list)
@@ -9544,6 +9728,13 @@ if non-nil."
9544 (verilog-decls-get-inouts decls) 9728 (verilog-decls-get-inouts decls)
9545 (verilog-decls-get-inputs decls))) 9729 (verilog-decls-get-inputs decls)))
9546 9730
9731(defun verilog-decls-get-iovars (decls)
9732 (append
9733 (verilog-decls-get-vars decls)
9734 (verilog-decls-get-outputs decls)
9735 (verilog-decls-get-inouts decls)
9736 (verilog-decls-get-inputs decls)))
9737
9547(defsubst verilog-modi-cache-add-outputs (modi sig-list) 9738(defsubst verilog-modi-cache-add-outputs (modi sig-list)
9548 (verilog-modi-cache-add modi 'verilog-read-decls 0 sig-list)) 9739 (verilog-modi-cache-add modi 'verilog-read-decls 0 sig-list))
9549(defsubst verilog-modi-cache-add-inouts (modi sig-list) 9740(defsubst verilog-modi-cache-add-inouts (modi sig-list)
@@ -9552,6 +9743,8 @@ if non-nil."
9552 (verilog-modi-cache-add modi 'verilog-read-decls 2 sig-list)) 9743 (verilog-modi-cache-add modi 'verilog-read-decls 2 sig-list))
9553(defsubst verilog-modi-cache-add-vars (modi sig-list) 9744(defsubst verilog-modi-cache-add-vars (modi sig-list)
9554 (verilog-modi-cache-add modi 'verilog-read-decls 3 sig-list)) 9745 (verilog-modi-cache-add modi 'verilog-read-decls 3 sig-list))
9746(defsubst verilog-modi-cache-add-gparams (modi sig-list)
9747 (verilog-modi-cache-add modi 'verilog-read-decls 7 sig-list))
9555 9748
9556 9749
9557;; 9750;;
@@ -9608,6 +9801,8 @@ When MODI is non-null, also add to modi-cache, for tracking."
9608 (when verilog-auto-declare-nettype 9801 (when verilog-auto-declare-nettype
9609 (verilog-modi-cache-add-vars modi sigs))) 9802 (verilog-modi-cache-add-vars modi sigs)))
9610 ((equal direction "interface")) 9803 ((equal direction "interface"))
9804 ((equal direction "parameter")
9805 (verilog-modi-cache-add-gparams modi sigs))
9611 (t 9806 (t
9612 (error "Unsupported verilog-insert-definition direction: %s" direction)))) 9807 (error "Unsupported verilog-insert-definition direction: %s" direction))))
9613 (or dont-sort 9808 (or dont-sort
@@ -9654,6 +9849,11 @@ Presumes that any newlines end a list element."
9654 stuff (cdr stuff))))) 9849 stuff (cdr stuff)))))
9655;;(let ((indent-pt 10)) (verilog-insert-indent "hello\n" "addon" "there\n")) 9850;;(let ((indent-pt 10)) (verilog-insert-indent "hello\n" "addon" "there\n"))
9656 9851
9852(defun verilog-forward-or-insert-line ()
9853 "Move forward a line, unless at EOB, then insert a newline."
9854 (if (eobp) (insert "\n")
9855 (forward-line)))
9856
9657(defun verilog-repair-open-comma () 9857(defun verilog-repair-open-comma ()
9658 "Insert comma if previous argument is other than an open parenthesis or endif." 9858 "Insert comma if previous argument is other than an open parenthesis or endif."
9659 ;; We can't just search backward for ) as it might be inside another expression. 9859 ;; We can't just search backward for ) as it might be inside another expression.
@@ -9741,6 +9941,17 @@ This repairs those mis-inserted by an AUTOARG."
9741 "\\([])}:*+-]\\)") 9941 "\\([])}:*+-]\\)")
9742 out) 9942 out)
9743 (setq out (replace-match "\\1\\2\\3" nil nil out))) 9943 (setq out (replace-match "\\1\\2\\3" nil nil out)))
9944 (while (string-match
9945 (concat "\\([[({:*+-]\\)" ; - must be last
9946 "\\$clog2\\s *(\\<\\([0-9]+\\))"
9947 "\\([])}:*+-]\\)")
9948 out)
9949 (setq out (replace-match
9950 (concat
9951 (match-string 1 out)
9952 (int-to-string (verilog-clog2 (string-to-number (match-string 2 out))))
9953 (match-string 3 out))
9954 nil nil out)))
9744 ;; For precedence do * before +/- 9955 ;; For precedence do * before +/-
9745 (while (string-match 9956 (while (string-match
9746 (concat "\\([[({:*+-]\\)" 9957 (concat "\\([[({:*+-]\\)"
@@ -9777,6 +9988,7 @@ This repairs those mis-inserted by an AUTOARG."
9777 post) 9988 post)
9778 nil nil out)) ))) 9989 nil nil out)) )))
9779 out))) 9990 out)))
9991
9780;;(verilog-simplify-range-expression "[1:3]") ;; 1 9992;;(verilog-simplify-range-expression "[1:3]") ;; 1
9781;;(verilog-simplify-range-expression "[(1):3]") ;; 1 9993;;(verilog-simplify-range-expression "[(1):3]") ;; 1
9782;;(verilog-simplify-range-expression "[(((16)+1)+1+(1+1))]") ;;20 9994;;(verilog-simplify-range-expression "[(((16)+1)+1+(1+1))]") ;;20
@@ -9785,6 +9997,14 @@ This repairs those mis-inserted by an AUTOARG."
9785;;(verilog-simplify-range-expression "[(FOO*4+1-1)]") ;; FOO*4+0 9997;;(verilog-simplify-range-expression "[(FOO*4+1-1)]") ;; FOO*4+0
9786;;(verilog-simplify-range-expression "[(func(BAR))]") ;; func(BAR) 9998;;(verilog-simplify-range-expression "[(func(BAR))]") ;; func(BAR)
9787;;(verilog-simplify-range-expression "[FOO-1+1-1+1]") ;; FOO-0 9999;;(verilog-simplify-range-expression "[FOO-1+1-1+1]") ;; FOO-0
10000;;(verilog-simplify-range-expression "[$clog2(2)]") ;; 1
10001;;(verilog-simplify-range-expression "[$clog2(7)]") ;; 3
10002
10003(defun verilog-clog2 (value)
10004 "Compute $clog2 - ceiling log2 of VALUE."
10005 (if (< value 1)
10006 0
10007 (ceiling (/ (log value) (log 2)))))
9788 10008
9789(defun verilog-typedef-name-p (variable-name) 10009(defun verilog-typedef-name-p (variable-name)
9790 "Return true if the VARIABLE-NAME is a type definition." 10010 "Return true if the VARIABLE-NAME is a type definition."
@@ -10348,6 +10568,86 @@ Avoid declaring ports manually, as it makes code harder to maintain."
10348 (insert "\n")) 10568 (insert "\n"))
10349 (indent-to verilog-indent-level-declaration)))) 10569 (indent-to verilog-indent-level-declaration))))
10350 10570
10571(defun verilog-auto-assign-modport ()
10572 "Expand AUTOASSIGNMODPORT statements, as part of \\[verilog-auto].
10573Take input/output/inout statements from the specified interface
10574and modport and use to build assignments into the modport, for
10575making verification modules that connect to UVM interfaces.
10576
10577 The first parameter is the name of an interface.
10578
10579 The second parameter is a regexp of modports to read from in
10580 that interface.
10581
10582 The third parameter is the instance name to use to dot reference into.
10583
10584 The optional fourth parameter is a regular expression, and only
10585 signals matching the regular expression will be included.
10586
10587Limitations:
10588
10589 Interface names must be resolvable to filenames. See `verilog-auto-inst'.
10590
10591 Inouts are not supported, as assignments must be unidirectional.
10592
10593 If a signal is part of the interface header and in both a
10594 modport and the interface itself, it will not be listed. (As
10595 this would result in a syntax error when the connections are
10596 made.)
10597
10598See the example in `verilog-auto-inout-modport'."
10599 (save-excursion
10600 (let* ((params (verilog-read-auto-params 3 4))
10601 (submod (nth 0 params))
10602 (modport-re (nth 1 params))
10603 (inst-name (nth 2 params))
10604 (regexp (nth 3 params))
10605 direction-re submodi) ;; direction argument not supported until requested
10606 ;; Lookup position, etc of co-module
10607 ;; Note this may raise an error
10608 (when (setq submodi (verilog-modi-lookup submod t))
10609 (let* ((indent-pt (current-indentation))
10610 (modi (verilog-modi-current))
10611 (submoddecls (verilog-modi-get-decls submodi))
10612 (submodportdecls (verilog-modi-modport-lookup submodi modport-re))
10613 (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve
10614 (verilog-decls-get-vars submoddecls)
10615 (verilog-signals-not-in
10616 (verilog-decls-get-inputs submodportdecls)
10617 (verilog-decls-get-ports submoddecls))))
10618 (sig-list-o (verilog-signals-in ;; Decls doesn't have data types, must resolve
10619 (verilog-decls-get-vars submoddecls)
10620 (verilog-signals-not-in
10621 (verilog-decls-get-outputs submodportdecls)
10622 (verilog-decls-get-ports submoddecls)))))
10623 (forward-line 1)
10624 (setq sig-list-i (verilog-signals-edit-wire-reg
10625 (verilog-signals-matching-dir-re
10626 (verilog-signals-matching-regexp sig-list-i regexp)
10627 "input" direction-re))
10628 sig-list-o (verilog-signals-edit-wire-reg
10629 (verilog-signals-matching-dir-re
10630 (verilog-signals-matching-regexp sig-list-o regexp)
10631 "output" direction-re)))
10632 (setq sig-list-i (sort (copy-alist sig-list-i) `verilog-signals-sort-compare))
10633 (setq sig-list-o (sort (copy-alist sig-list-o) `verilog-signals-sort-compare))
10634 (when (or sig-list-i sig-list-o)
10635 (verilog-insert-indent "// Beginning of automatic assignments from modport\n")
10636 ;; Don't sort them so an upper AUTOINST will match the main module
10637 (let ((sigs sig-list-o))
10638 (while sigs
10639 (verilog-insert-indent "assign " (verilog-sig-name (car sigs))
10640 " = " inst-name
10641 "." (verilog-sig-name (car sigs)) ";\n")
10642 (setq sigs (cdr sigs))))
10643 (let ((sigs sig-list-i))
10644 (while sigs
10645 (verilog-insert-indent "assign " inst-name
10646 "." (verilog-sig-name (car sigs))
10647 " = " (verilog-sig-name (car sigs)) ";\n")
10648 (setq sigs (cdr sigs))))
10649 (verilog-insert-indent "// End of automatics\n")))))))
10650
10351(defun verilog-auto-inst-port-map (port-st) 10651(defun verilog-auto-inst-port-map (port-st)
10352 nil) 10652 nil)
10353 10653
@@ -11067,8 +11367,8 @@ Typing \\[verilog-auto] will make this into:
11067 (verilog-subdecls-get-interfaced modsubdecls) 11367 (verilog-subdecls-get-interfaced modsubdecls)
11068 (verilog-subdecls-get-outputs modsubdecls) 11368 (verilog-subdecls-get-outputs modsubdecls)
11069 (verilog-subdecls-get-inouts modsubdecls))))) 11369 (verilog-subdecls-get-inouts modsubdecls)))))
11070 (forward-line 1)
11071 (when sig-list 11370 (when sig-list
11371 (verilog-forward-or-insert-line)
11072 (verilog-insert-indent "// Beginning of automatic regs (for this module's undeclared outputs)\n") 11372 (verilog-insert-indent "// Beginning of automatic regs (for this module's undeclared outputs)\n")
11073 (verilog-insert-definition modi sig-list "reg" indent-pt nil) 11373 (verilog-insert-definition modi sig-list "reg" indent-pt nil)
11074 (verilog-insert-indent "// End of automatics\n"))))) 11374 (verilog-insert-indent "// End of automatics\n")))))
@@ -11122,8 +11422,8 @@ Typing \\[verilog-auto] will make this into:
11122 (verilog-subdecls-get-inouts modsubdecls)) 11422 (verilog-subdecls-get-inouts modsubdecls))
11123 (append (verilog-decls-get-signals moddecls) 11423 (append (verilog-decls-get-signals moddecls)
11124 (verilog-decls-get-assigns moddecls)))))) 11424 (verilog-decls-get-assigns moddecls))))))
11125 (forward-line 1)
11126 (when sig-list 11425 (when sig-list
11426 (verilog-forward-or-insert-line)
11127 (verilog-insert-indent "// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)\n") 11427 (verilog-insert-indent "// Beginning of automatic reg inputs (for undeclared instantiated-module inputs)\n")
11128 (verilog-insert-definition modi sig-list "reg" indent-pt nil) 11428 (verilog-insert-definition modi sig-list "reg" indent-pt nil)
11129 (verilog-insert-indent "// End of automatics\n"))))) 11429 (verilog-insert-indent "// End of automatics\n")))))
@@ -11210,8 +11510,8 @@ Typing \\[verilog-auto] will make this into:
11210 (append (verilog-subdecls-get-outputs modsubdecls) 11510 (append (verilog-subdecls-get-outputs modsubdecls)
11211 (verilog-subdecls-get-inouts modsubdecls)) 11511 (verilog-subdecls-get-inouts modsubdecls))
11212 (verilog-decls-get-signals moddecls))))) 11512 (verilog-decls-get-signals moddecls)))))
11213 (forward-line 1)
11214 (when sig-list 11513 (when sig-list
11514 (verilog-forward-or-insert-line)
11215 (verilog-insert-indent "// Beginning of automatic wires (for undeclared instantiated-module outputs)\n") 11515 (verilog-insert-indent "// Beginning of automatic wires (for undeclared instantiated-module outputs)\n")
11216 (verilog-insert-definition modi sig-list "wire" indent-pt nil) 11516 (verilog-insert-definition modi sig-list "wire" indent-pt nil)
11217 (verilog-insert-indent "// End of automatics\n") 11517 (verilog-insert-indent "// End of automatics\n")
@@ -11221,7 +11521,7 @@ Typing \\[verilog-auto] will make this into:
11221 ;; syntax-ppss which is broken when change hooks are disabled. 11521 ;; syntax-ppss which is broken when change hooks are disabled.
11222 )))) 11522 ))))
11223 11523
11224(defun verilog-auto-output (&optional with-params) 11524(defun verilog-auto-output ()
11225 "Expand AUTOOUTPUT statements, as part of \\[verilog-auto]. 11525 "Expand AUTOOUTPUT statements, as part of \\[verilog-auto].
11226Make output statements for any output signal from an /*AUTOINST*/ that 11526Make output statements for any output signal from an /*AUTOINST*/ that
11227isn't an input to another AUTOINST. This is useful for modules which 11527isn't an input to another AUTOINST. This is useful for modules which
@@ -11273,8 +11573,8 @@ same expansion will result from only extracting outputs starting with ov:
11273 (save-excursion 11573 (save-excursion
11274 ;; Point must be at insertion point. 11574 ;; Point must be at insertion point.
11275 (let* ((indent-pt (current-indentation)) 11575 (let* ((indent-pt (current-indentation))
11276 (regexp (and with-params 11576 (params (verilog-read-auto-params 0 1))
11277 (nth 0 (verilog-read-auto-params 1)))) 11577 (regexp (nth 0 params))
11278 (v2k (verilog-in-paren-quick)) 11578 (v2k (verilog-in-paren-quick))
11279 (modi (verilog-modi-current)) 11579 (modi (verilog-modi-current))
11280 (moddecls (verilog-modi-get-decls modi)) 11580 (moddecls (verilog-modi-get-decls modi))
@@ -11290,7 +11590,7 @@ same expansion will result from only extracting outputs starting with ov:
11290 sig-list regexp))) 11590 sig-list regexp)))
11291 (setq sig-list (verilog-signals-not-matching-regexp 11591 (setq sig-list (verilog-signals-not-matching-regexp
11292 sig-list verilog-auto-output-ignore-regexp)) 11592 sig-list verilog-auto-output-ignore-regexp))
11293 (forward-line 1) 11593 (verilog-forward-or-insert-line)
11294 (when v2k (verilog-repair-open-comma)) 11594 (when v2k (verilog-repair-open-comma))
11295 (when sig-list 11595 (when sig-list
11296 (verilog-insert-indent "// Beginning of automatic outputs (from unused autoinst outputs)\n") 11596 (verilog-insert-indent "// Beginning of automatic outputs (from unused autoinst outputs)\n")
@@ -11340,7 +11640,7 @@ Typing \\[verilog-auto] will make this into:
11340 (verilog-signals-not-in 11640 (verilog-signals-not-in
11341 (verilog-decls-get-signals moddecls) 11641 (verilog-decls-get-signals moddecls)
11342 (verilog-decls-get-ports moddecls))))) 11642 (verilog-decls-get-ports moddecls)))))
11343 (forward-line 1) 11643 (verilog-forward-or-insert-line)
11344 (when v2k (verilog-repair-open-comma)) 11644 (when v2k (verilog-repair-open-comma))
11345 (when sig-list 11645 (when sig-list
11346 (verilog-insert-indent "// Beginning of automatic outputs (every signal)\n") 11646 (verilog-insert-indent "// Beginning of automatic outputs (every signal)\n")
@@ -11348,7 +11648,7 @@ Typing \\[verilog-auto] will make this into:
11348 (verilog-insert-indent "// End of automatics\n")) 11648 (verilog-insert-indent "// End of automatics\n"))
11349 (when v2k (verilog-repair-close-comma))))) 11649 (when v2k (verilog-repair-close-comma)))))
11350 11650
11351(defun verilog-auto-input (&optional with-params) 11651(defun verilog-auto-input ()
11352 "Expand AUTOINPUT statements, as part of \\[verilog-auto]. 11652 "Expand AUTOINPUT statements, as part of \\[verilog-auto].
11353Make input statements for any input signal into an /*AUTOINST*/ that 11653Make input statements for any input signal into an /*AUTOINST*/ that
11354isn't declared elsewhere inside the module. This is useful for modules which 11654isn't declared elsewhere inside the module. This is useful for modules which
@@ -11399,8 +11699,8 @@ same expansion will result from only extracting inputs starting with i:
11399 /*AUTOINPUT(\"^i\")*/" 11699 /*AUTOINPUT(\"^i\")*/"
11400 (save-excursion 11700 (save-excursion
11401 (let* ((indent-pt (current-indentation)) 11701 (let* ((indent-pt (current-indentation))
11402 (regexp (and with-params 11702 (params (verilog-read-auto-params 0 1))
11403 (nth 0 (verilog-read-auto-params 1)))) 11703 (regexp (nth 0 params))
11404 (v2k (verilog-in-paren-quick)) 11704 (v2k (verilog-in-paren-quick))
11405 (modi (verilog-modi-current)) 11705 (modi (verilog-modi-current))
11406 (moddecls (verilog-modi-get-decls modi)) 11706 (moddecls (verilog-modi-get-decls modi))
@@ -11420,7 +11720,7 @@ same expansion will result from only extracting inputs starting with i:
11420 sig-list regexp))) 11720 sig-list regexp)))
11421 (setq sig-list (verilog-signals-not-matching-regexp 11721 (setq sig-list (verilog-signals-not-matching-regexp
11422 sig-list verilog-auto-input-ignore-regexp)) 11722 sig-list verilog-auto-input-ignore-regexp))
11423 (forward-line 1) 11723 (verilog-forward-or-insert-line)
11424 (when v2k (verilog-repair-open-comma)) 11724 (when v2k (verilog-repair-open-comma))
11425 (when sig-list 11725 (when sig-list
11426 (verilog-insert-indent "// Beginning of automatic inputs (from unused autoinst inputs)\n") 11726 (verilog-insert-indent "// Beginning of automatic inputs (from unused autoinst inputs)\n")
@@ -11428,7 +11728,7 @@ same expansion will result from only extracting inputs starting with i:
11428 (verilog-insert-indent "// End of automatics\n")) 11728 (verilog-insert-indent "// End of automatics\n"))
11429 (when v2k (verilog-repair-close-comma))))) 11729 (when v2k (verilog-repair-close-comma)))))
11430 11730
11431(defun verilog-auto-inout (&optional with-params) 11731(defun verilog-auto-inout ()
11432 "Expand AUTOINOUT statements, as part of \\[verilog-auto]. 11732 "Expand AUTOINOUT statements, as part of \\[verilog-auto].
11433Make inout statements for any inout signal in an /*AUTOINST*/ that 11733Make inout statements for any inout signal in an /*AUTOINST*/ that
11434isn't declared elsewhere inside the module. 11734isn't declared elsewhere inside the module.
@@ -11479,8 +11779,8 @@ same expansion will result from only extracting inouts starting with i:
11479 (save-excursion 11779 (save-excursion
11480 ;; Point must be at insertion point. 11780 ;; Point must be at insertion point.
11481 (let* ((indent-pt (current-indentation)) 11781 (let* ((indent-pt (current-indentation))
11482 (regexp (and with-params 11782 (params (verilog-read-auto-params 0 1))
11483 (nth 0 (verilog-read-auto-params 1)))) 11783 (regexp (nth 0 params))
11484 (v2k (verilog-in-paren-quick)) 11784 (v2k (verilog-in-paren-quick))
11485 (modi (verilog-modi-current)) 11785 (modi (verilog-modi-current))
11486 (moddecls (verilog-modi-get-decls modi)) 11786 (moddecls (verilog-modi-get-decls modi))
@@ -11497,7 +11797,7 @@ same expansion will result from only extracting inouts starting with i:
11497 sig-list regexp))) 11797 sig-list regexp)))
11498 (setq sig-list (verilog-signals-not-matching-regexp 11798 (setq sig-list (verilog-signals-not-matching-regexp
11499 sig-list verilog-auto-inout-ignore-regexp)) 11799 sig-list verilog-auto-inout-ignore-regexp))
11500 (forward-line 1) 11800 (verilog-forward-or-insert-line)
11501 (when v2k (verilog-repair-open-comma)) 11801 (when v2k (verilog-repair-open-comma))
11502 (when sig-list 11802 (when sig-list
11503 (verilog-insert-indent "// Beginning of automatic inouts (from unused autoinst inouts)\n") 11803 (verilog-insert-indent "// Beginning of automatic inouts (from unused autoinst inouts)\n")
@@ -11739,6 +12039,225 @@ same expansion will result from only extracting signals starting with i:
11739 /*AUTOINOUTCOMP(\"ExampMain\",\"^i\")*/" 12039 /*AUTOINOUTCOMP(\"ExampMain\",\"^i\")*/"
11740 (verilog-auto-inout-module nil t)) 12040 (verilog-auto-inout-module nil t))
11741 12041
12042(defun verilog-auto-inout-param ()
12043 "Expand AUTOINOUTPARAM statements, as part of \\[verilog-auto].
12044Take input/output/inout statements from the specified module and insert
12045into the current module. This is useful for making null templates and
12046shell modules which need to have identical I/O with another module.
12047Any I/O which are already defined in this module will not be redefined.
12048For the complement of this function, see `verilog-auto-inout-comp',
12049and to make monitors with all inputs, see `verilog-auto-inout-in'.
12050
12051Limitations:
12052 If placed inside the parenthesis of a module declaration, it creates
12053 Verilog 2001 style, else uses Verilog 1995 style.
12054
12055 Concatenation and outputting partial buses is not supported.
12056
12057 Module names must be resolvable to filenames. See `verilog-auto-inst'.
12058
12059 Signals are not inserted in the same order as in the original module,
12060 though they will appear to be in the same order to an AUTOINST
12061 instantiating either module.
12062
12063 Signals declared as \"output reg\" or \"output wire\" etc will
12064 lose the wire/reg declaration so that shell modules may
12065 generate those outputs differently. However, \"output logic\"
12066 is propagated.
12067
12068An example:
12069
12070 module ExampShell (/*AUTOARG*/);
12071 /*AUTOINOUTMODULE(\"ExampMain\")*/
12072 endmodule
12073
12074 module ExampMain (i,o,io);
12075 input i;
12076 output o;
12077 inout io;
12078 endmodule
12079
12080Typing \\[verilog-auto] will make this into:
12081
12082 module ExampShell (/*AUTOARG*/i,o,io);
12083 /*AUTOINOUTMODULE(\"ExampMain\")*/
12084 // Beginning of automatic in/out/inouts (from specific module)
12085 output o;
12086 inout io;
12087 input i;
12088 // End of automatics
12089 endmodule
12090
12091You may also provide an optional regular expression, in which case only
12092signals matching the regular expression will be included. For example the
12093same expansion will result from only extracting signals starting with i:
12094
12095 /*AUTOINOUTMODULE(\"ExampMain\",\"^i\")*/
12096
12097You may also provide an optional second regular expression, in
12098which case only signals which have that pin direction and data
12099type will be included. This matches against everything before
12100the signal name in the declaration, for example against
12101\"input\" (single bit), \"output logic\" (direction and type) or
12102\"output [1:0]\" (direction and implicit type). You also
12103probably want to skip spaces in your regexp.
12104
12105For example, the below will result in matching the output \"o\"
12106against the previous example's module:
12107
12108 /*AUTOINOUTMODULE(\"ExampMain\",\"\",\"^output.*\")*/
12109
12110You may also provide an optional third regular expression, in
12111which case any parameter names that match the given regexp will
12112be included. Including parameters is off by default. To include
12113all signals and parameters, use:
12114
12115 /*AUTOINOUTMODULE(\"ExampMain\",\".*\",\".*\",\".*\")*/"
12116 (save-excursion
12117 (let* ((params (verilog-read-auto-params 1 2))
12118 (submod (nth 0 params))
12119 (regexp (nth 1 params))
12120 submodi)
12121 ;; Lookup position, etc of co-module
12122 ;; Note this may raise an error
12123 (when (setq submodi (verilog-modi-lookup submod t))
12124 (let* ((indent-pt (current-indentation))
12125 (v2k (verilog-in-paren-quick))
12126 (modi (verilog-modi-current))
12127 (moddecls (verilog-modi-get-decls modi))
12128 (submoddecls (verilog-modi-get-decls submodi))
12129 (sig-list-p (verilog-signals-not-in
12130 (verilog-decls-get-gparams submoddecls)
12131 (append (verilog-decls-get-gparams moddecls)))))
12132 (forward-line 1)
12133 (setq sig-list-p (verilog-signals-matching-regexp sig-list-p regexp))
12134 (when v2k (verilog-repair-open-comma))
12135 (when sig-list-p
12136 (verilog-insert-indent "// Beginning of automatic parameters (from specific module)\n")
12137 ;; Don't sort them so an upper AUTOINST will match the main module
12138 (verilog-insert-definition modi sig-list-p "parameter" indent-pt v2k t)
12139 (verilog-insert-indent "// End of automatics\n"))
12140 (when v2k (verilog-repair-close-comma)))))))
12141
12142(defun verilog-auto-inout-modport ()
12143 "Expand AUTOINOUTMODPORT statements, as part of \\[verilog-auto].
12144Take input/output/inout statements from the specified interface
12145and modport and insert into the current module. This is useful
12146for making verification modules that connect to UVM interfaces.
12147
12148 The first parameter is the name of an interface.
12149
12150 The second parameter is a regexp of modports to read from in
12151 that interface.
12152
12153 The optional third parameter is a regular expression, and only
12154 signals matching the regular expression will be included.
12155
12156Limitations:
12157 If placed inside the parenthesis of a module declaration, it creates
12158 Verilog 2001 style, else uses Verilog 1995 style.
12159
12160 Interface names must be resolvable to filenames. See `verilog-auto-inst'.
12161
12162As with other autos, any inputs/outputs declared in the module
12163will suppress the AUTO from redeclarating an inputs/outputs by
12164the same name.
12165
12166An example:
12167
12168 interface ExampIf
12169 ( input logic clk );
12170 logic req_val;
12171 logic [7:0] req_dat;
12172 clocking mon_clkblk @(posedge clk);
12173 input req_val;
12174 input req_dat;
12175 endclocking
12176 modport mp(clocking mon_clkblk);
12177 endinterface
12178
12179 module ExampMain
12180 ( input clk,
12181 /*AUTOINOUTMODPORT(\"ExampIf\" \"mp\")*/
12182 // Beginning of automatic in/out/inouts (from modport)
12183 input [7:0] req_dat,
12184 input req_val
12185 // End of automatics
12186 );
12187 /*AUTOASSIGNMODPORT(\"ExampIf\" \"mp\")*/
12188 endmodule
12189
12190Typing \\[verilog-auto] will make this into:
12191
12192 ...
12193 module ExampMain
12194 ( input clk,
12195 /*AUTOINOUTMODPORT(\"ExampIf\" \"mp\")*/
12196 // Beginning of automatic in/out/inouts (from modport)
12197 input req_dat,
12198 input req_val
12199 // End of automatics
12200 );
12201
12202If the modport is part of a UVM monitor/driver class, this
12203creates a wrapper module that may be used to instantiate the
12204driver/monitor using AUTOINST in the testbench."
12205 (save-excursion
12206 (let* ((params (verilog-read-auto-params 2 3))
12207 (submod (nth 0 params))
12208 (modport-re (nth 1 params))
12209 (regexp (nth 2 params))
12210 direction-re submodi) ;; direction argument not supported until requested
12211 ;; Lookup position, etc of co-module
12212 ;; Note this may raise an error
12213 (when (setq submodi (verilog-modi-lookup submod t))
12214 (let* ((indent-pt (current-indentation))
12215 (v2k (verilog-in-paren-quick))
12216 (modi (verilog-modi-current))
12217 (moddecls (verilog-modi-get-decls modi))
12218 (submoddecls (verilog-modi-get-decls submodi))
12219 (submodportdecls (verilog-modi-modport-lookup submodi modport-re))
12220 (sig-list-i (verilog-signals-in ;; Decls doesn't have data types, must resolve
12221 (verilog-decls-get-vars submoddecls)
12222 (verilog-signals-not-in
12223 (verilog-decls-get-inputs submodportdecls)
12224 (append (verilog-decls-get-ports submoddecls)
12225 (verilog-decls-get-ports moddecls)))))
12226 (sig-list-o (verilog-signals-in ;; Decls doesn't have data types, must resolve
12227 (verilog-decls-get-vars submoddecls)
12228 (verilog-signals-not-in
12229 (verilog-decls-get-outputs submodportdecls)
12230 (append (verilog-decls-get-ports submoddecls)
12231 (verilog-decls-get-ports moddecls)))))
12232 (sig-list-io (verilog-signals-in ;; Decls doesn't have data types, must resolve
12233 (verilog-decls-get-vars submoddecls)
12234 (verilog-signals-not-in
12235 (verilog-decls-get-inouts submodportdecls)
12236 (append (verilog-decls-get-ports submoddecls)
12237 (verilog-decls-get-ports moddecls))))))
12238 (forward-line 1)
12239 (setq sig-list-i (verilog-signals-edit-wire-reg
12240 (verilog-signals-matching-dir-re
12241 (verilog-signals-matching-regexp sig-list-i regexp)
12242 "input" direction-re))
12243 sig-list-o (verilog-signals-edit-wire-reg
12244 (verilog-signals-matching-dir-re
12245 (verilog-signals-matching-regexp sig-list-o regexp)
12246 "output" direction-re))
12247 sig-list-io (verilog-signals-edit-wire-reg
12248 (verilog-signals-matching-dir-re
12249 (verilog-signals-matching-regexp sig-list-io regexp)
12250 "inout" direction-re)))
12251 (when v2k (verilog-repair-open-comma))
12252 (when (or sig-list-i sig-list-o sig-list-io)
12253 (verilog-insert-indent "// Beginning of automatic in/out/inouts (from modport)\n")
12254 ;; Don't sort them so an upper AUTOINST will match the main module
12255 (verilog-insert-definition modi sig-list-o "output" indent-pt v2k t)
12256 (verilog-insert-definition modi sig-list-io "inout" indent-pt v2k t)
12257 (verilog-insert-definition modi sig-list-i "input" indent-pt v2k t)
12258 (verilog-insert-indent "// End of automatics\n"))
12259 (when v2k (verilog-repair-close-comma)))))))
12260
11742(defun verilog-auto-insert-lisp () 12261(defun verilog-auto-insert-lisp ()
11743 "Expand AUTOINSERTLISP statements, as part of \\[verilog-auto]. 12262 "Expand AUTOINSERTLISP statements, as part of \\[verilog-auto].
11744The Lisp code provided is called, and the Lisp code calls 12263The Lisp code provided is called, and the Lisp code calls
@@ -11789,7 +12308,7 @@ text:
11789 (backward-sexp 1) ;; Inside comment 12308 (backward-sexp 1) ;; Inside comment
11790 (point))) ;; Beginning paren 12309 (point))) ;; Beginning paren
11791 (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt))) 12310 (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt)))
11792 (forward-line 1) 12311 (verilog-forward-or-insert-line)
11793 ;; Some commands don't move point (like insert-file) so we always 12312 ;; Some commands don't move point (like insert-file) so we always
11794 ;; add the begin/end comments, then delete it if not needed 12313 ;; add the begin/end comments, then delete it if not needed
11795 (verilog-insert-indent "// Beginning of automatic insert lisp\n") 12314 (verilog-insert-indent "// Beginning of automatic insert lisp\n")
@@ -12042,6 +12561,7 @@ value's width is generated.
12042An example of making a stub for another module: 12561An example of making a stub for another module:
12043 12562
12044 module ExampStub (/*AUTOINST*/); 12563 module ExampStub (/*AUTOINST*/);
12564 /*AUTOINOUTPARAM(\"Foo\")*/
12045 /*AUTOINOUTMODULE(\"Foo\")*/ 12565 /*AUTOINOUTMODULE(\"Foo\")*/
12046 /*AUTOTIEOFF*/ 12566 /*AUTOTIEOFF*/
12047 // verilator lint_off UNUSED 12567 // verilator lint_off UNUSED
@@ -12054,6 +12574,7 @@ An example of making a stub for another module:
12054Typing \\[verilog-auto] will make this into: 12574Typing \\[verilog-auto] will make this into:
12055 12575
12056 module ExampStub (/*AUTOINST*/...); 12576 module ExampStub (/*AUTOINST*/...);
12577 /*AUTOINOUTPARAM(\"Foo\")*/
12057 /*AUTOINOUTMODULE(\"Foo\")*/ 12578 /*AUTOINOUTMODULE(\"Foo\")*/
12058 // Beginning of autotieoff 12579 // Beginning of autotieoff
12059 output [2:0] foo; 12580 output [2:0] foo;
@@ -12084,7 +12605,7 @@ Typing \\[verilog-auto] will make this into:
12084 (setq sig-list (verilog-signals-not-matching-regexp 12605 (setq sig-list (verilog-signals-not-matching-regexp
12085 sig-list verilog-auto-tieoff-ignore-regexp)) 12606 sig-list verilog-auto-tieoff-ignore-regexp))
12086 (when sig-list 12607 (when sig-list
12087 (forward-line 1) 12608 (verilog-forward-or-insert-line)
12088 (verilog-insert-indent "// Beginning of automatic tieoffs (for this module's unterminated outputs)\n") 12609 (verilog-insert-indent "// Beginning of automatic tieoffs (for this module's unterminated outputs)\n")
12089 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare)) 12610 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare))
12090 (verilog-modi-cache-add-vars modi sig-list) ; Before we trash list 12611 (verilog-modi-cache-add-vars modi sig-list) ; Before we trash list
@@ -12161,7 +12682,7 @@ defines the regular expression will be undefed."
12161 ;; Insert 12682 ;; Insert
12162 (setq defs (sort defs 'string<)) 12683 (setq defs (sort defs 'string<))
12163 (when defs 12684 (when defs
12164 (forward-line 1) 12685 (verilog-forward-or-insert-line)
12165 (verilog-insert-indent "// Beginning of automatic undefs\n") 12686 (verilog-insert-indent "// Beginning of automatic undefs\n")
12166 (while defs 12687 (while defs
12167 (verilog-insert-indent "`undef " (car defs) "\n") 12688 (verilog-insert-indent "`undef " (car defs) "\n")
@@ -12198,6 +12719,7 @@ You can add signals you do not want included in AUTOUNUSED with
12198An example of making a stub for another module: 12719An example of making a stub for another module:
12199 12720
12200 module ExampStub (/*AUTOINST*/); 12721 module ExampStub (/*AUTOINST*/);
12722 /*AUTOINOUTPARAM(\"Examp\")*/
12201 /*AUTOINOUTMODULE(\"Examp\")*/ 12723 /*AUTOINOUTMODULE(\"Examp\")*/
12202 /*AUTOTIEOFF*/ 12724 /*AUTOTIEOFF*/
12203 // verilator lint_off UNUSED 12725 // verilator lint_off UNUSED
@@ -12236,7 +12758,7 @@ Typing \\[verilog-auto] will make this into:
12236 (setq sig-list (verilog-signals-not-matching-regexp 12758 (setq sig-list (verilog-signals-not-matching-regexp
12237 sig-list verilog-auto-unused-ignore-regexp)) 12759 sig-list verilog-auto-unused-ignore-regexp))
12238 (when sig-list 12760 (when sig-list
12239 (forward-line 1) 12761 (verilog-forward-or-insert-line)
12240 (verilog-insert-indent "// Beginning of automatic unused inputs\n") 12762 (verilog-insert-indent "// Beginning of automatic unused inputs\n")
12241 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare)) 12763 (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare))
12242 (while sig-list 12764 (while sig-list
@@ -12335,10 +12857,7 @@ Typing \\[verilog-auto] will make this into:
12335 ;; 12857 ;;
12336 (sig-list-consts (append (verilog-decls-get-consts moddecls) 12858 (sig-list-consts (append (verilog-decls-get-consts moddecls)
12337 (verilog-decls-get-gparams moddecls))) 12859 (verilog-decls-get-gparams moddecls)))
12338 (sig-list-all (append (verilog-decls-get-vars moddecls) 12860 (sig-list-all (verilog-decls-get-iovars moddecls))
12339 (verilog-decls-get-outputs moddecls)
12340 (verilog-decls-get-inouts moddecls)
12341 (verilog-decls-get-inputs moddecls)))
12342 ;; 12861 ;;
12343 (undecode-sig (or (assoc undecode-name sig-list-all) 12862 (undecode-sig (or (assoc undecode-name sig-list-all)
12344 (error "%s: Signal %s not found in design" (verilog-point-text) undecode-name))) 12863 (error "%s: Signal %s not found in design" (verilog-point-text) undecode-name)))
@@ -12371,7 +12890,7 @@ Typing \\[verilog-auto] will make this into:
12371 elim-regexp))) 12890 elim-regexp)))
12372 tmp-sigs (cdr tmp-sigs)))) 12891 tmp-sigs (cdr tmp-sigs))))
12373 ;; 12892 ;;
12374 (forward-line 1) 12893 (verilog-forward-or-insert-line)
12375 (verilog-insert-indent "// Beginning of automatic ASCII enum decoding\n") 12894 (verilog-insert-indent "// Beginning of automatic ASCII enum decoding\n")
12376 (let ((decode-sig-list (list (list ascii-name (format "[%d:0]" (- (* ascii-chars 8) 1)) 12895 (let ((decode-sig-list (list (list ascii-name (format "[%d:0]" (- (* ascii-chars 8) 1))
12377 (concat "Decode of " undecode-name) nil nil)))) 12896 (concat "Decode of " undecode-name) nil nil))))
@@ -12506,9 +13025,12 @@ Or check if AUTOs have the same expansion
12506Using \\[describe-function], see also: 13025Using \\[describe-function], see also:
12507 `verilog-auto-arg' for AUTOARG module instantiations 13026 `verilog-auto-arg' for AUTOARG module instantiations
12508 `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding 13027 `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding
13028 `verilog-auto-assign-modport' for AUTOASSIGNMODPORT assignment to/from modport
12509 `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o 13029 `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o
12510 `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o 13030 `verilog-auto-inout-in' for AUTOINOUTIN inputs for all i/o
13031 `verilog-auto-inout-modport' for AUTOINOUTMODPORT i/o from an interface modport
12511 `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere 13032 `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere
13033 `verilog-auto-inout-param' for AUTOINOUTPARAM copying params from elsewhere
12512 `verilog-auto-inout' for AUTOINOUT making hierarchy inouts 13034 `verilog-auto-inout' for AUTOINOUT making hierarchy inouts
12513 `verilog-auto-input' for AUTOINPUT making hierarchy inputs 13035 `verilog-auto-input' for AUTOINPUT making hierarchy inputs
12514 `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function 13036 `verilog-auto-insert-lisp' for AUTOINSERTLISP insert code from lisp function
@@ -12598,27 +13120,24 @@ Wilson Snyder (wsnyder@wsnyder.org)."
12598 (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense) 13120 (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense)
12599 (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset) 13121 (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset)
12600 ;; Must be done before autoin/out as creates a reg 13122 ;; Must be done before autoin/out as creates a reg
12601 (verilog-auto-re-search-do "/\\*AUTOASCIIENUM([^)]*)\\*/" 'verilog-auto-ascii-enum) 13123 (verilog-auto-re-search-do "/\\*AUTOASCIIENUM(.*?)\\*/" 'verilog-auto-ascii-enum)
12602 ;; 13124 ;;
12603 ;; first in/outs from other files 13125 ;; first in/outs from other files
12604 (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 'verilog-auto-inout-module) 13126 (verilog-auto-re-search-do "/\\*AUTOINOUTMODPORT(.*?)\\*/" 'verilog-auto-inout-modport)
12605 (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP([^)]*)\\*/" 'verilog-auto-inout-comp) 13127 (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE(.*?)\\*/" 'verilog-auto-inout-module)
12606 (verilog-auto-re-search-do "/\\*AUTOINOUTIN([^)]*)\\*/" 'verilog-auto-inout-in) 13128 (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP(.*?)\\*/" 'verilog-auto-inout-comp)
13129 (verilog-auto-re-search-do "/\\*AUTOINOUTIN(.*?)\\*/" 'verilog-auto-inout-in)
13130 (verilog-auto-re-search-do "/\\*AUTOINOUTPARAM(.*?)\\*/" 'verilog-auto-inout-param)
12607 ;; next in/outs which need previous sucked inputs first 13131 ;; next in/outs which need previous sucked inputs first
12608 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/" 13132 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((.*?)\\)?\\*/" 'verilog-auto-output)
12609 (lambda () (verilog-auto-output t))) 13133 (verilog-auto-re-search-do "/\\*AUTOINPUT\\((.*?)\\)?\\*/" 'verilog-auto-input)
12610 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\*/" 'verilog-auto-output) 13134 (verilog-auto-re-search-do "/\\*AUTOINOUT\\((.*?)\\)?\\*/" 'verilog-auto-inout)
12611 (verilog-auto-re-search-do "/\\*AUTOINPUT\\((\"[^\"]*\")\\)\\*/"
12612 (lambda () (verilog-auto-input t)))
12613 (verilog-auto-re-search-do "/\\*AUTOINPUT\\*/" 'verilog-auto-input)
12614 (verilog-auto-re-search-do "/\\*AUTOINOUT\\((\"[^\"]*\")\\)\\*/"
12615 (lambda () (verilog-auto-inout t)))
12616 (verilog-auto-re-search-do "/\\*AUTOINOUT\\*/" 'verilog-auto-inout)
12617 ;; Then tie off those in/outs 13135 ;; Then tie off those in/outs
12618 (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff) 13136 (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff)
12619 ;; These can be anywhere after AUTOINSERTLISP 13137 ;; These can be anywhere after AUTOINSERTLISP
12620 (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((\"[^\"]*\")\\)?\\*/" 'verilog-auto-undef) 13138 (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((.*?)\\)?\\*/" 'verilog-auto-undef)
12621 ;; Wires/regs must be after inputs/outputs 13139 ;; Wires/regs must be after inputs/outputs
13140 (verilog-auto-re-search-do "/\\*AUTOASSIGNMODPORT(.*?)\\*/" 'verilog-auto-assign-modport)
12622 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic) 13141 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic)
12623 (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire) 13142 (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire)
12624 (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg) 13143 (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg)
@@ -12696,7 +13215,7 @@ Wilson Snyder (wsnyder@wsnyder.org)."
12696;; 13215;;
12697;; Place the templates into Verilog Mode. They may be inserted under any key. 13216;; Place the templates into Verilog Mode. They may be inserted under any key.
12698;; C-c C-t will be the default. If you use templates a lot, you 13217;; C-c C-t will be the default. If you use templates a lot, you
12699;; may want to consider moving the binding to another key in your .emacs 13218;; may want to consider moving the binding to another key in your init
12700;; file. 13219;; file.
12701;; 13220;;
12702;; Note \C-c and letter are reserved for users 13221;; Note \C-c and letter are reserved for users