diff options
| author | Dan Nicolaescu | 2008-05-08 13:44:16 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2008-05-08 13:44:16 +0000 |
| commit | 9c059794a2a407f607e4cbf9f3cfde79bf50b58e (patch) | |
| tree | 126ef8087ef5cd961542bb179f970db9407f2930 | |
| parent | 231b351dcc8f091a9d07c84408d982d29655cfee (diff) | |
| download | emacs-9c059794a2a407f607e4cbf9f3cfde79bf50b58e.tar.gz emacs-9c059794a2a407f607e4cbf9f3cfde79bf50b58e.zip | |
(verilog-type-font-keywords): Add leda and 0in
as pragma keywords.
(verilog-pretty-expr): Support lining up assignments which include
part selects.
(verilog-mode): More portable check for the availability of
hideshow support.
(verilog-do-indent): Remove special indent for declarations inside
a parenthetical list. The code is ill-advised, and doesn't work
given the new user defined types.
(verilog-set-auto-endcomments): Enhance function automatic
endcomment to support functions that return user defined types.
(verilog-mode): Add code to tell which-function-mode minor mode
that Verilog supports this feature.
| -rw-r--r-- | lisp/ChangeLog | 16 | ||||
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 131 |
2 files changed, 83 insertions, 64 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 685be52cf06..2b966589a17 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,19 @@ | |||
| 1 | 2008-05-08 Michael McNamara <mac@mail.brushroad.com> | ||
| 2 | |||
| 3 | * verilog-mode.el (verilog-type-font-keywords): Add leda and 0in | ||
| 4 | as pragma keywords. | ||
| 5 | (verilog-pretty-expr): Support lining up assignments which include | ||
| 6 | part selects. | ||
| 7 | (verilog-mode): More portable check for the availability of | ||
| 8 | hideshow support. | ||
| 9 | (verilog-do-indent): Remove special indent for declarations inside | ||
| 10 | a parenthetical list. The code is ill-advised, and doesn't work | ||
| 11 | given the new user defined types. | ||
| 12 | (verilog-set-auto-endcomments): Enhance function automatic | ||
| 13 | endcomment to support functions that return user defined types. | ||
| 14 | (verilog-mode): Add code to tell which-function-mode minor mode | ||
| 15 | that Verilog supports this feature. | ||
| 16 | |||
| 1 | 2008-05-08 Eli Zaretskii <eliz@gnu.org> | 17 | 2008-05-08 Eli Zaretskii <eliz@gnu.org> |
| 2 | 18 | ||
| 3 | * epa-file.el: Require epa-hook. | 19 | * epa-file.el: Require epa-hook. |
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index e7720bfc1da..8ae43f0a59e 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 "404" | 121 | (defconst verilog-mode-version "423" |
| 122 | "Version of this Verilog mode.") | 122 | "Version of this Verilog mode.") |
| 123 | (defconst verilog-mode-release-date "2008-03-02-GNU" | 123 | (defconst verilog-mode-release-date "2008-05-07-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.") |
| @@ -1953,7 +1953,7 @@ See also `verilog-font-lock-extra-types'.") | |||
| 1953 | (verilog-pragma-keywords | 1953 | (verilog-pragma-keywords |
| 1954 | (eval-when-compile | 1954 | (eval-when-compile |
| 1955 | (verilog-regexp-opt | 1955 | (verilog-regexp-opt |
| 1956 | '("surefire" "synopsys" "rtl_synthesis" "verilint" ) nil | 1956 | '("surefire" "synopsys" "rtl_synthesis" "verilint" "leda" "0in") nil |
| 1957 | ))) | 1957 | ))) |
| 1958 | 1958 | ||
| 1959 | (verilog-p1800-keywords | 1959 | (verilog-p1800-keywords |
| @@ -2514,12 +2514,16 @@ Key bindings specific to `verilog-mode-map' are: | |||
| 2514 | ;; Tell imenu how to handle Verilog. | 2514 | ;; Tell imenu how to handle Verilog. |
| 2515 | (make-local-variable 'imenu-generic-expression) | 2515 | (make-local-variable 'imenu-generic-expression) |
| 2516 | (setq imenu-generic-expression verilog-imenu-generic-expression) | 2516 | (setq imenu-generic-expression verilog-imenu-generic-expression) |
| 2517 | ;; Tell which-func-modes that imenu knows about verilog | ||
| 2518 | (when (boundp 'which-function-modes) | ||
| 2519 | (add-to-list 'which-func-modes 'verilog-mode)) | ||
| 2517 | ;; hideshow support | 2520 | ;; hideshow support |
| 2518 | (unless (assq 'verilog-mode hs-special-modes-alist) | 2521 | (when (boundp 'hs-special-modes-alist) |
| 2519 | (setq hs-special-modes-alist | 2522 | (unless (assq 'verilog-mode hs-special-modes-alist) |
| 2520 | (cons '(verilog-mode-mode "\\<begin\\>" "\\<end\\>" nil | 2523 | (setq hs-special-modes-alist |
| 2521 | verilog-forward-sexp-function) | 2524 | (cons '(verilog-mode-mode "\\<begin\\>" "\\<end\\>" nil |
| 2522 | hs-special-modes-alist))) | 2525 | verilog-forward-sexp-function) |
| 2526 | hs-special-modes-alist)))) | ||
| 2523 | 2527 | ||
| 2524 | ;; Stuff for autos | 2528 | ;; Stuff for autos |
| 2525 | (add-hook 'write-contents-hooks 'verilog-auto-save-check) ; already local | 2529 | (add-hook 'write-contents-hooks 'verilog-auto-save-check) ; already local |
| @@ -3468,7 +3472,7 @@ primitive or interface named NAME." | |||
| 3468 | (;- this is end{function,generate,task,module,primitive,table,generate} | 3472 | (;- this is end{function,generate,task,module,primitive,table,generate} |
| 3469 | ;- which can not be nested. | 3473 | ;- which can not be nested. |
| 3470 | t | 3474 | t |
| 3471 | (let (string reg (width nil)) | 3475 | (let (string reg (name-re nil)) |
| 3472 | (end-of-line) | 3476 | (end-of-line) |
| 3473 | (if kill-existing-comment | 3477 | (if kill-existing-comment |
| 3474 | (save-match-data | 3478 | (save-match-data |
| @@ -3478,7 +3482,8 @@ primitive or interface named NAME." | |||
| 3478 | (cond | 3482 | (cond |
| 3479 | ((match-end 5) ;; of verilog-end-block-ordered-re | 3483 | ((match-end 5) ;; of verilog-end-block-ordered-re |
| 3480 | (setq reg "\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)") | 3484 | (setq reg "\\(\\<function\\>\\)\\|\\(\\<\\(endfunction\\|task\\|\\(macro\\)?module\\|primitive\\)\\>\\)") |
| 3481 | (setq width "\\(\\s-*\\(\\[[^]]*\\]\\)\\|\\(real\\(time\\)?\\)\\|\\(integer\\)\\|\\(time\\)\\)?")) | 3485 | (setq name-re "\\w+\\s-*(") |
| 3486 | ) | ||
| 3482 | ((match-end 6) ;; of verilog-end-block-ordered-re | 3487 | ((match-end 6) ;; of verilog-end-block-ordered-re |
| 3483 | (setq reg "\\(\\<task\\>\\)\\|\\(\\<\\(endtask\\|function\\|\\(macro\\)?module\\|primitive\\)\\>\\)")) | 3488 | (setq reg "\\(\\<task\\>\\)\\|\\(\\<\\(endtask\\|function\\|\\(macro\\)?module\\|primitive\\)\\>\\)")) |
| 3484 | ((match-end 7) ;; of verilog-end-block-ordered-re | 3489 | ((match-end 7) ;; of verilog-end-block-ordered-re |
| @@ -3509,9 +3514,9 @@ primitive or interface named NAME." | |||
| 3509 | (setq b (progn | 3514 | (setq b (progn |
| 3510 | (skip-chars-forward "^ \t") | 3515 | (skip-chars-forward "^ \t") |
| 3511 | (verilog-forward-ws&directives) | 3516 | (verilog-forward-ws&directives) |
| 3512 | (if (and width (looking-at width)) | 3517 | (if (and name-re (verilog-re-search-forward name-re nil 'move)) |
| 3513 | (progn | 3518 | (progn |
| 3514 | (goto-char (match-end 0)) | 3519 | (goto-char (match-beginning 0)) |
| 3515 | (verilog-forward-ws&directives))) | 3520 | (verilog-forward-ws&directives))) |
| 3516 | (point)) | 3521 | (point)) |
| 3517 | e (progn | 3522 | e (progn |
| @@ -4683,10 +4688,8 @@ Only look at a few lines to determine indent level." | |||
| 4683 | (skip-chars-forward " \t") | 4688 | (skip-chars-forward " \t") |
| 4684 | (current-column)))) | 4689 | (current-column)))) |
| 4685 | (indent-line-to val) | 4690 | (indent-line-to val) |
| 4686 | (if (and (not (verilog-in-struct-region-p)) | 4691 | )) |
| 4687 | (looking-at verilog-declaration-re)) | 4692 | |
| 4688 | (verilog-indent-declaration ind)))) | ||
| 4689 | |||
| 4690 | (;-- Handle the ends | 4693 | (;-- Handle the ends |
| 4691 | (or | 4694 | (or |
| 4692 | (looking-at verilog-end-block-re ) | 4695 | (looking-at verilog-end-block-re ) |
| @@ -4920,7 +4923,7 @@ ARG is ignored, for `comment-indent-function' compatibility." | |||
| 4920 | (if (or (eq myre nil) | 4923 | (if (or (eq myre nil) |
| 4921 | (string-equal myre "")) | 4924 | (string-equal myre "")) |
| 4922 | (setq myre "\\(<\\|:\\)?=")) | 4925 | (setq myre "\\(<\\|:\\)?=")) |
| 4923 | (setq myre (concat "\\(^[^;#:<=>]*\\)\\(" myre "\\)")) | 4926 | (setq myre (concat "\\(^[^;#<=>]*\\)\\(" myre "\\)")) |
| 4924 | (let ((rexp(concat "^\\s-*" verilog-complete-reg))) | 4927 | (let ((rexp(concat "^\\s-*" verilog-complete-reg))) |
| 4925 | (beginning-of-line) | 4928 | (beginning-of-line) |
| 4926 | (if (and (not (looking-at rexp )) | 4929 | (if (and (not (looking-at rexp )) |
| @@ -7372,12 +7375,12 @@ Cache the output of function so next call may have faster access." | |||
| 7372 | func-returns) | 7375 | func-returns) |
| 7373 | (setq func-returns (funcall function)) | 7376 | (setq func-returns (funcall function)) |
| 7374 | (when fontlocked (font-lock-mode t)) | 7377 | (when fontlocked (font-lock-mode t)) |
| 7375 | ;; Cache for next time | 7378 | ;; Cache for next time |
| 7376 | (setq verilog-modi-cache-list | 7379 | (setq verilog-modi-cache-list |
| 7377 | (cons (list (list modi function) | 7380 | (cons (list (list modi function) |
| 7378 | (buffer-modified-tick) | 7381 | (buffer-modified-tick) |
| 7379 | (visited-file-modtime) | 7382 | (visited-file-modtime) |
| 7380 | func-returns) | 7383 | func-returns) |
| 7381 | verilog-modi-cache-list)) | 7384 | verilog-modi-cache-list)) |
| 7382 | func-returns)))))) | 7385 | func-returns)))))) |
| 7383 | 7386 | ||
| @@ -7842,10 +7845,10 @@ Typing \\[verilog-inject-auto] will make this into: | |||
| 7842 | (goto-char (point-min)) | 7845 | (goto-char (point-min)) |
| 7843 | (while (verilog-re-search-forward-quick "\\<always\\s *@\\s *(" nil t) | 7846 | (while (verilog-re-search-forward-quick "\\<always\\s *@\\s *(" nil t) |
| 7844 | (let* ((start-pt (point)) | 7847 | (let* ((start-pt (point)) |
| 7845 | (modi (verilog-modi-current)) | 7848 | (modi (verilog-modi-current)) |
| 7846 | (moddecls (verilog-modi-get-decls modi)) | 7849 | (moddecls (verilog-modi-get-decls modi)) |
| 7847 | pre-sigs | 7850 | pre-sigs |
| 7848 | got-sigs) | 7851 | got-sigs) |
| 7849 | (backward-char 1) | 7852 | (backward-char 1) |
| 7850 | (forward-sexp 1) | 7853 | (forward-sexp 1) |
| 7851 | (backward-char 1) ;; End ) | 7854 | (backward-char 1) ;; End ) |
| @@ -8007,7 +8010,7 @@ Avoid declaring ports manually, as it makes code harder to maintain." | |||
| 8007 | (save-excursion | 8010 | (save-excursion |
| 8008 | (let* ((modi (verilog-modi-current)) | 8011 | (let* ((modi (verilog-modi-current)) |
| 8009 | (moddecls (verilog-modi-get-decls modi)) | 8012 | (moddecls (verilog-modi-get-decls modi)) |
| 8010 | (skip-pins (aref (verilog-read-arg-pins) 0))) | 8013 | (skip-pins (aref (verilog-read-arg-pins) 0))) |
| 8011 | (verilog-repair-open-comma) | 8014 | (verilog-repair-open-comma) |
| 8012 | (verilog-auto-arg-ports (verilog-signals-not-in | 8015 | (verilog-auto-arg-ports (verilog-signals-not-in |
| 8013 | (verilog-decls-get-outputs moddecls) | 8016 | (verilog-decls-get-outputs moddecls) |
| @@ -9743,55 +9746,55 @@ Wilson Snyder (wsnyder@wsnyder.org), and/or see http://www.veripool.com." | |||
| 9743 | (verilog-getopt-flags) | 9746 | (verilog-getopt-flags) |
| 9744 | ;; From here on out, we can cache anything we read from disk | 9747 | ;; From here on out, we can cache anything we read from disk |
| 9745 | (verilog-preserve-dir-cache | 9748 | (verilog-preserve-dir-cache |
| 9746 | ;; These two may seem obvious to do always, but on large includes it can be way too slow | 9749 | ;; These two may seem obvious to do always, but on large includes it can be way too slow |
| 9747 | (when verilog-auto-read-includes | 9750 | (when verilog-auto-read-includes |
| 9748 | (verilog-read-includes) | 9751 | (verilog-read-includes) |
| 9749 | (verilog-read-defines nil nil t)) | 9752 | (verilog-read-defines nil nil t)) |
| 9750 | ;; This particular ordering is important | 9753 | ;; This particular ordering is important |
| 9751 | ;; INST: Lower modules correct, no internal dependencies, FIRST | 9754 | ;; INST: Lower modules correct, no internal dependencies, FIRST |
| 9752 | (verilog-preserve-modi-cache | 9755 | (verilog-preserve-modi-cache |
| 9753 | ;; Clear existing autos else we'll be screwed by existing ones | 9756 | ;; Clear existing autos else we'll be screwed by existing ones |
| 9754 | (verilog-delete-auto) | 9757 | (verilog-delete-auto) |
| 9755 | ;; Injection if appropriate | 9758 | ;; Injection if appropriate |
| 9756 | (when inject | 9759 | (when inject |
| 9757 | (verilog-inject-inst) | 9760 | (verilog-inject-inst) |
| 9758 | (verilog-inject-sense) | 9761 | (verilog-inject-sense) |
| 9759 | (verilog-inject-arg)) | 9762 | (verilog-inject-arg)) |
| 9760 | ;; | 9763 | ;; |
| 9761 | (verilog-auto-re-search-do "/\\*AUTOINSTPARAM\\*/" 'verilog-auto-inst-param) | 9764 | (verilog-auto-re-search-do "/\\*AUTOINSTPARAM\\*/" 'verilog-auto-inst-param) |
| 9762 | (verilog-auto-re-search-do "/\\*AUTOINST\\*/" 'verilog-auto-inst) | 9765 | (verilog-auto-re-search-do "/\\*AUTOINST\\*/" 'verilog-auto-inst) |
| 9763 | (verilog-auto-re-search-do "\\.\\*" 'verilog-auto-star) | 9766 | (verilog-auto-re-search-do "\\.\\*" 'verilog-auto-star) |
| 9764 | ;; Doesn't matter when done, but combine it with a common changer | 9767 | ;; Doesn't matter when done, but combine it with a common changer |
| 9765 | (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense) | 9768 | (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense) |
| 9766 | (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset) | 9769 | (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset) |
| 9767 | ;; Must be done before autoin/out as creates a reg | 9770 | ;; Must be done before autoin/out as creates a reg |
| 9768 | (verilog-auto-re-search-do "/\\*AUTOASCIIENUM([^)]*)\\*/" 'verilog-auto-ascii-enum) | 9771 | (verilog-auto-re-search-do "/\\*AUTOASCIIENUM([^)]*)\\*/" 'verilog-auto-ascii-enum) |
| 9769 | ;; | 9772 | ;; |
| 9770 | ;; first in/outs from other files | 9773 | ;; first in/outs from other files |
| 9771 | (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 'verilog-auto-inout-module) | 9774 | (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 'verilog-auto-inout-module) |
| 9772 | ;; next in/outs which need previous sucked inputs first | 9775 | ;; next in/outs which need previous sucked inputs first |
| 9773 | (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/" | 9776 | (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/" |
| 9774 | '(lambda () (verilog-auto-output t))) | 9777 | '(lambda () (verilog-auto-output t))) |
| 9775 | (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\*/" 'verilog-auto-output) | 9778 | (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\*/" 'verilog-auto-output) |
| 9776 | (verilog-auto-re-search-do "/\\*AUTOINPUT\\((\"[^\"]*\")\\)\\*/" | 9779 | (verilog-auto-re-search-do "/\\*AUTOINPUT\\((\"[^\"]*\")\\)\\*/" |
| 9777 | '(lambda () (verilog-auto-input t))) | 9780 | '(lambda () (verilog-auto-input t))) |
| 9778 | (verilog-auto-re-search-do "/\\*AUTOINPUT\\*/" 'verilog-auto-input) | 9781 | (verilog-auto-re-search-do "/\\*AUTOINPUT\\*/" 'verilog-auto-input) |
| 9779 | (verilog-auto-re-search-do "/\\*AUTOINOUT\\((\"[^\"]*\")\\)\\*/" | 9782 | (verilog-auto-re-search-do "/\\*AUTOINOUT\\((\"[^\"]*\")\\)\\*/" |
| 9780 | '(lambda () (verilog-auto-inout t))) | 9783 | '(lambda () (verilog-auto-inout t))) |
| 9781 | (verilog-auto-re-search-do "/\\*AUTOINOUT\\*/" 'verilog-auto-inout) | 9784 | (verilog-auto-re-search-do "/\\*AUTOINOUT\\*/" 'verilog-auto-inout) |
| 9782 | ;; Then tie off those in/outs | 9785 | ;; Then tie off those in/outs |
| 9783 | (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff) | 9786 | (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff) |
| 9784 | ;; Wires/regs must be after inputs/outputs | 9787 | ;; Wires/regs must be after inputs/outputs |
| 9785 | (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire) | 9788 | (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire) |
| 9786 | (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg) | 9789 | (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg) |
| 9787 | (verilog-auto-re-search-do "/\\*AUTOREGINPUT\\*/" 'verilog-auto-reg-input) | 9790 | (verilog-auto-re-search-do "/\\*AUTOREGINPUT\\*/" 'verilog-auto-reg-input) |
| 9788 | ;; outputevery needs AUTOOUTPUTs done first | 9791 | ;; outputevery needs AUTOOUTPUTs done first |
| 9789 | (verilog-auto-re-search-do "/\\*AUTOOUTPUTEVERY\\*/" 'verilog-auto-output-every) | 9792 | (verilog-auto-re-search-do "/\\*AUTOOUTPUTEVERY\\*/" 'verilog-auto-output-every) |
| 9790 | ;; After we've created all new variables | 9793 | ;; After we've created all new variables |
| 9791 | (verilog-auto-re-search-do "/\\*AUTOUNUSED\\*/" 'verilog-auto-unused) | 9794 | (verilog-auto-re-search-do "/\\*AUTOUNUSED\\*/" 'verilog-auto-unused) |
| 9792 | ;; Must be after all inputs outputs are generated | 9795 | ;; Must be after all inputs outputs are generated |
| 9793 | (verilog-auto-re-search-do "/\\*AUTOARG\\*/" 'verilog-auto-arg) | 9796 | (verilog-auto-re-search-do "/\\*AUTOARG\\*/" 'verilog-auto-arg) |
| 9794 | ;; Fix line numbers (comments only) | 9797 | ;; Fix line numbers (comments only) |
| 9795 | (verilog-auto-templated-rel))) | 9798 | (verilog-auto-templated-rel))) |
| 9796 | ;; | 9799 | ;; |
| 9797 | (run-hooks 'verilog-auto-hook) | 9800 | (run-hooks 'verilog-auto-hook) |