aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorWilson Snyder2014-03-25 20:18:47 -0700
committerGlenn Morris2014-03-25 20:18:47 -0700
commit511df08c33c81bb4990e36102475e7596c4c5319 (patch)
treee2f2995baa460d287c26cf539d43a7d8d98d6e62 /lisp
parentb4aca021760fc3a3c4f20a3c01a734246f49ef6f (diff)
downloademacs-511df08c33c81bb4990e36102475e7596c4c5319.tar.gz
emacs-511df08c33c81bb4990e36102475e7596c4c5319.zip
Sync with upstream verilog-mode revision 702457d
* lisp/progmodes/verilog-mode.el (verilog-mode-version): Update. (create-lockfiles): Declare. (verilog-read-decls): Fix module header imports, bug709. Reported by Victor Lau. Fix parsing 'var' in AUTOs, msg1294. Reported by Dominique Chen. (verilog-auto-inout-module): Fix AUTOINOUTMODULE not inserting interface-only modules, bug721. Reported by Dean Hoyt.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/progmodes/verilog-mode.el100
2 files changed, 66 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c9f6e710665..0f76011a254 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12014-03-26 Wilson Snyder <wsnyder@wsnyder.org>
2
3 Sync with upstream verilog-mode revision 702457d.
4 * progmodes/verilog-mode.el (verilog-mode-version): Update.
5 (create-lockfiles): Declare.
6 (verilog-read-decls): Fix module header imports, bug709.
7 Reported by Victor Lau.
8 Fix parsing 'var' in AUTOs, msg1294. Reported by Dominique Chen.
9 (verilog-auto-inout-module): Fix AUTOINOUTMODULE not inserting
10 interface-only modules, bug721. Reported by Dean Hoyt.
11
12014-03-26 Glenn Morris <rgm@gnu.org> 122014-03-26 Glenn Morris <rgm@gnu.org>
2 13
3 * obsolete/gulp.el: Move here from emacs-lisp/. 14 * obsolete/gulp.el: Move here from emacs-lisp/.
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index ee5f8cb046b..b07e2ba5203 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -123,7 +123,7 @@
123;;; Code: 123;;; Code:
124 124
125;; This variable will always hold the version number of the mode 125;; This variable will always hold the version number of the mode
126(defconst verilog-mode-version "2013-11-05-78e66ba-vpo" 126(defconst verilog-mode-version "2014-03-15-702457d-vpo"
127 "Version of this Verilog mode.") 127 "Version of this Verilog mode.")
128(defconst verilog-mode-release-emacs t 128(defconst verilog-mode-release-emacs t
129 "If non-nil, this version of Verilog mode was released with Emacs itself.") 129 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -1634,7 +1634,7 @@ will break, as the o's continuously replace. xa -> x works ok though."
1634 string)) 1634 string))
1635 1635
1636(defsubst verilog-re-search-forward (REGEXP BOUND NOERROR) 1636(defsubst verilog-re-search-forward (REGEXP BOUND NOERROR)
1637 ; checkdoc-params: (REGEXP BOUND NOERROR) 1637 ;; checkdoc-params: (REGEXP BOUND NOERROR)
1638 "Like `re-search-forward', but skips over match in comments or strings." 1638 "Like `re-search-forward', but skips over match in comments or strings."
1639 (let ((mdata '(nil nil))) ;; So match-end will return nil if no matches found 1639 (let ((mdata '(nil nil))) ;; So match-end will return nil if no matches found
1640 (while (and 1640 (while (and
@@ -1650,7 +1650,7 @@ will break, as the o's continuously replace. xa -> x works ok though."
1650 (match-end 0))) 1650 (match-end 0)))
1651 1651
1652(defsubst verilog-re-search-backward (REGEXP BOUND NOERROR) 1652(defsubst verilog-re-search-backward (REGEXP BOUND NOERROR)
1653 ; checkdoc-params: (REGEXP BOUND NOERROR) 1653 ;; checkdoc-params: (REGEXP BOUND NOERROR)
1654 "Like `re-search-backward', but skips over match in comments or strings." 1654 "Like `re-search-backward', but skips over match in comments or strings."
1655 (let ((mdata '(nil nil))) ;; So match-end will return nil if no matches found 1655 (let ((mdata '(nil nil))) ;; So match-end will return nil if no matches found
1656 (while (and 1656 (while (and
@@ -1679,7 +1679,7 @@ so there may be a large up front penalty for the first search."
1679 pt)) 1679 pt))
1680 1680
1681(defsubst verilog-re-search-backward-quick (regexp bound noerror) 1681(defsubst verilog-re-search-backward-quick (regexp bound noerror)
1682 ; checkdoc-params: (REGEXP BOUND NOERROR) 1682 ;; checkdoc-params: (REGEXP BOUND NOERROR)
1683 "Like `verilog-re-search-backward', including use of REGEXP BOUND and NOERROR, 1683 "Like `verilog-re-search-backward', including use of REGEXP BOUND and NOERROR,
1684but trashes match data and is faster for REGEXP that doesn't match often. 1684but trashes match data and is faster for REGEXP that doesn't match often.
1685This uses `verilog-scan' and text properties to ignore comments, 1685This uses `verilog-scan' and text properties to ignore comments,
@@ -1748,6 +1748,7 @@ To call on \\[verilog-auto], set `verilog-auto-delete-trailing-whitespace'."
1748 (unless (bolp) (insert "\n")))) 1748 (unless (bolp) (insert "\n"))))
1749 1749
1750(defvar compile-command) 1750(defvar compile-command)
1751(defvar create-lockfiles) ;; Emacs 24
1751 1752
1752;; compilation program 1753;; compilation program
1753(defun verilog-set-compile-command () 1754(defun verilog-set-compile-command ()
@@ -2788,8 +2789,8 @@ find the errors."
2788 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak" 2789 "sync_reject_on" "unique0" "until" "until_with" "untyped" "weak"
2789 ;; 1800-2012 2790 ;; 1800-2012
2790 "implements" "interconnect" "nettype" "soft" 2791 "implements" "interconnect" "nettype" "soft"
2791 ) 2792 )
2792 "List of Verilog keywords.") 2793 "List of Verilog keywords.")
2793 2794
2794(defconst verilog-comment-start-regexp "//\\|/\\*" 2795(defconst verilog-comment-start-regexp "//\\|/\\*"
2795 "Dual comment value for `comment-start-regexp'.") 2796 "Dual comment value for `comment-start-regexp'.")
@@ -3332,9 +3333,9 @@ Use filename, if current buffer being edited shorten to just buffer name."
3332 (verilog-re-search-backward reg nil 'move)) 3333 (verilog-re-search-backward reg nil 'move))
3333 (cond 3334 (cond
3334 ((match-end 1) ; matched verilog-end-block-re 3335 ((match-end 1) ; matched verilog-end-block-re
3335 ; try to leap back to matching outward block by striding across 3336 ;; try to leap back to matching outward block by striding across
3336 ; indent level changing tokens then immediately 3337 ;; indent level changing tokens then immediately
3337 ; previous line governs indentation. 3338 ;; previous line governs indentation.
3338 (verilog-leap-to-head)) 3339 (verilog-leap-to-head))
3339 ((match-end 2) ; else, we're in deep 3340 ((match-end 2) ; else, we're in deep
3340 (setq elsec (1+ elsec))) 3341 (setq elsec (1+ elsec)))
@@ -3992,7 +3993,7 @@ This puts the mark at the end, and point at the beginning."
3992 (mark-defun))) 3993 (mark-defun)))
3993 3994
3994(defun verilog-comment-region (start end) 3995(defun verilog-comment-region (start end)
3995 ; checkdoc-params: (start end) 3996 ;; checkdoc-params: (start end)
3996 "Put the region into a Verilog comment. 3997 "Put the region into a Verilog comment.
3997The comments that are in this area are \"deformed\": 3998The comments that are in this area are \"deformed\":
3998`*)' becomes `!(*' and `}' becomes `!{'. 3999`*)' becomes `!(*' and `}' becomes `!{'.
@@ -4223,7 +4224,7 @@ Uses `verilog-scan' cache."
4223 ((equal (char-after) ?\}) 4224 ((equal (char-after) ?\})
4224 (forward-char)) 4225 (forward-char))
4225 4226
4226 ;; Skip to end of statement 4227 ;; Skip to end of statement
4227 ((condition-case nil 4228 ((condition-case nil
4228 (setq pos 4229 (setq pos
4229 (catch 'found 4230 (catch 'found
@@ -4285,7 +4286,7 @@ More specifically, point @ in the line foo : @ begin"
4285 (setq nest (1+ nest))) 4286 (setq nest (1+ nest)))
4286 ((match-end 2) 4287 ((match-end 2)
4287 (if (= nest 1) 4288 (if (= nest 1)
4288 (throw 'found 1)) 4289 (throw 'found 1))
4289 (setq nest (1- nest))) 4290 (setq nest (1- nest)))
4290 (t 4291 (t
4291 (throw 'found (= nest 0))))))) 4292 (throw 'found (= nest 0)))))))
@@ -4430,6 +4431,7 @@ Limit search to point LIM."
4430 "\\(`ifdef\\>\\)\\|" 4431 "\\(`ifdef\\>\\)\\|"
4431 "\\(`ifndef\\>\\)\\|" 4432 "\\(`ifndef\\>\\)\\|"
4432 "\\(`elsif\\>\\)")) 4433 "\\(`elsif\\>\\)"))
4434
4433(defun verilog-set-auto-endcomments (indent-str kill-existing-comment) 4435(defun verilog-set-auto-endcomments (indent-str kill-existing-comment)
4434 "Add ending comment with given INDENT-STR. 4436 "Add ending comment with given INDENT-STR.
4435With KILL-EXISTING-COMMENT, remove what was there before. 4437With KILL-EXISTING-COMMENT, remove what was there before.
@@ -5078,13 +5080,13 @@ FILENAME to find directory to run in, or defaults to `buffer-file-name`."
5078 (list 5080 (list
5079 (let ((default (verilog-expand-command verilog-preprocessor))) 5081 (let ((default (verilog-expand-command verilog-preprocessor)))
5080 (set (make-local-variable `verilog-preprocessor) 5082 (set (make-local-variable `verilog-preprocessor)
5081 (read-from-minibuffer "Run Preprocessor (like this): " 5083 (read-from-minibuffer "Run Preprocessor (like this): "
5082 default nil nil 5084 default nil nil
5083 'verilog-preprocess-history default))))) 5085 'verilog-preprocess-history default)))))
5084 (unless command (setq command (verilog-expand-command verilog-preprocessor))) 5086 (unless command (setq command (verilog-expand-command verilog-preprocessor)))
5085 (let* ((fontlocked (and (boundp 'font-lock-mode) font-lock-mode)) 5087 (let* ((fontlocked (and (boundp 'font-lock-mode) font-lock-mode))
5086 (dir (file-name-directory (or filename buffer-file-name))) 5088 (dir (file-name-directory (or filename buffer-file-name)))
5087 (cmd (concat "cd " dir "; " command))) 5089 (cmd (concat "cd " dir "; " command)))
5088 (with-output-to-temp-buffer "*Verilog-Preprocessed*" 5090 (with-output-to-temp-buffer "*Verilog-Preprocessed*"
5089 (with-current-buffer (get-buffer "*Verilog-Preprocessed*") 5091 (with-current-buffer (get-buffer "*Verilog-Preprocessed*")
5090 (insert (concat "// " cmd "\n")) 5092 (insert (concat "// " cmd "\n"))
@@ -5271,7 +5273,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5271 (if (save-excursion (beginning-of-line) 5273 (if (save-excursion (beginning-of-line)
5272 (and (looking-at verilog-directive-re-1) 5274 (and (looking-at verilog-directive-re-1)
5273 (not (or (looking-at "[ \t]*`[ou]vm_") 5275 (not (or (looking-at "[ \t]*`[ou]vm_")
5274 (looking-at "[ \t]*`vmm_"))))) 5276 (looking-at "[ \t]*`vmm_")))))
5275 (throw 'nesting 'directive)) 5277 (throw 'nesting 'directive))
5276 ;; indent structs as if there were module level 5278 ;; indent structs as if there were module level
5277 (setq structres (verilog-in-struct-nested-p)) 5279 (setq structres (verilog-in-struct-nested-p))
@@ -5510,10 +5512,10 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)."
5510 ; endfunction 5512 ; endfunction
5511 (verilog-beg-of-statement) 5513 (verilog-beg-of-statement)
5512 (if (looking-at verilog-beg-block-re-ordered) 5514 (if (looking-at verilog-beg-block-re-ordered)
5513 (throw 'nesting 'block) 5515 (throw 'nesting 'block)
5514 (throw 'nesting 'defun))) 5516 (throw 'nesting 'defun)))
5515 5517
5516 ;; 5518 ;;
5517 ((looking-at "\\<property\\>") 5519 ((looking-at "\\<property\\>")
5518 ; *sigh* 5520 ; *sigh*
5519 ; {assert|assume|cover} property (); are complete 5521 ; {assert|assume|cover} property (); are complete
@@ -5704,7 +5706,7 @@ Jump from end to matching begin, from endcase to matching case, and so on."
5704 (setq sreg reg) 5706 (setq sreg reg)
5705 (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" )) 5707 (setq reg "\\(\\<fork\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))
5706 ))) 5708 )))
5707 ;no nesting 5709 ;; no nesting
5708 (if (and 5710 (if (and
5709 (verilog-re-search-backward reg nil 'move) 5711 (verilog-re-search-backward reg nil 'move)
5710 (match-end 1)) ; task -> could be virtual and/or protected 5712 (match-end 1)) ; task -> could be virtual and/or protected
@@ -6547,10 +6549,9 @@ Be verbose about progress unless optional QUIET set."
6547 endpos (set-marker (make-marker) end) 6549 endpos (set-marker (make-marker) end)
6548 base-ind (progn 6550 base-ind (progn
6549 (goto-char start) 6551 (goto-char start)
6550 (forward-char 1) 6552 (forward-char 1)
6551 (skip-chars-forward " \t") 6553 (skip-chars-forward " \t")
6552 (current-column)) 6554 (current-column)))
6553 )
6554 ;; in a declaration block (not in argument list) 6555 ;; in a declaration block (not in argument list)
6555 (setq 6556 (setq
6556 start (progn 6557 start (progn
@@ -8065,7 +8066,7 @@ Optional NUM-PARAM and MAX-PARAM check for a specific number of parameters."
8065Return an array of [outputs inouts inputs wire reg assign const]." 8066Return an array of [outputs inouts inputs wire reg assign const]."
8066 (let ((end-mod-point (or (verilog-get-end-of-defun) (point-max))) 8067 (let ((end-mod-point (or (verilog-get-end-of-defun) (point-max)))
8067 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t) 8068 (functask 0) (paren 0) (sig-paren 0) (v2kargs-ok t)
8068 in-modport in-clocking ptype ign-prop 8069 in-modport in-clocking in-ign-to-semi ptype ign-prop
8069 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const 8070 sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const
8070 sigs-gparam sigs-intf sigs-modports 8071 sigs-gparam sigs-intf sigs-modports
8071 vec expect-signal keywd newsig rvalue enum io signed typedefed multidim 8072 vec expect-signal keywd newsig rvalue enum io signed typedefed multidim
@@ -8097,19 +8098,24 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8097 (or (re-search-forward "[^\\]\"" nil t) ;; don't forward-char first, since we look for a non backslash first 8098 (or (re-search-forward "[^\\]\"" nil t) ;; don't forward-char first, since we look for a non backslash first
8098 (error "%s: Unmatched quotes, at char %d" (verilog-point-text) (point)))) 8099 (error "%s: Unmatched quotes, at char %d" (verilog-point-text) (point))))
8099 ((eq ?\; (following-char)) 8100 ((eq ?\; (following-char))
8100 (when (and in-modport (not (eq in-modport t))) ;; end of a modport declaration 8101 (cond (in-ign-to-semi ;; Such as inside a "import ...;" in a module header
8101 (verilog-modport-decls-set 8102 (setq in-ign-to-semi nil))
8102 in-modport 8103 ((and in-modport (not (eq in-modport t))) ;; end of a modport declaration
8103 (verilog-decls-new sigs-out sigs-inout sigs-in 8104 (verilog-modport-decls-set
8104 nil nil nil nil nil nil)) 8105 in-modport
8105 ;; Pop from varstack to restore state to pre-clocking 8106 (verilog-decls-new sigs-out sigs-inout sigs-in
8106 (setq tmp (car varstack) 8107 nil nil nil nil nil nil))
8107 varstack (cdr varstack) 8108 ;; Pop from varstack to restore state to pre-clocking
8108 sigs-out (aref tmp 0) 8109 (setq tmp (car varstack)
8109 sigs-inout (aref tmp 1) 8110 varstack (cdr varstack)
8110 sigs-in (aref tmp 2))) 8111 sigs-out (aref tmp 0)
8111 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil 8112 sigs-inout (aref tmp 1)
8112 v2kargs-ok nil in-modport nil ign-prop nil) 8113 sigs-in (aref tmp 2))
8114 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil
8115 v2kargs-ok nil in-modport nil ign-prop nil))
8116 (t
8117 (setq vec nil io nil expect-signal nil newsig nil paren 0 rvalue nil
8118 v2kargs-ok nil in-modport nil ign-prop nil)))
8113 (forward-char 1)) 8119 (forward-char 1))
8114 ((eq ?= (following-char)) 8120 ((eq ?= (following-char))
8115 (setq rvalue t newsig nil) 8121 (setq rvalue t newsig nil)
@@ -8212,8 +8218,12 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8212 (setq in-modport t)) 8218 (setq in-modport t))
8213 ((equal keywd "clocking") 8219 ((equal keywd "clocking")
8214 (setq in-clocking t)) 8220 (setq in-clocking t))
8221 ((equal keywd "import")
8222 (if v2kargs-ok ;; import in module header, not a modport import
8223 (setq in-ign-to-semi t rvalue t)))
8215 ((equal keywd "type") 8224 ((equal keywd "type")
8216 (setq ptype t)) 8225 (setq ptype t))
8226 ((equal keywd "var"))
8217 ;; Ifdef? Ignore name of define 8227 ;; Ifdef? Ignore name of define
8218 ((member keywd '("`ifdef" "`ifndef" "`elsif")) 8228 ((member keywd '("`ifdef" "`ifndef" "`elsif"))
8219 (setq rvalue t)) 8229 (setq rvalue t))
@@ -8285,6 +8295,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8285 (eq functask 0) 8295 (eq functask 0)
8286 (not (member keywd verilog-keywords))) 8296 (not (member keywd verilog-keywords)))
8287 ;; Add new signal to expect-signal's variable 8297 ;; Add new signal to expect-signal's variable
8298 ;;(if dbg (setq dbg (concat dbg (format "Pt %s New sig %s'\n" (point) keywd))))
8288 (setq newsig (verilog-sig-new keywd vec nil nil enum signed typedefed multidim modport)) 8299 (setq newsig (verilog-sig-new keywd vec nil nil enum signed typedefed multidim modport))
8289 (set expect-signal (cons newsig 8300 (set expect-signal (cons newsig
8290 (symbol-value expect-signal)))))) 8301 (symbol-value expect-signal))))))
@@ -9138,7 +9149,7 @@ foo.v (an include file):
9138 `define _FOO_V 9149 `define _FOO_V
9139 ... contents of file 9150 ... contents of file
9140 `endif // _FOO_V" 9151 `endif // _FOO_V"
9141;;slow: (verilog-read-defines nil t)) 9152 ;;slow: (verilog-read-defines nil t)
9142 (save-excursion 9153 (save-excursion
9143 (verilog-getopt-flags) 9154 (verilog-getopt-flags)
9144 (goto-char (point-min)) 9155 (goto-char (point-min))
@@ -9527,7 +9538,7 @@ variables to build the path. With optional CHECK-EXT also check
9527 (setq outlist (cons (expand-file-name 9538 (setq outlist (cons (expand-file-name
9528 fn (file-name-directory current)) 9539 fn (file-name-directory current))
9529 outlist))) 9540 outlist)))
9530 (setq chkexts (cdr chkexts))) 9541 (setq chkexts (cdr chkexts)))
9531 (setq chkdirs (cdr chkdirs))) 9542 (setq chkdirs (cdr chkdirs)))
9532 (setq outlist (nreverse outlist)) 9543 (setq outlist (nreverse outlist))
9533 (setq verilog-dir-cache-lib-filenames 9544 (setq verilog-dir-cache-lib-filenames
@@ -12071,7 +12082,7 @@ against the previous example's module:
12071 (verilog-signals-matching-regexp sig-list-if regexp) 12082 (verilog-signals-matching-regexp sig-list-if regexp)
12072 "interface" direction-re)) 12083 "interface" direction-re))
12073 (when v2k (verilog-repair-open-comma)) 12084 (when v2k (verilog-repair-open-comma))
12074 (when (or sig-list-i sig-list-o sig-list-io) 12085 (when (or sig-list-i sig-list-o sig-list-io sig-list-if)
12075 (verilog-insert-indent "// Beginning of automatic in/out/inouts (from specific module)\n") 12086 (verilog-insert-indent "// Beginning of automatic in/out/inouts (from specific module)\n")
12076 ;; Don't sort them so an upper AUTOINST will match the main module 12087 ;; Don't sort them so an upper AUTOINST will match the main module
12077 (verilog-insert-definition modi sig-list-o "output" indent-pt v2k t) 12088 (verilog-insert-definition modi sig-list-o "output" indent-pt v2k t)
@@ -13538,8 +13549,7 @@ for sensitivity list."
13538 () 13549 ()
13539 > "begin" '(verilog-sk-prompt-name) \n 13550 > "begin" '(verilog-sk-prompt-name) \n
13540 > _ \n 13551 > _ \n
13541 > (- verilog-indent-level-behavioral) "end" 13552 > (- verilog-indent-level-behavioral) "end" )
13542)
13543 13553
13544(define-skeleton verilog-sk-fork 13554(define-skeleton verilog-sk-fork
13545 "Insert a fork join block." 13555 "Insert a fork join block."