diff options
| -rw-r--r-- | lisp/ChangeLog | 42 | ||||
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 257 |
2 files changed, 212 insertions, 87 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ba1bf39066e..055e6b473ae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,45 @@ | |||
| 1 | 2008-09-05 Wilson Snyder <wsnyder@wsnyder.org> | ||
| 2 | |||
| 3 | * verilog-mode.el (verilog-library-extensions): Enable .sv | ||
| 4 | filename extensions to call verilog-mode. | ||
| 5 | (verilog-auto, verilog-auto-inst, verilog-faq) | ||
| 6 | (verilog-submit-bug-report): Update author support URLs. | ||
| 7 | (verilog-delete-auto, verilog-auto-inout-module) | ||
| 8 | (verilog-auto-inout-comp, verilog-auto): Add AUTOINOUTCOMP for | ||
| 9 | creating complemented testbench modules. Suggested by Yishay | ||
| 10 | Belkind. | ||
| 11 | (verilog-auto-inst-port, verilog-simplify-range-expression): When | ||
| 12 | verilog-auto-inst-param-value is set, don't require a | ||
| 13 | AUTO_TEMPLATE to expand parameter substitutions. Suggested by | ||
| 14 | Yishay Belkind. | ||
| 15 | (verilog-auto-inst-param-value): Add safe variable. | ||
| 16 | (verilog-re-search-forward, verilog-re-search-backward): Fix | ||
| 17 | returning wrong search results on Emacs 22.1. | ||
| 18 | (verilog-modi-cache-results, verilog-auto): Fix warning message | ||
| 19 | about "toggling font-lock-mode." | ||
| 20 | (verilog-auto): Fix loosing font-lock on errors. | ||
| 21 | (verilog-auto-inst-param-value, verilog-mode-version) | ||
| 22 | (verilog-mode-version-date, verilog-read-inst-param-value) | ||
| 23 | (verilog-auto-inst, verilog-auto-inst-param) | ||
| 24 | (verilog-auto-inst-port, verilog-simplify-range-expression): Allow | ||
| 25 | parameters to be replaced with their values, on the expansion of | ||
| 26 | an AUTOINST with Verilog 2001 style parameter settings. Suggested | ||
| 27 | by David Rogoff. | ||
| 28 | |||
| 29 | 2008-09-05 Michael McNamara <mac@mail.brushroad.com> | ||
| 30 | |||
| 31 | * verilog-mode.el (verilog-beg-block-re-ordered, verilog-calc-1): | ||
| 32 | Better support for the property statement. Sometimes this keyword | ||
| 33 | introduces a statement which requires an endproperty keyword, and | ||
| 34 | sometimes it doesn't, dependening on the work before the property | ||
| 35 | word. If property is prefixed with assert, assume or cover | ||
| 36 | keyword, then the statement is ended with a ';' Otherwise, | ||
| 37 | property is like task or specify, and is followed by some number | ||
| 38 | of statements, which are ended with an endproperty keyword. | ||
| 39 | (electric-verilog-tab): Support Emacs 22.2 style handling of tab | ||
| 40 | in a highlighted region: indent each line in region according to | ||
| 41 | mode. Supply this so it works in XEmacs and older Emacs. | ||
| 42 | |||
| 1 | 2008-09-05 Chong Yidong <cyd@stupidchicken.com> | 43 | 2008-09-05 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 44 | ||
| 3 | * international/quail.el: Require help-mode. | 45 | * international/quail.el: Require help-mode. |
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index f53f566f08f..bd8db93f8ab 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | ;; | 8 | ;; |
| 9 | ;; AUTO features, signal, modsig; by: Wilson Snyder | 9 | ;; AUTO features, signal, modsig; by: Wilson Snyder |
| 10 | ;; (wsnyder@wsnyder.org) | 10 | ;; (wsnyder@wsnyder.org) |
| 11 | ;; http://www.veripool.com | 11 | ;; http://www.veripool.org |
| 12 | ;; Keywords: languages | 12 | ;; Keywords: languages |
| 13 | 13 | ||
| 14 | ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this | 14 | ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this |
| @@ -78,8 +78,7 @@ | |||
| 78 | ;; .emacs, or in your site's site-load.el | 78 | ;; .emacs, or in your site's site-load.el |
| 79 | 79 | ||
| 80 | ; (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) | 80 | ; (autoload 'verilog-mode "verilog-mode" "Verilog mode" t ) |
| 81 | ; (setq auto-mode-alist (cons '("\\.v\\'" . verilog-mode) auto-mode-alist)) | 81 | ; (add-to-list 'auto-mode-alist '("\\.[ds]?v\\'" . verilog-mode)) |
| 82 | ; (setq auto-mode-alist (cons '("\\.dv\\'" . verilog-mode) auto-mode-alist)) | ||
| 83 | 82 | ||
| 84 | ;; If you want to customize Verilog mode to fit your needs better, | 83 | ;; If you want to customize Verilog mode to fit your needs better, |
| 85 | ;; you may add these lines (the values of the variables presented | 84 | ;; you may add these lines (the values of the variables presented |
| @@ -112,15 +111,15 @@ | |||
| 112 | 111 | ||
| 113 | ;;; History: | 112 | ;;; History: |
| 114 | ;; | 113 | ;; |
| 115 | ;; See commit history at http://www.veripool.com/verilog-mode.html | 114 | ;; See commit history at http://www.veripool.org/verilog-mode.html |
| 116 | ;; (This section is required to appease checkdoc.) | 115 | ;; (This section is required to appease checkdoc.) |
| 117 | 116 | ||
| 118 | ;;; Code: | 117 | ;;; Code: |
| 119 | 118 | ||
| 120 | ;; This variable will always hold the version number of the mode | 119 | ;; This variable will always hold the version number of the mode |
| 121 | (defconst verilog-mode-version "429" | 120 | (defconst verilog-mode-version "436" |
| 122 | "Version of this Verilog mode.") | 121 | "Version of this Verilog mode.") |
| 123 | (defconst verilog-mode-release-date "2008-06-23-GNU" | 122 | (defconst verilog-mode-release-date "2008-09-02-GNU" |
| 124 | "Release date of this Verilog mode.") | 123 | "Release date of this Verilog mode.") |
| 125 | (defconst verilog-mode-release-emacs t | 124 | (defconst verilog-mode-release-emacs t |
| 126 | "If non-nil, this version of Verilog mode was released with Emacs itself.") | 125 | "If non-nil, this version of Verilog mode was released with Emacs itself.") |
| @@ -133,8 +132,7 @@ | |||
| 133 | ;; Insure we have certain packages, and deal with it if we don't | 132 | ;; Insure we have certain packages, and deal with it if we don't |
| 134 | ;; Be sure to note which Emacs flavor and version added each feature. | 133 | ;; Be sure to note which Emacs flavor and version added each feature. |
| 135 | (eval-when-compile | 134 | (eval-when-compile |
| 136 | ;; The below were disabled when GNU Emacs 22 was released; | 135 | ;; Provide stuff if we are XEmacs |
| 137 | ;; perhaps some still need to be there to support Emacs 21. | ||
| 138 | (when (featurep 'xemacs) | 136 | (when (featurep 'xemacs) |
| 139 | (condition-case nil | 137 | (condition-case nil |
| 140 | (require 'easymenu) | 138 | (require 'easymenu) |
| @@ -214,7 +212,13 @@ STRING should be given if the last search was by `string-match' on STRING." | |||
| 214 | ;; We have an intermediate custom-library, hack around it! | 212 | ;; We have an intermediate custom-library, hack around it! |
| 215 | (defmacro customize-group (var &rest args) | 213 | (defmacro customize-group (var &rest args) |
| 216 | `(customize ,var)) | 214 | `(customize ,var)) |
| 217 | ))) | 215 | )) |
| 216 | ;; OK, do this stuff if we are NOT XEmacs: | ||
| 217 | (unless (featurep 'xemacs) | ||
| 218 | (unless (fboundp 'region-active-p) | ||
| 219 | (defmacro region-active-p () | ||
| 220 | `(and transient-mark-mode mark-active)))) | ||
| 221 | ) | ||
| 218 | 222 | ||
| 219 | ;; Provide a regular expression optimization routine, using regexp-opt | 223 | ;; Provide a regular expression optimization routine, using regexp-opt |
| 220 | ;; if provided by the user's elisp libraries | 224 | ;; if provided by the user's elisp libraries |
| @@ -782,7 +786,7 @@ See also `verilog-library-flags', `verilog-library-directories'." | |||
| 782 | :type '(repeat directory)) | 786 | :type '(repeat directory)) |
| 783 | (put 'verilog-library-files 'safe-local-variable 'listp) | 787 | (put 'verilog-library-files 'safe-local-variable 'listp) |
| 784 | 788 | ||
| 785 | (defcustom verilog-library-extensions '(".v") | 789 | (defcustom verilog-library-extensions '(".v" ".sv") |
| 786 | "*List of extensions to use when looking for files for /*AUTOINST*/. | 790 | "*List of extensions to use when looking for files for /*AUTOINST*/. |
| 787 | See also `verilog-library-flags', `verilog-library-directories'." | 791 | See also `verilog-library-flags', `verilog-library-directories'." |
| 788 | :type '(repeat string) | 792 | :type '(repeat string) |
| @@ -865,7 +869,7 @@ instead expand to: | |||
| 865 | .i (i[9:0]));" | 869 | .i (i[9:0]));" |
| 866 | :group 'verilog-mode-auto | 870 | :group 'verilog-mode-auto |
| 867 | :type 'boolean) | 871 | :type 'boolean) |
| 868 | (put 'verilog-auto-inst-vector 'safe-local-variable 'verilog-auto-inst-param-value) | 872 | (put 'verilog-auto-inst-param-value 'safe-local-variable 'verilog-booleanp) |
| 869 | 873 | ||
| 870 | (defcustom verilog-auto-inst-vector t | 874 | (defcustom verilog-auto-inst-vector t |
| 871 | "*If true, when creating default ports with AUTOINST, use bus subscripts. | 875 | "*If true, when creating default ports with AUTOINST, use bus subscripts. |
| @@ -1145,6 +1149,8 @@ If set will become buffer local.") | |||
| 1145 | :help "Help on AUTOARG - declaring module port list"] | 1149 | :help "Help on AUTOARG - declaring module port list"] |
| 1146 | ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum) | 1150 | ["AUTOASCIIENUM" (describe-function 'verilog-auto-ascii-enum) |
| 1147 | :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] | 1151 | :help "Help on AUTOASCIIENUM - creating ASCII for enumerations"] |
| 1152 | ["AUTOINOUTCOMP" (describe-function 'verilog-auto-inout-complement) | ||
| 1153 | :help "Help on AUTOINOUTCOMP - copying complemented i/o from another file"] | ||
| 1148 | ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module) | 1154 | ["AUTOINOUTMODULE" (describe-function 'verilog-auto-inout-module) |
| 1149 | :help "Help on AUTOINOUTMODULE - copying i/o from another file"] | 1155 | :help "Help on AUTOINOUTMODULE - copying i/o from another file"] |
| 1150 | ["AUTOINOUT" (describe-function 'verilog-auto-inout) | 1156 | ["AUTOINOUT" (describe-function 'verilog-auto-inout) |
| @@ -1278,30 +1284,34 @@ will break, as the o's continuously replace. xa -> x works ok though." | |||
| 1278 | (defsubst verilog-re-search-forward (REGEXP BOUND NOERROR) | 1284 | (defsubst verilog-re-search-forward (REGEXP BOUND NOERROR) |
| 1279 | ; checkdoc-params: (REGEXP BOUND NOERROR) | 1285 | ; checkdoc-params: (REGEXP BOUND NOERROR) |
| 1280 | "Like `re-search-forward', but skips over match in comments or strings." | 1286 | "Like `re-search-forward', but skips over match in comments or strings." |
| 1281 | (store-match-data '(nil nil)) ;; So match-end will return nil if no matches found | 1287 | (let ((mdata '(nil nil))) ;; So match-end will return nil if no matches found |
| 1282 | (while (and | 1288 | (while (and |
| 1283 | (re-search-forward REGEXP BOUND NOERROR) | 1289 | (re-search-forward REGEXP BOUND NOERROR) |
| 1284 | (and (verilog-skip-forward-comment-or-string) | 1290 | (setq mdata (match-data)) |
| 1285 | (progn | 1291 | (and (verilog-skip-forward-comment-or-string) |
| 1286 | (store-match-data '(nil nil)) | 1292 | (progn |
| 1287 | (if BOUND | 1293 | (setq mdata '(nil nil)) |
| 1288 | (< (point) BOUND) | 1294 | (if BOUND |
| 1289 | t))))) | 1295 | (< (point) BOUND) |
| 1290 | (match-end 0)) | 1296 | t))))) |
| 1297 | (store-match-data mdata) | ||
| 1298 | (match-end 0))) | ||
| 1291 | 1299 | ||
| 1292 | (defsubst verilog-re-search-backward (REGEXP BOUND NOERROR) | 1300 | (defsubst verilog-re-search-backward (REGEXP BOUND NOERROR) |
| 1293 | ; checkdoc-params: (REGEXP BOUND NOERROR) | 1301 | ; checkdoc-params: (REGEXP BOUND NOERROR) |
| 1294 | "Like `re-search-backward', but skips over match in comments or strings." | 1302 | "Like `re-search-backward', but skips over match in comments or strings." |
| 1295 | (store-match-data '(nil nil)) ;; So match-end will return nil if no matches found | 1303 | (let ((mdata '(nil nil))) ;; So match-end will return nil if no matches found |
| 1296 | (while (and | 1304 | (while (and |
| 1297 | (re-search-backward REGEXP BOUND NOERROR) | 1305 | (re-search-backward REGEXP BOUND NOERROR) |
| 1298 | (and (verilog-skip-backward-comment-or-string) | 1306 | (setq mdata (match-data)) |
| 1299 | (progn | 1307 | (and (verilog-skip-backward-comment-or-string) |
| 1300 | (store-match-data '(nil nil)) | 1308 | (progn |
| 1301 | (if BOUND | 1309 | (setq mdata '(nil nil)) |
| 1302 | (> (point) BOUND) | 1310 | (if BOUND |
| 1303 | t))))) | 1311 | (> (point) BOUND) |
| 1304 | (match-end 0)) | 1312 | t))))) |
| 1313 | (store-match-data mdata) | ||
| 1314 | (match-end 0))) | ||
| 1305 | 1315 | ||
| 1306 | (defsubst verilog-re-search-forward-quick (regexp bound noerror) | 1316 | (defsubst verilog-re-search-forward-quick (regexp bound noerror) |
| 1307 | "Like `verilog-re-search-forward', including use of REGEXP BOUND and NOERROR, | 1317 | "Like `verilog-re-search-forward', including use of REGEXP BOUND and NOERROR, |
| @@ -1606,9 +1616,9 @@ find the errors." | |||
| 1606 | "\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)*\\<task\\>\\)" ;11 | 1616 | "\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)*\\<task\\>\\)" ;11 |
| 1607 | "\\|\\(\\<generate\\>\\)" ;15 | 1617 | "\\|\\(\\<generate\\>\\)" ;15 |
| 1608 | "\\|\\(\\<covergroup\\>\\)" ;16 | 1618 | "\\|\\(\\<covergroup\\>\\)" ;16 |
| 1609 | "\\|\\(\\<property\\>\\)" ;17 | 1619 | "\\|\\(\\(\\(\\<cover\\>\\s-+\\)\\|\\(\\<assert\\>\\s-+\\)\\)*\\<property\\>\\)" ;17 |
| 1610 | "\\|\\(\\<\\(rand\\)?sequence\\>\\)" ;18 | 1620 | "\\|\\(\\<\\(rand\\)?sequence\\>\\)" ;21 |
| 1611 | "\\|\\(\\<clocking\\>\\)" ;19 | 1621 | "\\|\\(\\<clocking\\>\\)" ;22 |
| 1612 | )) | 1622 | )) |
| 1613 | 1623 | ||
| 1614 | (defconst verilog-end-block-ordered-rry | 1624 | (defconst verilog-end-block-ordered-rry |
| @@ -2716,34 +2726,39 @@ With optional ARG, remove existing end of line comments." | |||
| 2716 | "Function called when TAB is pressed in Verilog mode." | 2726 | "Function called when TAB is pressed in Verilog mode." |
| 2717 | (interactive) | 2727 | (interactive) |
| 2718 | ;; If verilog-tab-always-indent, indent the beginning of the line. | 2728 | ;; If verilog-tab-always-indent, indent the beginning of the line. |
| 2719 | (if (or verilog-tab-always-indent | 2729 | (cond |
| 2720 | (save-excursion | 2730 | ;; The region is active, indent it. |
| 2721 | (skip-chars-backward " \t") | 2731 | ((and (region-active-p) |
| 2722 | (bolp))) | 2732 | (not (eq (region-beginning) (region-end)))) |
| 2723 | (let* ((oldpnt (point)) | 2733 | (indent-region (region-beginning) (region-end) nil)) |
| 2724 | (boi-point | 2734 | ((or verilog-tab-always-indent |
| 2725 | (save-excursion | 2735 | (save-excursion |
| 2726 | (beginning-of-line) | 2736 | (skip-chars-backward " \t") |
| 2727 | (skip-chars-forward " \t") | 2737 | (bolp))) |
| 2728 | (verilog-indent-line) | 2738 | (let* ((oldpnt (point)) |
| 2729 | (back-to-indentation) | 2739 | (boi-point |
| 2730 | (point)))) | 2740 | (save-excursion |
| 2731 | (if (< (point) boi-point) | 2741 | (beginning-of-line) |
| 2732 | (back-to-indentation) | 2742 | (skip-chars-forward " \t") |
| 2733 | (cond ((not verilog-tab-to-comment)) | 2743 | (verilog-indent-line) |
| 2734 | ((not (eolp)) | 2744 | (back-to-indentation) |
| 2735 | (end-of-line)) | 2745 | (point)))) |
| 2736 | (t | 2746 | (if (< (point) boi-point) |
| 2737 | (indent-for-comment) | 2747 | (back-to-indentation) |
| 2738 | (when (and (eolp) (= oldpnt (point))) | 2748 | (cond ((not verilog-tab-to-comment)) |
| 2749 | ((not (eolp)) | ||
| 2750 | (end-of-line)) | ||
| 2751 | (t | ||
| 2752 | (indent-for-comment) | ||
| 2753 | (when (and (eolp) (= oldpnt (point))) | ||
| 2739 | ; kill existing comment | 2754 | ; kill existing comment |
| 2740 | (beginning-of-line) | 2755 | (beginning-of-line) |
| 2741 | (re-search-forward comment-start-skip oldpnt 'move) | 2756 | (re-search-forward comment-start-skip oldpnt 'move) |
| 2742 | (goto-char (match-beginning 0)) | 2757 | (goto-char (match-beginning 0)) |
| 2743 | (skip-chars-backward " \t") | 2758 | (skip-chars-backward " \t") |
| 2744 | (kill-region (point) oldpnt)))))) | 2759 | (kill-region (point) oldpnt))))))) |
| 2745 | (progn (insert "\t")))) | 2760 | (t (progn (insert "\t"))))) |
| 2746 | 2761 | ||
| 2747 | 2762 | ||
| 2748 | 2763 | ||
| 2749 | ;; | 2764 | ;; |
| @@ -4166,10 +4181,9 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)." | |||
| 4166 | 4181 | ||
| 4167 | 4182 | ||
| 4168 | ;; need to consider typedef struct here... | 4183 | ;; need to consider typedef struct here... |
| 4169 | ((looking-at "\\<class\\|struct\\|function\\|task\\|property\\>") | 4184 | ((looking-at "\\<class\\|struct\\|function\\|task\\>") |
| 4170 | ; *sigh* These words have an optional prefix: | 4185 | ; *sigh* These words have an optional prefix: |
| 4171 | ; extern {virtual|protected}? function a(); | 4186 | ; extern {virtual|protected}? function a(); |
| 4172 | ; assert property (p_1); | ||
| 4173 | ; typedef class foo; | 4187 | ; typedef class foo; |
| 4174 | ; and we don't want to confuse this with | 4188 | ; and we don't want to confuse this with |
| 4175 | ; function a(); | 4189 | ; function a(); |
| @@ -4180,7 +4194,18 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)." | |||
| 4180 | (if (looking-at verilog-beg-block-re-ordered) | 4194 | (if (looking-at verilog-beg-block-re-ordered) |
| 4181 | (throw 'nesting 'block) | 4195 | (throw 'nesting 'block) |
| 4182 | (throw 'nesting 'defun))) | 4196 | (throw 'nesting 'defun))) |
| 4183 | 4197 | ||
| 4198 | ((looking-at "\\<property\\>") | ||
| 4199 | ; *sigh* | ||
| 4200 | ; {assert|assume|cover} property (); are complete | ||
| 4201 | ; but | ||
| 4202 | ; property ID () ... needs end_property | ||
| 4203 | (verilog-beg-of-statement) | ||
| 4204 | (if (looking-at "\\(assert\\|assume\\|cover\\)\\s-+property\\>") | ||
| 4205 | (throw 'nesting 'statement) ; We don't need an endproperty for these | ||
| 4206 | (throw 'nesting 'block) ;We still need a endproperty | ||
| 4207 | )) | ||
| 4208 | |||
| 4184 | (t (throw 'nesting 'block)))) | 4209 | (t (throw 'nesting 'block)))) |
| 4185 | 4210 | ||
| 4186 | ((looking-at verilog-end-block-re) | 4211 | ((looking-at verilog-end-block-re) |
| @@ -7481,7 +7506,7 @@ Cache the output of function so next call may have faster access." | |||
| 7481 | ;; Clear then restore any hilighting to make emacs19 happy | 7506 | ;; Clear then restore any hilighting to make emacs19 happy |
| 7482 | (let ((fontlocked (when (and (boundp 'font-lock-mode) | 7507 | (let ((fontlocked (when (and (boundp 'font-lock-mode) |
| 7483 | font-lock-mode) | 7508 | font-lock-mode) |
| 7484 | (font-lock-mode nil) | 7509 | (font-lock-mode 0) |
| 7485 | t)) | 7510 | t)) |
| 7486 | func-returns) | 7511 | func-returns) |
| 7487 | (setq func-returns (funcall function)) | 7512 | (setq func-returns (funcall function)) |
| @@ -7726,7 +7751,7 @@ This repairs those mis-inserted by a AUTOARG." | |||
| 7726 | (last-pass "")) | 7751 | (last-pass "")) |
| 7727 | (while (not (equal last-pass out)) | 7752 | (while (not (equal last-pass out)) |
| 7728 | (setq last-pass out) | 7753 | (setq last-pass out) |
| 7729 | (while (string-match "(\\<\\([0-9]+\\)\\>)" out) | 7754 | (while (string-match "(\\<\\([0-9A-Z-az_]+\\)\\>)" out) |
| 7730 | (setq out (replace-match "\\1" nil nil out))) | 7755 | (setq out (replace-match "\\1" nil nil out))) |
| 7731 | (while (string-match "\\<\\([0-9]+\\)\\>\\s *\\+\\s *\\<\\([0-9]+\\)\\>" out) | 7756 | (while (string-match "\\<\\([0-9]+\\)\\>\\s *\\+\\s *\\<\\([0-9]+\\)\\>" out) |
| 7732 | (setq out (replace-match | 7757 | (setq out (replace-match |
| @@ -7875,13 +7900,13 @@ called before and after this function, respectively." | |||
| 7875 | (run-hooks 'verilog-before-delete-auto-hook) | 7900 | (run-hooks 'verilog-before-delete-auto-hook) |
| 7876 | 7901 | ||
| 7877 | ;; Remove those that have multi-line insertions, possibly with parameters | 7902 | ;; Remove those that have multi-line insertions, possibly with parameters |
| 7878 | (verilog-auto-re-search-do | 7903 | (verilog-auto-re-search-do |
| 7879 | (concat "/\\*" | 7904 | (concat "/\\*" |
| 7880 | (eval-when-compile | 7905 | (eval-when-compile |
| 7881 | (verilog-regexp-words | 7906 | (verilog-regexp-words |
| 7882 | `("AUTOASCIIENUM" "AUTOCONCATCOMMENT" "AUTODEFINEVALUE" | 7907 | `("AUTOASCIIENUM" "AUTOCONCATCOMMENT" "AUTODEFINEVALUE" |
| 7883 | "AUTOINOUT" "AUTOINOUTMODULE" "AUTOINPUT" "AUTOOUTPUT" | 7908 | "AUTOINOUT" "AUTOINOUTCOMP" "AUTOINOUTMODULE" |
| 7884 | "AUTOOUTPUTEVERY" | 7909 | "AUTOINPUT" "AUTOOUTPUT" "AUTOOUTPUTEVERY" |
| 7885 | "AUTOREG" "AUTOREGINPUT" "AUTORESET" "AUTOTIEOFF" | 7910 | "AUTOREG" "AUTOREGINPUT" "AUTORESET" "AUTOTIEOFF" |
| 7886 | "AUTOUNUSED" "AUTOWIRE"))) | 7911 | "AUTOUNUSED" "AUTOWIRE"))) |
| 7887 | "\\(\\|([^)]*)\\|(\"[^\"]*\")\\)" ; Optional parens or quoted parameter | 7912 | "\\(\\|([^)]*)\\|(\"[^\"]*\")\\)" ; Optional parens or quoted parameter |
| @@ -8193,13 +8218,9 @@ If PAR-VALUES replace final strings with these parameter values." | |||
| 8193 | (verilog-sig-bits (assoc port vector-skip-list))))) | 8218 | (verilog-sig-bits (assoc port vector-skip-list))))) |
| 8194 | (or (verilog-sig-bits port-st) "") | 8219 | (or (verilog-sig-bits port-st) "") |
| 8195 | "")) | 8220 | "")) |
| 8196 | ;; Default if not found | ||
| 8197 | (tpl-net (if (verilog-sig-multidim port-st) | ||
| 8198 | (concat port "/*" (verilog-sig-multidim-string port-st) | ||
| 8199 | vl-bits "*/") | ||
| 8200 | (concat port vl-bits))) | ||
| 8201 | (case-fold-search nil) | 8221 | (case-fold-search nil) |
| 8202 | (check-values par-values)) | 8222 | (check-values par-values) |
| 8223 | tpl-net) | ||
| 8203 | ;; Replace parameters in bit-width | 8224 | ;; Replace parameters in bit-width |
| 8204 | (when (and check-values | 8225 | (when (and check-values |
| 8205 | (not (equal vl-bits ""))) | 8226 | (not (equal vl-bits ""))) |
| @@ -8210,6 +8231,11 @@ If PAR-VALUES replace final strings with these parameter values." | |||
| 8210 | t t vl-bits) | 8231 | t t vl-bits) |
| 8211 | check-values (cdr check-values))) | 8232 | check-values (cdr check-values))) |
| 8212 | (setq vl-bits (verilog-simplify-range-expression vl-bits))) ; Not in the loop for speed | 8233 | (setq vl-bits (verilog-simplify-range-expression vl-bits))) ; Not in the loop for speed |
| 8234 | ;; Default net value if not found | ||
| 8235 | (setq tpl-net (if (verilog-sig-multidim port-st) | ||
| 8236 | (concat port "/*" (verilog-sig-multidim-string port-st) | ||
| 8237 | vl-bits "*/") | ||
| 8238 | (concat port vl-bits))) | ||
| 8213 | ;; Find template | 8239 | ;; Find template |
| 8214 | (cond (tpl-ass ; Template of exact port name | 8240 | (cond (tpl-ass ; Template of exact port name |
| 8215 | (setq tpl-net (nth 1 tpl-ass))) | 8241 | (setq tpl-net (nth 1 tpl-ass))) |
| @@ -8359,7 +8385,7 @@ Exceptions: | |||
| 8359 | Unless you are instantiating a module multiple times, or the module is | 8385 | Unless you are instantiating a module multiple times, or the module is |
| 8360 | something trivial like an adder, DO NOT CHANGE SIGNAL NAMES ACROSS HIERARCHY. | 8386 | something trivial like an adder, DO NOT CHANGE SIGNAL NAMES ACROSS HIERARCHY. |
| 8361 | It just makes for unmaintainable code. To sanitize signal names, try | 8387 | It just makes for unmaintainable code. To sanitize signal names, try |
| 8362 | vrename from http://www.veripool.com. | 8388 | vrename from http://www.veripool.org. |
| 8363 | 8389 | ||
| 8364 | When you need to violate this suggestion there are two ways to list | 8390 | When you need to violate this suggestion there are two ways to list |
| 8365 | exceptions, placing them before the AUTOINST, or using templates. | 8391 | exceptions, placing them before the AUTOINST, or using templates. |
| @@ -9212,7 +9238,7 @@ same expansion will result from only extracting inouts starting with i: | |||
| 9212 | (verilog-insert-indent "// End of automatics\n")) | 9238 | (verilog-insert-indent "// End of automatics\n")) |
| 9213 | (when v2k (verilog-repair-close-comma))))) | 9239 | (when v2k (verilog-repair-close-comma))))) |
| 9214 | 9240 | ||
| 9215 | (defun verilog-auto-inout-module () | 9241 | (defun verilog-auto-inout-module (&optional complement) |
| 9216 | "Expand AUTOINOUTMODULE statements, as part of \\[verilog-auto]. | 9242 | "Expand AUTOINOUTMODULE statements, as part of \\[verilog-auto]. |
| 9217 | Take input/output/inout statements from the specified module and insert | 9243 | Take input/output/inout statements from the specified module and insert |
| 9218 | into the current module. This is useful for making null templates and | 9244 | into the current module. This is useful for making null templates and |
| @@ -9248,9 +9274,9 @@ Typing \\[verilog-auto] will make this into: | |||
| 9248 | module ExampShell (/*AUTOARG*/i,o,io) | 9274 | module ExampShell (/*AUTOARG*/i,o,io) |
| 9249 | /*AUTOINOUTMODULE(\"ExampMain\")*/ | 9275 | /*AUTOINOUTMODULE(\"ExampMain\")*/ |
| 9250 | // Beginning of automatic in/out/inouts (from specific module) | 9276 | // Beginning of automatic in/out/inouts (from specific module) |
| 9251 | input i; | ||
| 9252 | output o; | 9277 | output o; |
| 9253 | inout io; | 9278 | inout io; |
| 9279 | input i; | ||
| 9254 | // End of automatics | 9280 | // End of automatics |
| 9255 | endmodule | 9281 | endmodule |
| 9256 | 9282 | ||
| @@ -9273,10 +9299,14 @@ same expansion will result from only extracting signals starting with i: | |||
| 9273 | (moddecls (verilog-modi-get-decls modi)) | 9299 | (moddecls (verilog-modi-get-decls modi)) |
| 9274 | (submoddecls (verilog-modi-get-decls submodi)) | 9300 | (submoddecls (verilog-modi-get-decls submodi)) |
| 9275 | (sig-list-i (verilog-signals-not-in | 9301 | (sig-list-i (verilog-signals-not-in |
| 9276 | (verilog-decls-get-inputs submoddecls) | 9302 | (if complement |
| 9303 | (verilog-decls-get-outputs submoddecls) | ||
| 9304 | (verilog-decls-get-inputs submoddecls)) | ||
| 9277 | (append (verilog-decls-get-inputs moddecls)))) | 9305 | (append (verilog-decls-get-inputs moddecls)))) |
| 9278 | (sig-list-o (verilog-signals-not-in | 9306 | (sig-list-o (verilog-signals-not-in |
| 9279 | (verilog-decls-get-outputs submoddecls) | 9307 | (if complement |
| 9308 | (verilog-decls-get-inputs submoddecls) | ||
| 9309 | (verilog-decls-get-outputs submoddecls)) | ||
| 9280 | (append (verilog-decls-get-outputs moddecls)))) | 9310 | (append (verilog-decls-get-outputs moddecls)))) |
| 9281 | (sig-list-io (verilog-signals-not-in | 9311 | (sig-list-io (verilog-signals-not-in |
| 9282 | (verilog-decls-get-inouts submoddecls) | 9312 | (verilog-decls-get-inouts submoddecls) |
| @@ -9302,6 +9332,57 @@ same expansion will result from only extracting signals starting with i: | |||
| 9302 | (verilog-insert-indent "// End of automatics\n")) | 9332 | (verilog-insert-indent "// End of automatics\n")) |
| 9303 | (when v2k (verilog-repair-close-comma))))))) | 9333 | (when v2k (verilog-repair-close-comma))))))) |
| 9304 | 9334 | ||
| 9335 | (defun verilog-auto-inout-comp () | ||
| 9336 | "Expand AUTOINOUTCOMP statements, as part of \\[verilog-auto]. | ||
| 9337 | Take input/output/inout statements from the specified module and | ||
| 9338 | insert the inverse into the current module (inputs become outputs | ||
| 9339 | and vice-versa.) This is useful for making test and stimulus | ||
| 9340 | modules which need to have complementing I/O with another module. | ||
| 9341 | Any I/O which are already defined in this module will not be | ||
| 9342 | redefined. | ||
| 9343 | |||
| 9344 | Limitations: | ||
| 9345 | If placed inside the parenthesis of a module declaration, it creates | ||
| 9346 | Verilog 2001 style, else uses Verilog 1995 style. | ||
| 9347 | |||
| 9348 | Concatenation and outputting partial busses is not supported. | ||
| 9349 | |||
| 9350 | Module names must be resolvable to filenames. See `verilog-auto-inst'. | ||
| 9351 | |||
| 9352 | Signals are not inserted in the same order as in the original module, | ||
| 9353 | though they will appear to be in the same order to a AUTOINST | ||
| 9354 | instantiating either module. | ||
| 9355 | |||
| 9356 | An example: | ||
| 9357 | |||
| 9358 | module ExampShell (/*AUTOARG*/) | ||
| 9359 | /*AUTOINOUTCOMP(\"ExampMain\")*/ | ||
| 9360 | endmodule | ||
| 9361 | |||
| 9362 | module ExampMain (i,o,io) | ||
| 9363 | input i; | ||
| 9364 | output o; | ||
| 9365 | inout io; | ||
| 9366 | endmodule | ||
| 9367 | |||
| 9368 | Typing \\[verilog-auto] will make this into: | ||
| 9369 | |||
| 9370 | module ExampShell (/*AUTOARG*/i,o,io) | ||
| 9371 | /*AUTOINOUTCOMP(\"ExampMain\")*/ | ||
| 9372 | // Beginning of automatic in/out/inouts (from specific module) | ||
| 9373 | output i; | ||
| 9374 | inout io; | ||
| 9375 | input o; | ||
| 9376 | // End of automatics | ||
| 9377 | endmodule | ||
| 9378 | |||
| 9379 | You may also provide an optional regular expression, in which case only | ||
| 9380 | signals matching the regular expression will be included. For example the | ||
| 9381 | same expansion will result from only extracting signals starting with i: | ||
| 9382 | |||
| 9383 | /*AUTOINOUTCOMP(\"ExampMain\",\"^i\")*/" | ||
| 9384 | (verilog-auto-inout-module t)) | ||
| 9385 | |||
| 9305 | (defun verilog-auto-sense-sigs (moddecls presense-sigs) | 9386 | (defun verilog-auto-sense-sigs (moddecls presense-sigs) |
| 9306 | "Return list of signals for current AUTOSENSE block." | 9387 | "Return list of signals for current AUTOSENSE block." |
| 9307 | (let* ((sigss (verilog-read-always-signals)) | 9388 | (let* ((sigss (verilog-read-always-signals)) |
| @@ -9852,6 +9933,7 @@ Likewise, you can delete or inject AUTOs with: | |||
| 9852 | Using \\[describe-function], see also: | 9933 | Using \\[describe-function], see also: |
| 9853 | `verilog-auto-arg' for AUTOARG module instantiations | 9934 | `verilog-auto-arg' for AUTOARG module instantiations |
| 9854 | `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding | 9935 | `verilog-auto-ascii-enum' for AUTOASCIIENUM enumeration decoding |
| 9936 | `verilog-auto-inout-comp' for AUTOINOUTCOMP copy complemented i/o | ||
| 9855 | `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere | 9937 | `verilog-auto-inout-module' for AUTOINOUTMODULE copying i/o from elsewhere |
| 9856 | `verilog-auto-inout' for AUTOINOUT making hierarchy inouts | 9938 | `verilog-auto-inout' for AUTOINOUT making hierarchy inouts |
| 9857 | `verilog-auto-input' for AUTOINPUT making hierarchy inputs | 9939 | `verilog-auto-input' for AUTOINPUT making hierarchy inputs |
| @@ -9872,7 +9954,7 @@ Using \\[describe-function], see also: | |||
| 9872 | `verilog-read-includes' for reading `includes | 9954 | `verilog-read-includes' for reading `includes |
| 9873 | 9955 | ||
| 9874 | If you have bugs with these autos, try contacting the AUTOAUTHOR | 9956 | If you have bugs with these autos, try contacting the AUTOAUTHOR |
| 9875 | Wilson Snyder (wsnyder@wsnyder.org), and/or see http://www.veripool.com." | 9957 | Wilson Snyder (wsnyder@wsnyder.org), and/or see http://www.veripool.org." |
| 9876 | (interactive) | 9958 | (interactive) |
| 9877 | (unless noninteractive (message "Updating AUTOs...")) | 9959 | (unless noninteractive (message "Updating AUTOs...")) |
| 9878 | (if (fboundp 'dinotrace-unannotate-all) | 9960 | (if (fboundp 'dinotrace-unannotate-all) |
| @@ -9884,7 +9966,7 @@ Wilson Snyder (wsnyder@wsnyder.org), and/or see http://www.veripool.com." | |||
| 9884 | ;; nil==(equal "input" (progn (looking-at "input") (match-string 0))) | 9966 | ;; nil==(equal "input" (progn (looking-at "input") (match-string 0))) |
| 9885 | (fontlocked (when (and (boundp 'font-lock-mode) | 9967 | (fontlocked (when (and (boundp 'font-lock-mode) |
| 9886 | font-lock-mode) | 9968 | font-lock-mode) |
| 9887 | (font-lock-mode nil) | 9969 | (font-lock-mode 0) |
| 9888 | t)) | 9970 | t)) |
| 9889 | ;; Cache directories; we don't write new files, so can't change | 9971 | ;; Cache directories; we don't write new files, so can't change |
| 9890 | (verilog-dir-cache-preserving t)) | 9972 | (verilog-dir-cache-preserving t)) |
| @@ -9926,6 +10008,7 @@ Wilson Snyder (wsnyder@wsnyder.org), and/or see http://www.veripool.com." | |||
| 9926 | ;; | 10008 | ;; |
| 9927 | ;; first in/outs from other files | 10009 | ;; first in/outs from other files |
| 9928 | (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 'verilog-auto-inout-module) | 10010 | (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 'verilog-auto-inout-module) |
| 10011 | (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP([^)]*)\\*/" 'verilog-auto-inout-comp) | ||
| 9929 | ;; next in/outs which need previous sucked inputs first | 10012 | ;; next in/outs which need previous sucked inputs first |
| 9930 | (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/" | 10013 | (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/" |
| 9931 | '(lambda () (verilog-auto-output t))) | 10014 | '(lambda () (verilog-auto-output t))) |
| @@ -9959,11 +10042,11 @@ Wilson Snyder (wsnyder@wsnyder.org), and/or see http://www.veripool.com." | |||
| 9959 | (cond ((and oldbuf (equal oldbuf (buffer-string))) | 10042 | (cond ((and oldbuf (equal oldbuf (buffer-string))) |
| 9960 | (set-buffer-modified-p nil) | 10043 | (set-buffer-modified-p nil) |
| 9961 | (unless noninteractive (message "Updating AUTOs...done (no changes)"))) | 10044 | (unless noninteractive (message "Updating AUTOs...done (no changes)"))) |
| 9962 | (t (unless noninteractive (message "Updating AUTOs...done")))))) | 10045 | (t (unless noninteractive (message "Updating AUTOs...done"))))) |
| 9963 | ;; Unwind forms | 10046 | ;; Unwind forms |
| 9964 | (progn | 10047 | (progn |
| 9965 | ;; Restore font-lock | 10048 | ;; Restore font-lock |
| 9966 | (when fontlocked (font-lock-mode t))))) | 10049 | (when fontlocked (font-lock-mode t)))))) |
| 9967 | 10050 | ||
| 9968 | 10051 | ||
| 9969 | ;; | 10052 | ;; |
| @@ -10453,7 +10536,7 @@ Files are checked based on `verilog-library-directories'." | |||
| 10453 | (princ "\n") | 10536 | (princ "\n") |
| 10454 | (princ "For new releases, see http://www.verilog.com\n") | 10537 | (princ "For new releases, see http://www.verilog.com\n") |
| 10455 | (princ "\n") | 10538 | (princ "\n") |
| 10456 | (princ "For frequently asked questions, see http://www.veripool.com/verilog-mode-faq.html\n") | 10539 | (princ "For frequently asked questions, see http://www.veripool.org/verilog-mode-faq.html\n") |
| 10457 | (princ "\n") | 10540 | (princ "\n") |
| 10458 | (princ "To submit a bug, use M-x verilog-submit-bug-report\n") | 10541 | (princ "To submit a bug, use M-x verilog-submit-bug-report\n") |
| 10459 | (princ "\n"))) | 10542 | (princ "\n"))) |
| @@ -10520,9 +10603,9 @@ my coding ability... until now. I'd really appreciate anything you | |||
| 10520 | could do to help me out with this minor deficiency in the product. | 10603 | could do to help me out with this minor deficiency in the product. |
| 10521 | 10604 | ||
| 10522 | If you have bugs with the AUTO functions, please CC the AUTOAUTHOR Wilson | 10605 | If you have bugs with the AUTO functions, please CC the AUTOAUTHOR Wilson |
| 10523 | Snyder (wsnyder@wsnyder.org) and/or see http://www.veripool.com. | 10606 | Snyder (wsnyder@wsnyder.org) and/or see http://www.veripool.org. |
| 10524 | You may also want to look at the Verilog-Mode FAQ, see | 10607 | You may also want to look at the Verilog-Mode FAQ, see |
| 10525 | http://www.veripool.com/verilog-mode-faq.html. | 10608 | http://www.veripool.org/verilog-mode-faq.html. |
| 10526 | 10609 | ||
| 10527 | To reproduce the bug, start a fresh Emacs via " invocation-name " | 10610 | To reproduce the bug, start a fresh Emacs via " invocation-name " |
| 10528 | -no-init-file -no-site-file'. In a new buffer, in Verilog mode, type | 10611 | -no-init-file -no-site-file'. In a new buffer, in Verilog mode, type |