aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu2009-11-26 03:18:31 +0000
committerDan Nicolaescu2009-11-26 03:18:31 +0000
commit0e5c8aedd0f967583491004f69a8863099011bed (patch)
tree7a9796e354521e25b44f03e1a4fb2545798ee20b
parent7629c4e74505fcb3d569d5b6fae85e304594986a (diff)
downloademacs-0e5c8aedd0f967583491004f69a8863099011bed.tar.gz
emacs-0e5c8aedd0f967583491004f69a8863099011bed.zip
* verilog-mode.el (verilog-at-struct-p): Support "signed" and
"unsigned" structs. (verilog-leap-to-head, verilog-backward-token): Handle "disable fork" statement better. * verilog-mode.el (verilog-auto-insert-lisp, verilog-delete-auto) (verilog-delete-empty-auto-pair, verilog-library-filenames): Fix AUTOINSERTLISP to support insert-file. Reported by Clay Douglass. (verilog-auto-inst, verilog-auto-star-safe) (verilog-delete-auto-star-implicit, verilog-read-sub-decls): Fix removing "// Interfaces" when saving .* expansions. Reported by Pierre-David Pfister.
-rw-r--r--lisp/ChangeLog19
-rw-r--r--lisp/progmodes/verilog-mode.el94
2 files changed, 76 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e675c4fdd1b..8afcd5b94a0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,22 @@
12009-11-26 Michael McNamara <mac@mail.brushroad.com>
2
3 * verilog-mode.el (verilog-at-struct-p): Support "signed" and
4 "unsigned" structs.
5
6 (verilog-leap-to-head, verilog-backward-token): Handle "disable
7 fork" statement better.
8
92009-11-26 Wilson Snyder <wsnyder@wsnyder.org>
10
11 * verilog-mode.el (verilog-auto-insert-lisp, verilog-delete-auto)
12 (verilog-delete-empty-auto-pair, verilog-library-filenames): Fix
13 AUTOINSERTLISP to support insert-file. Reported by Clay Douglass.
14
15 (verilog-auto-inst, verilog-auto-star-safe)
16 (verilog-delete-auto-star-implicit, verilog-read-sub-decls): Fix
17 removing "// Interfaces" when saving .* expansions. Reported by
18 Pierre-David Pfister.
19
12009-11-26 Glenn Morris <rgm@gnu.org> 202009-11-26 Glenn Morris <rgm@gnu.org>
2 21
3 * eshell/em-dirs.el (eshell/cd): Don't throw to a tag outside the scope. 22 * eshell/em-dirs.el (eshell/cd): Don't throw to a tag outside the scope.
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 8239cdda3a1..e36c53e1844 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -118,9 +118,9 @@
118;;; Code: 118;;; Code:
119 119
120;; This variable will always hold the version number of the mode 120;; This variable will always hold the version number of the mode
121(defconst verilog-mode-version "547" 121(defconst verilog-mode-version "552"
122 "Version of this Verilog mode.") 122 "Version of this Verilog mode.")
123(defconst verilog-mode-release-date "2009-11-05-GNU" 123(defconst verilog-mode-release-date "2009-11-25-GNU"
124 "Release date of this Verilog mode.") 124 "Release date of this Verilog mode.")
125(defconst verilog-mode-release-emacs t 125(defconst verilog-mode-release-emacs t
126 "If non-nil, this version of Verilog mode was released with Emacs itself.") 126 "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -4640,7 +4640,13 @@ Jump from end to matching begin, from endcase to matching case, and so on."
4640 (while (verilog-re-search-backward reg nil 'move) 4640 (while (verilog-re-search-backward reg nil 'move)
4641 (cond 4641 (cond
4642 ((match-end 1) ; begin 4642 ((match-end 1) ; begin
4643 (setq nest (1- nest)) 4643 (if (looking-at "fork")
4644 (let ((here (point)))
4645 (verilog-beg-of-statement)
4646 (unless (looking-at verilog-disable-fork-re)
4647 (goto-char here)
4648 (setq nest (1- nest))))
4649 (setq nest (1- nest)))
4644 (if (= 0 nest) 4650 (if (= 0 nest)
4645 ;; Now previous line describes syntax 4651 ;; Now previous line describes syntax
4646 (throw 'skip 1)) 4652 (throw 'skip 1))
@@ -4760,6 +4766,8 @@ Set point to where line starts."
4760 (;-- any of begin|initial|while are complete statements; 'begin : foo' is also complete 4766 (;-- any of begin|initial|while are complete statements; 'begin : foo' is also complete
4761 t 4767 t
4762 (forward-word -1) 4768 (forward-word -1)
4769 (while (= (preceding-char) ?\_)
4770 (forward-word -1))
4763 (cond 4771 (cond
4764 ((looking-at "\\<else\\>") 4772 ((looking-at "\\<else\\>")
4765 t) 4773 t)
@@ -4971,7 +4979,7 @@ Optional BOUND limits search."
4971 (save-excursion 4979 (save-excursion
4972 (if (and (equal (char-after) ?\{) 4980 (if (and (equal (char-after) ?\{)
4973 (verilog-backward-token)) 4981 (verilog-backward-token))
4974 (looking-at "\\<struct\\|union\\|packed\\>") 4982 (looking-at "\\<struct\\|union\\|packed\\|\\(un\\)?signed\\>")
4975 nil))) 4983 nil)))
4976 4984
4977(defun verilog-parenthesis-depth () 4985(defun verilog-parenthesis-depth ()
@@ -5388,7 +5396,7 @@ Be verbose about progress unless optional QUIET set."
5388 (unless quiet (message "")))))) 5396 (unless quiet (message ""))))))
5389 5397
5390(defun verilog-pretty-expr (&optional quiet myre) 5398(defun verilog-pretty-expr (&optional quiet myre)
5391 "Line up expressions around point, or optional regexp MYRE." 5399 "Line up expressions around point, optionally QUIET with regexp MYRE."
5392 (interactive "sRegular Expression: ((<|:)?=) ") 5400 (interactive "sRegular Expression: ((<|:)?=) ")
5393 (save-excursion 5401 (save-excursion
5394 (if (or (eq myre nil) 5402 (if (or (eq myre nil)
@@ -5661,13 +5669,13 @@ it displays a list of all possible completions.")
5661 "triand" "trior" "trireg" "wand" "wire" "wor" "xnor" "xor" 5669 "triand" "trior" "trireg" "wand" "wire" "wor" "xnor" "xor"
5662 ) 5670 )
5663 "*Keywords for types used when completing a word in a declaration or parmlist. 5671 "*Keywords for types used when completing a word in a declaration or parmlist.
5664\(Eg. integer, real, reg...)") 5672\(integer, real, reg...)")
5665 5673
5666(defvar verilog-cpp-keywords 5674(defvar verilog-cpp-keywords
5667 '("module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else" 5675 '("module" "macromodule" "primitive" "timescale" "define" "ifdef" "ifndef" "else"
5668 "endif") 5676 "endif")
5669 "*Keywords to complete when at first word of a line in declarative scope. 5677 "*Keywords to complete when at first word of a line in declarative scope.
5670\(Eg. initial, always, begin, assign.) 5678\(initial, always, begin, assign...)
5671The procedures and variables defined within the Verilog program 5679The procedures and variables defined within the Verilog program
5672will be completed at runtime and should not be added to this list.") 5680will be completed at runtime and should not be added to this list.")
5673 5681
@@ -5681,7 +5689,7 @@ will be completed at runtime and should not be added to this list.")
5681 ) 5689 )
5682 verilog-type-keywords) 5690 verilog-type-keywords)
5683 "*Keywords to complete when at first word of a line in declarative scope. 5691 "*Keywords to complete when at first word of a line in declarative scope.
5684\(Eg. initial, always, begin, assign.) 5692\(initial, always, begin, assign...)
5685The procedures and variables defined within the Verilog program 5693The procedures and variables defined within the Verilog program
5686will be completed at runtime and should not be added to this list.") 5694will be completed at runtime and should not be added to this list.")
5687 5695
@@ -5692,28 +5700,28 @@ will be completed at runtime and should not be added to this list.")
5692 "for" "fork" "if" "join" "join_any" "join_none" "repeat" "return" 5700 "for" "fork" "if" "join" "join_any" "join_none" "repeat" "return"
5693 "while") 5701 "while")
5694 "*Keywords to complete when at first word of a line in behavioral scope. 5702 "*Keywords to complete when at first word of a line in behavioral scope.
5695\(Eg. begin, if, then, else, for, fork.) 5703\(begin, if, then, else, for, fork...)
5696The procedures and variables defined within the Verilog program 5704The procedures and variables defined within the Verilog program
5697will be completed at runtime and should not be added to this list.") 5705will be completed at runtime and should not be added to this list.")
5698 5706
5699(defvar verilog-tf-keywords 5707(defvar verilog-tf-keywords
5700 '("begin" "break" "fork" "join" "join_any" "join_none" "case" "end" "endtask" "endfunction" "if" "else" "for" "while" "repeat") 5708 '("begin" "break" "fork" "join" "join_any" "join_none" "case" "end" "endtask" "endfunction" "if" "else" "for" "while" "repeat")
5701 "*Keywords to complete when at first word of a line in a task or function. 5709 "*Keywords to complete when at first word of a line in a task or function.
5702\(Eg. begin, if, then, else, for, fork.) 5710\(begin, if, then, else, for, fork.)
5703The procedures and variables defined within the Verilog program 5711The procedures and variables defined within the Verilog program
5704will be completed at runtime and should not be added to this list.") 5712will be completed at runtime and should not be added to this list.")
5705 5713
5706(defvar verilog-case-keywords 5714(defvar verilog-case-keywords
5707 '("begin" "fork" "join" "join_any" "join_none" "case" "end" "endcase" "if" "else" "for" "repeat") 5715 '("begin" "fork" "join" "join_any" "join_none" "case" "end" "endcase" "if" "else" "for" "repeat")
5708 "*Keywords to complete when at first word of a line in case scope. 5716 "*Keywords to complete when at first word of a line in case scope.
5709\(Eg. begin, if, then, else, for, fork.) 5717\(begin, if, then, else, for, fork...)
5710The procedures and variables defined within the Verilog program 5718The procedures and variables defined within the Verilog program
5711will be completed at runtime and should not be added to this list.") 5719will be completed at runtime and should not be added to this list.")
5712 5720
5713(defvar verilog-separator-keywords 5721(defvar verilog-separator-keywords
5714 '("else" "then" "begin") 5722 '("else" "then" "begin")
5715 "*Keywords to complete when NOT standing at the first word of a statement. 5723 "*Keywords to complete when NOT standing at the first word of a statement.
5716\(Eg. else, then.) 5724\(else, then, begin...)
5717Variables and function names defined within the Verilog program 5725Variables and function names defined within the Verilog program
5718will be completed at runtime and should not be added to this list.") 5726will be completed at runtime and should not be added to this list.")
5719 5727
@@ -6927,10 +6935,10 @@ Outputs comments above subcell signals, for example:
6927 (while (re-search-forward "\\s *(?\\s *// Outputs" end-inst-point t) 6935 (while (re-search-forward "\\s *(?\\s *// Outputs" end-inst-point t)
6928 (verilog-read-sub-decls-line submoddecls comment)) ;; Modifies sigs-out 6936 (verilog-read-sub-decls-line submoddecls comment)) ;; Modifies sigs-out
6929 (goto-char st-point) 6937 (goto-char st-point)
6930 (while (re-search-forward "\\s *// Inouts" end-inst-point t) 6938 (while (re-search-forward "\\s *(?\\s *// Inouts" end-inst-point t)
6931 (verilog-read-sub-decls-line submoddecls comment)) ;; Modifies sigs-inout 6939 (verilog-read-sub-decls-line submoddecls comment)) ;; Modifies sigs-inout
6932 (goto-char st-point) 6940 (goto-char st-point)
6933 (while (re-search-forward "\\s *// Inputs" end-inst-point t) 6941 (while (re-search-forward "\\s *(?\\s *// Inputs" end-inst-point t)
6934 (verilog-read-sub-decls-line submoddecls comment)) ;; Modifies sigs-in 6942 (verilog-read-sub-decls-line submoddecls comment)) ;; Modifies sigs-in
6935 ))))) 6943 )))))
6936 ;; Combine duplicate bits 6944 ;; Combine duplicate bits
@@ -7730,11 +7738,13 @@ Or, just the existing dirnames themselves if there are no wildcards."
7730 dirlist)) 7738 dirlist))
7731;;(verilog-expand-dirnames (list "." ".." "nonexist" "../*" "/home/wsnyder/*/v")) 7739;;(verilog-expand-dirnames (list "." ".." "nonexist" "../*" "/home/wsnyder/*/v"))
7732 7740
7733(defun verilog-library-filenames (filename current &optional check-ext) 7741(defun verilog-library-filenames (filename &optional current check-ext)
7734 "Return a search path to find the given FILENAME or module name. 7742 "Return a search path to find the given FILENAME or module name.
7735Uses the CURRENT filename, `verilog-library-directories' and 7743Uses the optional CURRENT filename or buffer-file-name, plus
7736`verilog-library-extensions' variables to build the path. 7744`verilog-library-directories' and `verilog-library-extensions'
7737With optional CHECK-EXT also check `verilog-library-extensions'." 7745variables to build the path. With optional CHECK-EXT also check
7746`verilog-library-extensions'."
7747 (unless current (setq current (buffer-file-name)))
7738 (unless verilog-dir-cache-preserving 7748 (unless verilog-dir-cache-preserving
7739 (setq verilog-dir-cache-lib-filenames nil)) 7749 (setq verilog-dir-cache-lib-filenames nil))
7740 (let* ((cache-key (list filename current check-ext)) 7750 (let* ((cache-key (list filename current check-ext))
@@ -7987,7 +7997,7 @@ and invalidating the cache."
7987 (nreverse out-list)))) 7997 (nreverse out-list))))
7988 7998
7989(defun verilog-signals-matching-dir-re (in-list decl-type regexp) 7999(defun verilog-signals-matching-dir-re (in-list decl-type regexp)
7990 "Return all signals in IN-LIST matching the given directional REGEXP, 8000 "Return all signals in IN-LIST matching the given DECL-TYPE and REGEXP,
7991if non-nil." 8001if non-nil."
7992 (if (or (not regexp) (equal regexp "")) 8002 (if (or (not regexp) (equal regexp ""))
7993 in-list 8003 in-list
@@ -8221,6 +8231,13 @@ This repairs those mis-inserted by a AUTOARG."
8221 (delete-region pt (point)) 8231 (delete-region pt (point))
8222 (forward-line 1)))) 8232 (forward-line 1))))
8223 8233
8234(defun verilog-delete-empty-auto-pair ()
8235 "Delete begin/end auto pair at point, if empty."
8236 (forward-line 0)
8237 (when (looking-at (concat "\\s-*// Beginning of automatic.*\n"
8238 "\\s-*// End of automatics\n"))
8239 (delete-region (point) (save-excursion (forward-line 2) (point)))))
8240
8224(defun verilog-forward-close-paren () 8241(defun verilog-forward-close-paren ()
8225 "Find the close parenthesis that match the current point. 8242 "Find the close parenthesis that match the current point.
8226Ignore other close parenthesis with matching open parens." 8243Ignore other close parenthesis with matching open parens."
@@ -8271,7 +8288,7 @@ Deletion stops at the matching end parenthesis."
8271 "Return if a .* AUTOINST is safe to delete or expand. 8288 "Return if a .* AUTOINST is safe to delete or expand.
8272It was created by the AUTOS themselves, or by the user." 8289It was created by the AUTOS themselves, or by the user."
8273 (and verilog-auto-star-expand 8290 (and verilog-auto-star-expand
8274 (looking-at "[ \t\n\f,]*\\([)]\\|// \\(Outputs\\|Inouts\\|Inputs\\)\\)"))) 8291 (looking-at "[ \t\n\f,]*\\([)]\\|// \\(Outputs\\|Inouts\\|Inputs\\|Interfaces\\)\\)")))
8275 8292
8276(defun verilog-delete-auto-star-all () 8293(defun verilog-delete-auto-star-all ()
8277 "Delete a .* AUTOINST, if it is safe." 8294 "Delete a .* AUTOINST, if it is safe."
@@ -8303,7 +8320,7 @@ removed."
8303 (save-excursion 8320 (save-excursion
8304 (while (progn 8321 (while (progn
8305 (forward-line -1) 8322 (forward-line -1)
8306 (looking-at "\\s *//\\s *\\(Outputs\\|Inouts\\|Inputs\\)\n")) 8323 (looking-at "\\s *//\\s *\\(Outputs\\|Inouts\\|Inputs\\|Interfaces\\)\n"))
8307 (delete-region (match-beginning 0) (match-end 0)))) 8324 (delete-region (match-beginning 0) (match-end 0))))
8308 ;; If it is simple, we can put the ); on the same line as the last text 8325 ;; If it is simple, we can put the ); on the same line as the last text
8309 (let ((rtn-pt (point))) 8326 (let ((rtn-pt (point)))
@@ -8343,7 +8360,7 @@ called before and after this function, respectively."
8343 "AUTOREG" "AUTOREGINPUT" "AUTORESET" "AUTOTIEOFF" 8360 "AUTOREG" "AUTOREGINPUT" "AUTORESET" "AUTOTIEOFF"
8344 "AUTOUNUSED" "AUTOWIRE"))) 8361 "AUTOUNUSED" "AUTOWIRE")))
8345 ;; Optional parens or quoted parameter or .* for (((...))) 8362 ;; Optional parens or quoted parameter or .* for (((...)))
8346 "\\(\\|([^)]*)\\|(\"[^\"]*\")\\|.*?\\)" 8363 "\\(\\|([^)]*)\\|(\"[^\"]*\")\\).*?"
8347 "\\*/") 8364 "\\*/")
8348 'verilog-delete-autos-lined) 8365 'verilog-delete-autos-lined)
8349 ;; Remove those that are in parenthesis 8366 ;; Remove those that are in parenthesis
@@ -8975,7 +8992,7 @@ Regexp Templates:
8975 inside the first set of \\( \\). Thus pci_req2_l becomes pci_req_jtag_[2]. 8992 inside the first set of \\( \\). Thus pci_req2_l becomes pci_req_jtag_[2].
8976 8993
8977 Since \\([0-9]+\\) is so common and ugly to read, a @ in the port name 8994 Since \\([0-9]+\\) is so common and ugly to read, a @ in the port name
8978 does the same thing. (Note a @ in the connection/replacement text is 8995 does the same thing. (Note a @ in the connection/replacement text is
8979 completely different -- still use \\1 there!) Thus this is the same as 8996 completely different -- still use \\1 there!) Thus this is the same as
8980 the above template: 8997 the above template:
8981 8998
@@ -8995,8 +9012,11 @@ Lisp Templates:
8995 quotes will be evaluated as a Lisp expression, with @ replaced by the 9012 quotes will be evaluated as a Lisp expression, with @ replaced by the
8996 instantiation number. The MAPVALIDP1X example above would put @+1 modulo 9013 instantiation number. The MAPVALIDP1X example above would put @+1 modulo
8997 4 into the brackets. Quote all double-quotes inside the expression with 9014 4 into the brackets. Quote all double-quotes inside the expression with
8998 a leading backslash (\\\"). There are special variables defined that are 9015 a leading backslash (\\\"...\\\"); or if the Lisp template is also a
8999 useful in these Lisp functions: 9016 regexp template backslash the backslash quote (\\\\\"...\\\\\").
9017
9018 There are special variables defined that are useful in these
9019 Lisp functions:
9000 9020
9001 vl-name Name portion of the input/output port. 9021 vl-name Name portion of the input/output port.
9002 vl-bits Bus bits portion of the input/output port ('[2:0]'). 9022 vl-bits Bus bits portion of the input/output port ('[2:0]').
@@ -9024,7 +9044,10 @@ Lisp Templates:
9024 `number-to-string' and `string-to-number'. 9044 `number-to-string' and `string-to-number'.
9025 9045
9026 After the evaluation is completed, @ substitution and [] substitution 9046 After the evaluation is completed, @ substitution and [] substitution
9027 occur." 9047 occur.
9048
9049For more information see the \\[verilog-faq] and forums at URL
9050`http://www.veripool.org'."
9028 (save-excursion 9051 (save-excursion
9029 ;; Find beginning 9052 ;; Find beginning
9030 (let* ((pt (point)) 9053 (let* ((pt (point))
@@ -9917,17 +9940,14 @@ text:
9917 (point))) ;; Beginning paren 9940 (point))) ;; Beginning paren
9918 (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt))) 9941 (cmd (buffer-substring-no-properties cmd-beg-pt cmd-end-pt)))
9919 (forward-line 1) 9942 (forward-line 1)
9920 (let ((pre-eval-pt (point))) 9943 ;; Some commands don't move point (like insert-file) so we always
9921 ;;Debug: (insert cmd) 9944 ;; add the begin/end comments, then delete it if not needed
9922 ;; Don't use eval-region as Xemacs has a bug where it goto-char's begin-pt 9945 (verilog-insert-indent "// Beginning of automatic insert lisp\n")
9923 (eval (read cmd)) 9946 (verilog-insert-indent "// End of automatics\n")
9924 ;; If inserted something add the begin/end blocks 9947 (forward-line -1)
9925 (when (not (equal pre-eval-pt (point))) 9948 (eval (read cmd))
9926 (when (not (bolp)) (insert "\n")) ;; If user forgot final newline, add it 9949 (forward-line -1)
9927 (save-excursion 9950 (verilog-delete-empty-auto-pair))))
9928 (goto-char pre-eval-pt)
9929 (verilog-insert-indent "// Beginning of automatic insert lisp\n"))
9930 (verilog-insert-indent "// End of automatics\n"))))))
9931 9951
9932(defun verilog-auto-sense-sigs (moddecls presense-sigs) 9952(defun verilog-auto-sense-sigs (moddecls presense-sigs)
9933 "Return list of signals for current AUTOSENSE block." 9953 "Return list of signals for current AUTOSENSE block."