diff options
| author | Wilson Snyder | 2016-11-14 13:47:31 -0500 |
|---|---|---|
| committer | Wilson Snyder | 2016-11-14 13:47:31 -0500 |
| commit | eda171a924a888db9b705ba7146fcdc13d9a84d3 (patch) | |
| tree | ef01178d4899e77f70c06bffb63f22ec4c0bb4b1 | |
| parent | 2f5e0b1bf7b0ac4f450847db34d599a072020600 (diff) | |
| download | emacs-eda171a924a888db9b705ba7146fcdc13d9a84d3.tar.gz emacs-eda171a924a888db9b705ba7146fcdc13d9a84d3.zip | |
Update verilog-mode.el
* verilog-mode.el (verilog-read-decls, verilog-calc-1): Fix
"default clocking" indentation and preventing AUTOs from working,
bug1084. Reported by Alan Morgan.
(verilog-diff-report): Fix `verilog-diff-report'
not returning bad status on differences, bug1087. Reported by
Eric Jackowski.
(verilog-auto-inst-param-value)
(verilog-auto-inst-param-value-type, verilog-read-sub-decls)
(verilog-read-sub-decls-expr, verilog-read-sub-decls-gate)
(verilog-read-sub-decls-line, verilog-read-sub-decls-sig)
(verilog-read-sub-decls-type): When
`verilog-auto-inst-param-value-type' is set, which is now the
default, AUTOINPUT etc will now substitute parameter types from
submodules, bug1061. Reported by Brad Dobbie.
(verilog-auto-reset, verilog-backward-case-item)
(verilog-extended-case-re, verilog-read-always-signals-recurse):
Fix indentation of randcase, bug1072. Reported by David Rogoff.
(verilog-read-sub-decls-expr)
(verilog-sig-multidim-string): Fix AUTOINST ordering of dimensions
in generated comments, bug1057. Reported by Kaushal Modi.
(verilog-auto-wire-comment, verilog-insert-definition):
Add `verilog-auto-wire-comment' to suppress wire comments. Reported by
Eric Jackowski.
(verilog-extended-complete-re): Fix indentation
of class static functions, bug1053. Reported by Gregory
Czajkowski.
(verilog-module-filenames): Support tramp for
finding verilog modules. Reported by Nevada Sanchez.
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 294 |
1 files changed, 192 insertions, 102 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index fd2e96af48b..5f07cbb329d 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el | |||
| @@ -123,7 +123,7 @@ | |||
| 123 | ;; | 123 | ;; |
| 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 "2016-03-22-7547e76-vpo-GNU" | 126 | (defconst verilog-mode-version "2016-11-14-26d3540-vpo-GNU" |
| 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.") |
| @@ -753,6 +753,13 @@ mode is experimental." | |||
| 753 | :type 'boolean) | 753 | :type 'boolean) |
| 754 | (put 'verilog-auto-declare-nettype 'safe-local-variable `stringp) | 754 | (put 'verilog-auto-declare-nettype 'safe-local-variable `stringp) |
| 755 | 755 | ||
| 756 | (defcustom verilog-auto-wire-comment t | ||
| 757 | "Non-nil indicates to insert to/from comments with `verilog-auto-wire' etc." | ||
| 758 | :version "25.1" | ||
| 759 | :group 'verilog-mode-actions | ||
| 760 | :type 'boolean) | ||
| 761 | (put 'verilog-auto-wire-comment 'safe-local-variable `verilog-booleanp) | ||
| 762 | |||
| 756 | (defcustom verilog-auto-wire-type nil | 763 | (defcustom verilog-auto-wire-type nil |
| 757 | "Non-nil specifies the data type to use with `verilog-auto-wire' etc. | 764 | "Non-nil specifies the data type to use with `verilog-auto-wire' etc. |
| 758 | Set this to \"logic\" for SystemVerilog code, or use `verilog-auto-logic'." | 765 | Set this to \"logic\" for SystemVerilog code, or use `verilog-auto-logic'." |
| @@ -1131,32 +1138,67 @@ be replaced, and will remain symbolic. | |||
| 1131 | For example, imagine a submodule uses parameters to declare the size of its | 1138 | For example, imagine a submodule uses parameters to declare the size of its |
| 1132 | inputs. This is then used by an upper module: | 1139 | inputs. This is then used by an upper module: |
| 1133 | 1140 | ||
| 1134 | module InstModule (o,i); | 1141 | module InstModule (o,i); |
| 1135 | parameter WIDTH; | 1142 | parameter WIDTH; |
| 1136 | input [WIDTH-1:0] i; | 1143 | input [WIDTH-1:0] i; |
| 1137 | endmodule | 1144 | parameter type OUT_t; |
| 1145 | output OUT_t o; | ||
| 1146 | endmodule | ||
| 1138 | 1147 | ||
| 1139 | module ExampInst; | 1148 | module ExampInst; |
| 1140 | InstModule | 1149 | /*AUTOOUTPUT*/ |
| 1141 | #(.PARAM(10)) | 1150 | // Beginning of automatic outputs |
| 1142 | instName | 1151 | output OUT_t o; |
| 1143 | (/*AUTOINST*/ | 1152 | // End of automatics |
| 1144 | .i (i[PARAM-1:0])); | 1153 | |
| 1154 | InstModule | ||
| 1155 | #(.WIDTH(10), | ||
| 1156 | ,.OUT_t(upper_t)) | ||
| 1157 | instName | ||
| 1158 | (/*AUTOINST*/ | ||
| 1159 | .i (i[WIDTH-1:0]), | ||
| 1160 | .o (o)); | ||
| 1161 | |||
| 1162 | Note even though WIDTH=10, the AUTOINST has left the parameter as | ||
| 1163 | a symbolic name. Likewise the OUT_t is preserved as the name | ||
| 1164 | from the instantiated module. | ||
| 1145 | 1165 | ||
| 1146 | Note even though PARAM=10, the AUTOINST has left the parameter as a | 1166 | If `verilog-auto-inst-param-value' is set, this will |
| 1147 | symbolic name. If `verilog-auto-inst-param-value' is set, this will | ||
| 1148 | instead expand to: | 1167 | instead expand to: |
| 1149 | 1168 | ||
| 1150 | module ExampInst; | 1169 | module ExampInst; |
| 1151 | InstModule | 1170 | /*AUTOOUTPUT*/ |
| 1152 | #(.PARAM(10)) | 1171 | // Beginning of automatic outputs |
| 1153 | instName | 1172 | output upper_t o; |
| 1154 | (/*AUTOINST*/ | 1173 | // End of automatics |
| 1155 | .i (i[9:0]));" | 1174 | |
| 1175 | InstModule | ||
| 1176 | #(.WIDTH(10), | ||
| 1177 | ,.OUT_t(upper_t)) | ||
| 1178 | instName | ||
| 1179 | (/*AUTOINST*/ | ||
| 1180 | .i (i[9:0]), | ||
| 1181 | .o (o)); | ||
| 1182 | |||
| 1183 | Note that the instantiation now has \"i[9:0]\" as the WIDTH | ||
| 1184 | was expanded. Likewise the data type of \"o\" in the AUTOOUTPUT | ||
| 1185 | is now upper_t, from the OUT_t parameter override. | ||
| 1186 | This second expansion of parameter types can be overridden with | ||
| 1187 | `verilog-auto-inst-param-value-type'." | ||
| 1156 | :group 'verilog-mode-auto | 1188 | :group 'verilog-mode-auto |
| 1157 | :type 'boolean) | 1189 | :type 'boolean) |
| 1158 | (put 'verilog-auto-inst-param-value 'safe-local-variable 'verilog-booleanp) | 1190 | (put 'verilog-auto-inst-param-value 'safe-local-variable 'verilog-booleanp) |
| 1159 | 1191 | ||
| 1192 | (defcustom verilog-auto-inst-param-value-type t | ||
| 1193 | "Non-nil means expand parameter type in instantiations. | ||
| 1194 | If nil, leave parameter types as symbolic names. | ||
| 1195 | |||
| 1196 | See `verilog-auto-inst-param-value'." | ||
| 1197 | :version "25.1" | ||
| 1198 | :group 'verilog-mode-auto | ||
| 1199 | :type 'boolean) | ||
| 1200 | (put 'verilog-auto-inst-param-value-type 'safe-local-variable 'verilog-booleanp) | ||
| 1201 | |||
| 1160 | (defcustom verilog-auto-inst-sort nil | 1202 | (defcustom verilog-auto-inst-sort nil |
| 1161 | "Non-nil means AUTOINST signals will be sorted, not in declaration order. | 1203 | "Non-nil means AUTOINST signals will be sorted, not in declaration order. |
| 1162 | Also affects AUTOINSTPARAM. Declaration order is the default for | 1204 | Also affects AUTOINSTPARAM. Declaration order is the default for |
| @@ -1761,7 +1803,7 @@ so there may be a large up front penalty for the first search." | |||
| 1761 | (let (pt) | 1803 | (let (pt) |
| 1762 | (while (and (not pt) | 1804 | (while (and (not pt) |
| 1763 | (re-search-forward regexp bound noerror)) | 1805 | (re-search-forward regexp bound noerror)) |
| 1764 | (if (verilog-inside-comment-or-string-p) | 1806 | (if (verilog-inside-comment-or-string-p (match-beginning 0)) |
| 1765 | (re-search-forward "[/\"\n]" nil t) ; Only way a comment or quote can end | 1807 | (re-search-forward "[/\"\n]" nil t) ; Only way a comment or quote can end |
| 1766 | (setq pt (match-end 0)))) | 1808 | (setq pt (match-end 0)))) |
| 1767 | pt)) | 1809 | pt)) |
| @@ -1775,7 +1817,7 @@ so there may be a large up front penalty for the first search." | |||
| 1775 | (let (pt) | 1817 | (let (pt) |
| 1776 | (while (and (not pt) | 1818 | (while (and (not pt) |
| 1777 | (re-search-backward regexp bound noerror)) | 1819 | (re-search-backward regexp bound noerror)) |
| 1778 | (if (verilog-inside-comment-or-string-p) | 1820 | (if (verilog-inside-comment-or-string-p (match-beginning 0)) |
| 1779 | (re-search-backward "[/\"]" nil t) ; Only way a comment or quote can begin | 1821 | (re-search-backward "[/\"]" nil t) ; Only way a comment or quote can begin |
| 1780 | (setq pt (match-beginning 0)))) | 1822 | (setq pt (match-beginning 0)))) |
| 1781 | pt)) | 1823 | pt)) |
| @@ -2561,15 +2603,15 @@ find the errors." | |||
| 2561 | "\\|\\(\\<table\\>\\)" ;7 | 2603 | "\\|\\(\\<table\\>\\)" ;7 |
| 2562 | "\\|\\(\\<specify\\>\\)" ;8 | 2604 | "\\|\\(\\<specify\\>\\)" ;8 |
| 2563 | "\\|\\(\\<function\\>\\)" ;9 | 2605 | "\\|\\(\\<function\\>\\)" ;9 |
| 2564 | "\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)*\\<function\\>\\)" ;10 | 2606 | "\\|\\(\\(?:\\<\\(?:virtual\\|protected\\|static\\)\\>\\s-+\\)*\\<function\\>\\)" ;10 |
| 2565 | "\\|\\(\\<task\\>\\)" ;14 | 2607 | "\\|\\(\\<task\\>\\)" ;11 |
| 2566 | "\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)*\\<task\\>\\)" ;15 | 2608 | "\\|\\(\\(?:\\<\\(?:virtual\\|protected\\|static\\)\\>\\s-+\\)*\\<task\\>\\)" ;12 |
| 2567 | "\\|\\(\\<generate\\>\\)" ;18 | 2609 | "\\|\\(\\<generate\\>\\)" ;13 |
| 2568 | "\\|\\(\\<covergroup\\>\\)" ;16 20 | 2610 | "\\|\\(\\<covergroup\\>\\)" ;14 |
| 2569 | "\\|\\(\\(\\(\\<cover\\>\\s-+\\)\\|\\(\\<assert\\>\\s-+\\)\\)*\\<property\\>\\)" ;17 21 | 2611 | "\\|\\(\\(?:\\(?:\\<cover\\>\\s-+\\)\\|\\(?:\\<assert\\>\\s-+\\)\\)*\\<property\\>\\)" ;15 |
| 2570 | "\\|\\(\\<\\(rand\\)?sequence\\>\\)" ;21 25 | 2612 | "\\|\\(\\<\\(?:rand\\)?sequence\\>\\)" ;16 |
| 2571 | "\\|\\(\\<clocking\\>\\)" ;22 27 | 2613 | "\\|\\(\\<clocking\\>\\)" ;17 |
| 2572 | "\\|\\(\\<`[ou]vm_[a-z_]+_begin\\>\\)" ;28 | 2614 | "\\|\\(\\<`[ou]vm_[a-z_]+_begin\\>\\)" ;18 |
| 2573 | "\\|\\(\\<`vmm_[a-z_]+_member_begin\\>\\)" | 2615 | "\\|\\(\\<`vmm_[a-z_]+_member_begin\\>\\)" |
| 2574 | ;; | 2616 | ;; |
| 2575 | )) | 2617 | )) |
| @@ -2812,10 +2854,12 @@ find the errors." | |||
| 2812 | "\\(\\<\\(import\\|export\\)\\>\\s-+\"DPI\\(-C\\)?\"\\s-+\\(\\<\\(context\\|pure\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\<\\(function\\|task\\)\\>\\)" | 2854 | "\\(\\<\\(import\\|export\\)\\>\\s-+\"DPI\\(-C\\)?\"\\s-+\\(\\<\\(context\\|pure\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\<\\(function\\|task\\)\\>\\)" |
| 2813 | )) | 2855 | )) |
| 2814 | 2856 | ||
| 2857 | (defconst verilog-default-clocking-re "\\<default\\s-+clocking\\>") | ||
| 2815 | (defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>") | 2858 | (defconst verilog-disable-fork-re "\\(disable\\|wait\\)\\s-+fork\\>") |
| 2816 | (defconst verilog-extended-case-re "\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\)") | 2859 | (defconst verilog-extended-case-re "\\(\\(unique0?\\s-+\\|priority\\s-+\\)?case[xz]?\\|randcase\\)") |
| 2817 | (defconst verilog-extended-complete-re | 2860 | (defconst verilog-extended-complete-re |
| 2818 | (concat "\\(\\(\\<extern\\s-+\\|\\<\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)" | 2861 | ;; verilog-beg-of-statement also looks backward one token to extend this match |
| 2862 | (concat "\\(\\(\\<extern\\s-+\\|\\<\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?virtual\\s-+\\|\\<protected\\s-+\\|\\<static\\s-+\\)*\\(\\<function\\>\\|\\<task\\>\\)\\)" | ||
| 2819 | "\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)" | 2863 | "\\|\\(\\(\\<typedef\\>\\s-+\\)*\\(\\<struct\\>\\|\\<union\\>\\|\\<class\\>\\)\\)" |
| 2820 | "\\|\\(\\(\\<\\(import\\|export\\)\\>\\s-+\\)?\\(\"DPI\\(-C\\)?\"\\s-+\\)?\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\(function\\>\\|task\\>\\)\\)" | 2864 | "\\|\\(\\(\\<\\(import\\|export\\)\\>\\s-+\\)?\\(\"DPI\\(-C\\)?\"\\s-+\\)?\\(\\<\\(pure\\|context\\)\\>\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_]*\\s-*=\\s-*\\)?\\(function\\>\\|task\\>\\)\\)" |
| 2821 | "\\|" verilog-extended-case-re )) | 2865 | "\\|" verilog-extended-case-re )) |
| @@ -3584,28 +3628,28 @@ Use filename, if current buffer being edited shorten to just buffer name." | |||
| 3584 | ;; Search forward for matching endfunction | 3628 | ;; Search forward for matching endfunction |
| 3585 | (setq reg "\\<endfunction\\>" ) | 3629 | (setq reg "\\<endfunction\\>" ) |
| 3586 | (setq nest 'no)) | 3630 | (setq nest 'no)) |
| 3587 | ((match-end 14) | 3631 | ((match-end 11) |
| 3588 | ;; Search forward for matching endtask | 3632 | ;; Search forward for matching endtask |
| 3589 | (setq reg "\\<endtask\\>" ) | 3633 | (setq reg "\\<endtask\\>" ) |
| 3590 | (setq nest 'no)) | 3634 | (setq nest 'no)) |
| 3591 | ((match-end 15) | 3635 | ((match-end 12) |
| 3592 | ;; Search forward for matching endtask | 3636 | ;; Search forward for matching endtask |
| 3593 | (setq reg "\\<endtask\\>" ) | 3637 | (setq reg "\\<endtask\\>" ) |
| 3594 | (setq nest 'no)) | 3638 | (setq nest 'no)) |
| 3595 | ((match-end 19) | 3639 | ((match-end 12) |
| 3596 | ;; Search forward for matching endgenerate | 3640 | ;; Search forward for matching endgenerate |
| 3597 | (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" )) | 3641 | (setq reg "\\(\\<generate\\>\\)\\|\\(\\<endgenerate\\>\\)" )) |
| 3598 | ((match-end 20) | 3642 | ((match-end 13) |
| 3599 | ;; Search forward for matching endgroup | 3643 | ;; Search forward for matching endgroup |
| 3600 | (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" )) | 3644 | (setq reg "\\(\\<covergroup\\>\\)\\|\\(\\<endgroup\\>\\)" )) |
| 3601 | ((match-end 21) | 3645 | ((match-end 14) |
| 3602 | ;; Search forward for matching endproperty | 3646 | ;; Search forward for matching endproperty |
| 3603 | (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" )) | 3647 | (setq reg "\\(\\<property\\>\\)\\|\\(\\<endproperty\\>\\)" )) |
| 3604 | ((match-end 25) | 3648 | ((match-end 15) |
| 3605 | ;; Search forward for matching endsequence | 3649 | ;; Search forward for matching endsequence |
| 3606 | (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" ) | 3650 | (setq reg "\\(\\<\\(rand\\)?sequence\\>\\)\\|\\(\\<endsequence\\>\\)" ) |
| 3607 | (setq md 3)) ; 3 to get to endsequence in the reg above | 3651 | (setq md 3)) ; 3 to get to endsequence in the reg above |
| 3608 | ((match-end 27) | 3652 | ((match-end 17) |
| 3609 | ;; Search forward for matching endclocking | 3653 | ;; Search forward for matching endclocking |
| 3610 | (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" ))) | 3654 | (setq reg "\\(\\<clocking\\>\\)\\|\\(\\<endclocking\\>\\)" ))) |
| 3611 | (if (and reg | 3655 | (if (and reg |
| @@ -3884,7 +3928,10 @@ Key bindings specific to `verilog-mode-map' are: | |||
| 3884 | ;;; Integration with the speedbar | 3928 | ;;; Integration with the speedbar |
| 3885 | ;; | 3929 | ;; |
| 3886 | 3930 | ||
| 3887 | (declare-function speedbar-add-supported-extension "speedbar" (extension)) | 3931 | ;; Avoid problems with XEmacs byte-compiles. |
| 3932 | ;; For GNU Emacs, the eval-after-load will handle if it isn't loaded yet. | ||
| 3933 | (when (eval-when-compile (fboundp 'declare-function)) | ||
| 3934 | (declare-function speedbar-add-supported-extension "speedbar" (extension))) | ||
| 3888 | 3935 | ||
| 3889 | (defun verilog-speedbar-initialize () | 3936 | (defun verilog-speedbar-initialize () |
| 3890 | "Initialize speedbar to understand `verilog-mode'." | 3937 | "Initialize speedbar to understand `verilog-mode'." |
| @@ -4566,7 +4613,7 @@ Limit search to point LIM." | |||
| 4566 | (progn | 4613 | (progn |
| 4567 | (if | 4614 | (if |
| 4568 | (verilog-re-search-backward | 4615 | (verilog-re-search-backward |
| 4569 | "\\<\\(case[zx]?\\)\\>\\|;\\|\\<end\\>" nil 'move) | 4616 | "\\<\\(randcase\\|case[zx]?\\)\\>\\|;\\|\\<end\\>" nil 'move) |
| 4570 | (progn | 4617 | (progn |
| 4571 | (cond | 4618 | (cond |
| 4572 | ((match-end 1) | 4619 | ((match-end 1) |
| @@ -5692,13 +5739,17 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)." | |||
| 5692 | (goto-char here) | 5739 | (goto-char here) |
| 5693 | (throw 'nesting 'block))))) | 5740 | (throw 'nesting 'block))))) |
| 5694 | 5741 | ||
| 5695 | ((match-end 27) ; *sigh* might be a clocking declaration | 5742 | ((match-end 17) ; *sigh* might be a clocking declaration |
| 5696 | (let ((here (point))) | 5743 | (let ((here (point))) |
| 5697 | (if (verilog-in-paren) | 5744 | (cond ((verilog-in-paren) |
| 5698 | t ; this is a normal statement | 5745 | t) ; this is a normal statement |
| 5699 | (progn ; or is fork, starts a new block | 5746 | ((save-excursion |
| 5700 | (goto-char here) | 5747 | (verilog-beg-of-statement) |
| 5701 | (throw 'nesting 'block))))) | 5748 | (looking-at verilog-default-clocking-re)) |
| 5749 | t) ; default clocking, normal statement | ||
| 5750 | (t | ||
| 5751 | (goto-char here) ; or is clocking, starts a new block | ||
| 5752 | (throw 'nesting 'block))))) | ||
| 5702 | 5753 | ||
| 5703 | ;; need to consider typedef struct here... | 5754 | ;; need to consider typedef struct here... |
| 5704 | ((looking-at "\\<class\\|struct\\|function\\|task\\>") | 5755 | ((looking-at "\\<class\\|struct\\|function\\|task\\>") |
| @@ -5826,7 +5877,7 @@ Jump from end to matching begin, from endcase to matching case, and so on." | |||
| 5826 | "\\(\\<endcase\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))) | 5877 | "\\(\\<endcase\\>\\)\\|\\(\\<join\\(_any\\|_none\\)?\\>\\)" ))) |
| 5827 | ((looking-at "\\<endtask\\>") | 5878 | ((looking-at "\\<endtask\\>") |
| 5828 | ;; 2: Search back for matching task | 5879 | ;; 2: Search back for matching task |
| 5829 | (setq reg "\\(\\<task\\>\\)\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)+\\<task\\>\\)") | 5880 | (setq reg "\\(\\<task\\>\\)\\|\\(\\(\\<\\(virtual\\|protected\\|static\\)\\>\\s-+\\)+\\<task\\>\\)") |
| 5830 | (setq nesting 'no)) | 5881 | (setq nesting 'no)) |
| 5831 | ((looking-at "\\<endcase\\>") | 5882 | ((looking-at "\\<endcase\\>") |
| 5832 | (catch 'nesting | 5883 | (catch 'nesting |
| @@ -5848,7 +5899,7 @@ Jump from end to matching begin, from endcase to matching case, and so on." | |||
| 5848 | (setq reg "\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" )) | 5899 | (setq reg "\\(\\<specify\\>\\)\\|\\(\\<endspecify\\>\\)" )) |
| 5849 | ((looking-at "\\<endfunction\\>") | 5900 | ((looking-at "\\<endfunction\\>") |
| 5850 | ;; 8: Search back for matching function | 5901 | ;; 8: Search back for matching function |
| 5851 | (setq reg "\\(\\<function\\>\\)\\|\\(\\(\\(\\<virtual\\>\\s-+\\)\\|\\(\\<protected\\>\\s-+\\)\\)+\\<function\\>\\)") | 5902 | (setq reg "\\(\\<function\\>\\)\\|\\(\\(\\<\\(virtual\\|protected\\|static\\)\\>\\s-+\\)+\\<function\\>\\)") |
| 5852 | (setq nesting 'no)) | 5903 | (setq nesting 'no)) |
| 5853 | ;;(setq reg "\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" )) | 5904 | ;;(setq reg "\\(\\<function\\>\\)\\|\\(\\<endfunction\\>\\)" )) |
| 5854 | ((looking-at "\\<endgenerate\\>") | 5905 | ((looking-at "\\<endgenerate\\>") |
| @@ -6300,7 +6351,7 @@ Return >0 for nested struct." | |||
| 6300 | (let ((p (point))) | 6351 | (let ((p (point))) |
| 6301 | (and | 6352 | (and |
| 6302 | (equal (char-after) ?\{) | 6353 | (equal (char-after) ?\{) |
| 6303 | (forward-list) | 6354 | (ignore-errors (forward-list)) |
| 6304 | (progn (backward-char 1) | 6355 | (progn (backward-char 1) |
| 6305 | (verilog-backward-ws&directives) | 6356 | (verilog-backward-ws&directives) |
| 6306 | (and | 6357 | (and |
| @@ -7831,7 +7882,7 @@ See also `verilog-sk-header' for an alternative format." | |||
| 7831 | (if (verilog-sig-multidim sig) | 7882 | (if (verilog-sig-multidim sig) |
| 7832 | (let ((str "") (args (verilog-sig-multidim sig))) | 7883 | (let ((str "") (args (verilog-sig-multidim sig))) |
| 7833 | (while args | 7884 | (while args |
| 7834 | (setq str (concat str (car args))) | 7885 | (setq str (concat (car args) str)) |
| 7835 | (setq args (cdr args))) | 7886 | (setq args (cdr args))) |
| 7836 | str))) | 7887 | str))) |
| 7837 | (defsubst verilog-sig-modport (sig) | 7888 | (defsubst verilog-sig-modport (sig) |
| @@ -8352,7 +8403,8 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8352 | in-modport in-clocking in-ign-to-semi ptype ign-prop | 8403 | in-modport in-clocking in-ign-to-semi ptype ign-prop |
| 8353 | sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const | 8404 | sigs-in sigs-out sigs-inout sigs-var sigs-assign sigs-const |
| 8354 | sigs-gparam sigs-intf sigs-modports | 8405 | sigs-gparam sigs-intf sigs-modports |
| 8355 | vec expect-signal keywd newsig rvalue enum io signed typedefed multidim | 8406 | vec expect-signal keywd last-keywd newsig rvalue enum io |
| 8407 | signed typedefed multidim | ||
| 8356 | modport | 8408 | modport |
| 8357 | varstack tmp) | 8409 | varstack tmp) |
| 8358 | ;;(if dbg (setq dbg (concat dbg (format "\n\nverilog-read-decls START PT %s END %s\n" (point) end-mod-point)))) | 8410 | ;;(if dbg (setq dbg (concat dbg (format "\n\nverilog-read-decls START PT %s END %s\n" (point) end-mod-point)))) |
| @@ -8433,7 +8485,8 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8433 | ;; Normal or escaped identifier -- note we remember the \ if escaped | 8485 | ;; Normal or escaped identifier -- note we remember the \ if escaped |
| 8434 | ((looking-at "\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ \t\n\f]+\\)") | 8486 | ((looking-at "\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ \t\n\f]+\\)") |
| 8435 | (goto-char (match-end 0)) | 8487 | (goto-char (match-end 0)) |
| 8436 | (setq keywd (match-string-no-properties 1)) | 8488 | (setq last-keywd keywd |
| 8489 | keywd (match-string-no-properties 1)) | ||
| 8437 | (when (string-match "^\\\\" (match-string 1)) | 8490 | (when (string-match "^\\\\" (match-string 1)) |
| 8438 | (setq keywd (concat keywd " "))) ; Escaped ID needs space at end | 8491 | (setq keywd (concat keywd " "))) ; Escaped ID needs space at end |
| 8439 | ;; Add any :: package names to same identifier | 8492 | ;; Add any :: package names to same identifier |
| @@ -8498,7 +8551,8 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8498 | (setq functask (1- functask))) | 8551 | (setq functask (1- functask))) |
| 8499 | ((equal keywd "modport") | 8552 | ((equal keywd "modport") |
| 8500 | (setq in-modport t)) | 8553 | (setq in-modport t)) |
| 8501 | ((equal keywd "clocking") | 8554 | ((and (equal keywd "clocking") |
| 8555 | (not (equal last-keywd "default"))) | ||
| 8502 | (setq in-clocking t)) | 8556 | (setq in-clocking t)) |
| 8503 | ((equal keywd "import") | 8557 | ((equal keywd "import") |
| 8504 | (if v2kargs-ok ; import in module header, not a modport import | 8558 | (if v2kargs-ok ; import in module header, not a modport import |
| @@ -8623,12 +8677,20 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8623 | (defvar create-lockfiles) | 8677 | (defvar create-lockfiles) |
| 8624 | (defvar which-func-modes)) | 8678 | (defvar which-func-modes)) |
| 8625 | 8679 | ||
| 8626 | (defun verilog-read-sub-decls-sig (submoddecls comment port sig vec multidim mem) | 8680 | (defun verilog-read-sub-decls-type (par-values portdata) |
| 8681 | "For `verilog-read-sub-decls-line', decode a signal type." | ||
| 8682 | (let* ((type (verilog-sig-type portdata)) | ||
| 8683 | (pvassoc (assoc type par-values))) | ||
| 8684 | (cond ((member type '("wire" "reg")) nil) | ||
| 8685 | (pvassoc (nth 1 pvassoc)) | ||
| 8686 | (t type)))) | ||
| 8687 | |||
| 8688 | (defun verilog-read-sub-decls-sig (submoddecls par-values comment port sig vec multidim mem) | ||
| 8627 | "For `verilog-read-sub-decls-line', add a signal." | 8689 | "For `verilog-read-sub-decls-line', add a signal." |
| 8628 | ;; sig eq t to indicate .name syntax | 8690 | ;; sig eq t to indicate .name syntax |
| 8629 | ;;(message "vrsds: %s(%S)" port sig) | 8691 | ;;(message "vrsds: %s(%S)" port sig) |
| 8630 | (let ((dotname (eq sig t)) | 8692 | (let ((dotname (eq sig t)) |
| 8631 | portdata) | 8693 | portdata) |
| 8632 | (when sig | 8694 | (when sig |
| 8633 | (setq port (verilog-symbol-detick-denumber port)) | 8695 | (setq port (verilog-symbol-detick-denumber port)) |
| 8634 | (setq sig (if dotname port (verilog-symbol-detick-denumber sig))) | 8696 | (setq sig (if dotname port (verilog-symbol-detick-denumber sig))) |
| @@ -8647,8 +8709,7 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8647 | mem | 8709 | mem |
| 8648 | nil | 8710 | nil |
| 8649 | (verilog-sig-signed portdata) | 8711 | (verilog-sig-signed portdata) |
| 8650 | (unless (member (verilog-sig-type portdata) '("wire" "reg")) | 8712 | (verilog-read-sub-decls-type par-values portdata) |
| 8651 | (verilog-sig-type portdata)) | ||
| 8652 | multidim nil) | 8713 | multidim nil) |
| 8653 | sigs-inout))) | 8714 | sigs-inout))) |
| 8654 | ((or (setq portdata (assoc port (verilog-decls-get-outputs submoddecls))) | 8715 | ((or (setq portdata (assoc port (verilog-decls-get-outputs submoddecls))) |
| @@ -8666,8 +8727,7 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8666 | ;; Also for backwards compatibility we don't propagate | 8727 | ;; Also for backwards compatibility we don't propagate |
| 8667 | ;; "input wire" upwards. | 8728 | ;; "input wire" upwards. |
| 8668 | ;; See also `verilog-signals-edit-wire-reg'. | 8729 | ;; See also `verilog-signals-edit-wire-reg'. |
| 8669 | (unless (member (verilog-sig-type portdata) '("wire" "reg")) | 8730 | (verilog-read-sub-decls-type par-values portdata) |
| 8670 | (verilog-sig-type portdata)) | ||
| 8671 | multidim nil) | 8731 | multidim nil) |
| 8672 | sigs-out))) | 8732 | sigs-out))) |
| 8673 | ((or (setq portdata (assoc port (verilog-decls-get-inputs submoddecls))) | 8733 | ((or (setq portdata (assoc port (verilog-decls-get-inputs submoddecls))) |
| @@ -8680,8 +8740,7 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8680 | mem | 8740 | mem |
| 8681 | nil | 8741 | nil |
| 8682 | (verilog-sig-signed portdata) | 8742 | (verilog-sig-signed portdata) |
| 8683 | (unless (member (verilog-sig-type portdata) '("wire" "reg")) | 8743 | (verilog-read-sub-decls-type par-values portdata) |
| 8684 | (verilog-sig-type portdata)) | ||
| 8685 | multidim nil) | 8744 | multidim nil) |
| 8686 | sigs-in))) | 8745 | sigs-in))) |
| 8687 | ((setq portdata (assoc port (verilog-decls-get-interfaces submoddecls))) | 8746 | ((setq portdata (assoc port (verilog-decls-get-interfaces submoddecls))) |
| @@ -8693,7 +8752,7 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8693 | mem | 8752 | mem |
| 8694 | nil | 8753 | nil |
| 8695 | (verilog-sig-signed portdata) | 8754 | (verilog-sig-signed portdata) |
| 8696 | (verilog-sig-type portdata) | 8755 | (verilog-read-sub-decls-type par-values portdata) |
| 8697 | multidim nil) | 8756 | multidim nil) |
| 8698 | sigs-intf))) | 8757 | sigs-intf))) |
| 8699 | ((setq portdata (and verilog-read-sub-decls-in-interfaced | 8758 | ((setq portdata (and verilog-read-sub-decls-in-interfaced |
| @@ -8706,13 +8765,13 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8706 | mem | 8765 | mem |
| 8707 | nil | 8766 | nil |
| 8708 | (verilog-sig-signed portdata) | 8767 | (verilog-sig-signed portdata) |
| 8709 | (verilog-sig-type portdata) | 8768 | (verilog-read-sub-decls-type par-values portdata) |
| 8710 | multidim nil) | 8769 | multidim nil) |
| 8711 | sigs-intf))) | 8770 | sigs-intf))) |
| 8712 | ;; (t -- warning pin isn't defined.) ; Leave for lint tool | 8771 | ;; (t -- warning pin isn't defined.) ; Leave for lint tool |
| 8713 | ))))) | 8772 | ))))) |
| 8714 | 8773 | ||
| 8715 | (defun verilog-read-sub-decls-expr (submoddecls comment port expr) | 8774 | (defun verilog-read-sub-decls-expr (submoddecls par-values comment port expr) |
| 8716 | "For `verilog-read-sub-decls-line', parse a subexpression and add signals." | 8775 | "For `verilog-read-sub-decls-line', parse a subexpression and add signals." |
| 8717 | ;;(message "vrsde: `%s'" expr) | 8776 | ;;(message "vrsde: `%s'" expr) |
| 8718 | ;; Replace special /*[....]*/ comments inserted by verilog-auto-inst-port | 8777 | ;; Replace special /*[....]*/ comments inserted by verilog-auto-inst-port |
| @@ -8728,7 +8787,7 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8728 | (let ((mlst (split-string (match-string 1 expr) "[{},]")) | 8787 | (let ((mlst (split-string (match-string 1 expr) "[{},]")) |
| 8729 | mstr) | 8788 | mstr) |
| 8730 | (while (setq mstr (pop mlst)) | 8789 | (while (setq mstr (pop mlst)) |
| 8731 | (verilog-read-sub-decls-expr submoddecls comment port mstr))))) | 8790 | (verilog-read-sub-decls-expr submoddecls par-values comment port mstr))))) |
| 8732 | (t | 8791 | (t |
| 8733 | (let (sig vec multidim mem) | 8792 | (let (sig vec multidim mem) |
| 8734 | ;; Remove leading reduction operators, etc | 8793 | ;; Remove leading reduction operators, etc |
| @@ -8751,16 +8810,16 @@ Return an array of [outputs inouts inputs wire reg assign const]." | |||
| 8751 | (setq vec (match-string 1 expr) | 8810 | (setq vec (match-string 1 expr) |
| 8752 | expr (substring expr (match-end 0)))) | 8811 | expr (substring expr (match-end 0)))) |
| 8753 | ;; Find .[unpacked_memory] or .[unpacked][unpacked]... | 8812 | ;; Find .[unpacked_memory] or .[unpacked][unpacked]... |
| 8754 | (while (string-match "^\\s-*\\.\\(\\[[^]]+\\]\\)" expr) | 8813 | (while (string-match "^\\s-*\\.\\(\\(\\[[^]]+\\]\\)+\\)" expr) |
| 8755 | ;;(message "vrsde-m: `%s'" (match-string 1 expr)) | 8814 | ;;(message "vrsde-m: `%s'" (match-string 1 expr)) |
| 8756 | (setq mem (match-string 1 expr) | 8815 | (setq mem (match-string 1 expr) |
| 8757 | expr (substring expr (match-end 0)))) | 8816 | expr (substring expr (match-end 0)))) |
| 8758 | ;; If found signal, and nothing unrecognized, add the signal | 8817 | ;; If found signal, and nothing unrecognized, add the signal |
| 8759 | ;;(message "vrsde-rem: `%s'" expr) | 8818 | ;;(message "vrsde-rem: `%s'" expr) |
| 8760 | (when (and sig (string-match "^\\s-*$" expr)) | 8819 | (when (and sig (string-match "^\\s-*$" expr)) |
| 8761 | (verilog-read-sub-decls-sig submoddecls comment port sig vec multidim mem)))))) | 8820 | (verilog-read-sub-decls-sig submoddecls par-values comment port sig vec multidim mem)))))) |
| 8762 | 8821 | ||
| 8763 | (defun verilog-read-sub-decls-line (submoddecls comment) | 8822 | (defun verilog-read-sub-decls-line (submoddecls par-values comment) |
| 8764 | "For `verilog-read-sub-decls', read lines of port defs until none match. | 8823 | "For `verilog-read-sub-decls', read lines of port defs until none match. |
| 8765 | Inserts the list of signals found, using submodi to look up each port." | 8824 | Inserts the list of signals found, using submodi to look up each port." |
| 8766 | (let (done port) | 8825 | (let (done port) |
| @@ -8778,13 +8837,13 @@ Inserts the list of signals found, using submodi to look up each port." | |||
| 8778 | ;; .name | 8837 | ;; .name |
| 8779 | ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*[,)/]") | 8838 | ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*[,)/]") |
| 8780 | (verilog-read-sub-decls-sig | 8839 | (verilog-read-sub-decls-sig |
| 8781 | submoddecls comment (match-string-no-properties 1) t ; sig==t for .name | 8840 | submoddecls par-values comment (match-string-no-properties 1) t ; sig==t for .name |
| 8782 | nil nil nil) ; vec multidim mem | 8841 | nil nil nil) ; vec multidim mem |
| 8783 | (setq port nil)) | 8842 | (setq port nil)) |
| 8784 | ;; .\escaped_name | 8843 | ;; .\escaped_name |
| 8785 | ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*[,)/]") | 8844 | ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*[,)/]") |
| 8786 | (verilog-read-sub-decls-sig | 8845 | (verilog-read-sub-decls-sig |
| 8787 | submoddecls comment (concat (match-string-no-properties 1) " ") t ; sig==t for .name | 8846 | submoddecls par-values comment (concat (match-string-no-properties 1) " ") t ; sig==t for .name |
| 8788 | nil nil nil) ; vec multidim mem | 8847 | nil nil nil) ; vec multidim mem |
| 8789 | (setq port nil)) | 8848 | (setq port nil)) |
| 8790 | ;; random | 8849 | ;; random |
| @@ -8799,28 +8858,29 @@ Inserts the list of signals found, using submodi to look up each port." | |||
| 8799 | (when port | 8858 | (when port |
| 8800 | (cond ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*)") | 8859 | (cond ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*)") |
| 8801 | (verilog-read-sub-decls-sig | 8860 | (verilog-read-sub-decls-sig |
| 8802 | submoddecls comment port | 8861 | submoddecls par-values comment port |
| 8803 | (verilog-string-remove-spaces (match-string-no-properties 1)) ; sig | 8862 | (verilog-string-remove-spaces (match-string-no-properties 1)) ; sig |
| 8804 | nil nil nil)) ; vec multidim mem | 8863 | nil nil nil)) ; vec multidim mem |
| 8805 | ;; | 8864 | ;; |
| 8806 | ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*\\(\\[[^]]+\\]\\)\\s-*)") | 8865 | ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*\\(\\[[^]]+\\]\\)\\s-*)") |
| 8807 | (verilog-read-sub-decls-sig | 8866 | (verilog-read-sub-decls-sig |
| 8808 | submoddecls comment port | 8867 | submoddecls par-values comment port |
| 8809 | (verilog-string-remove-spaces (match-string-no-properties 1)) ; sig | 8868 | (verilog-string-remove-spaces (match-string-no-properties 1)) ; sig |
| 8810 | (match-string-no-properties 2) nil nil)) ; vec multidim mem | 8869 | (match-string-no-properties 2) nil nil)) ; vec multidim mem |
| 8811 | ;; Fastpath was above looking-at's. | 8870 | ;; Fastpath was above looking-at's. |
| 8812 | ;; For something more complicated invoke a parser | 8871 | ;; For something more complicated invoke a parser |
| 8813 | ((looking-at "[^)]+") | 8872 | ((looking-at "[^)]+") |
| 8814 | (verilog-read-sub-decls-expr | 8873 | (verilog-read-sub-decls-expr |
| 8815 | submoddecls comment port | 8874 | submoddecls par-values comment port |
| 8816 | (buffer-substring-no-properties | 8875 | (buffer-substring-no-properties |
| 8817 | (point) (1- (progn (search-backward "(") ; start at ( | 8876 | (point) (1- (progn (search-backward "(") ; start at ( |
| 8818 | (verilog-forward-sexp-ign-cmt 1) | 8877 | (verilog-forward-sexp-ign-cmt 1) |
| 8819 | (point)))))))) ; expr | 8878 | (point)))))))) ; expr |
| 8820 | ;; | 8879 | ;; |
| 8821 | (forward-line 1))))) | 8880 | (forward-line 1))))) |
| 8881 | ;;(verilog-read-sub-decls-line (verilog-subdecls-new nil nil nil nil nil) nil "Cmt") | ||
| 8822 | 8882 | ||
| 8823 | (defun verilog-read-sub-decls-gate (submoddecls comment submod end-inst-point) | 8883 | (defun verilog-read-sub-decls-gate (submoddecls par-values comment submod end-inst-point) |
| 8824 | "For `verilog-read-sub-decls', read lines of UDP gate decl until none match. | 8884 | "For `verilog-read-sub-decls', read lines of UDP gate decl until none match. |
| 8825 | Inserts the list of signals found." | 8885 | Inserts the list of signals found." |
| 8826 | (save-excursion | 8886 | (save-excursion |
| @@ -8844,7 +8904,7 @@ Inserts the list of signals found." | |||
| 8844 | (setq verilog-read-sub-decls-gate-ios (or (car iolist) "input") | 8904 | (setq verilog-read-sub-decls-gate-ios (or (car iolist) "input") |
| 8845 | iolist (cdr iolist)) | 8905 | iolist (cdr iolist)) |
| 8846 | (verilog-read-sub-decls-expr | 8906 | (verilog-read-sub-decls-expr |
| 8847 | submoddecls comment "primitive_port" | 8907 | submoddecls par-values comment "primitive_port" |
| 8848 | (match-string 0))) | 8908 | (match-string 0))) |
| 8849 | (t | 8909 | (t |
| 8850 | (forward-char 1) | 8910 | (forward-char 1) |
| @@ -8870,13 +8930,16 @@ Outputs comments above subcell signals, for example: | |||
| 8870 | .in (in));" | 8930 | .in (in));" |
| 8871 | (save-excursion | 8931 | (save-excursion |
| 8872 | (let ((end-mod-point (verilog-get-end-of-defun)) | 8932 | (let ((end-mod-point (verilog-get-end-of-defun)) |
| 8873 | st-point end-inst-point | 8933 | st-point end-inst-point par-values |
| 8874 | ;; below 3 modified by verilog-read-sub-decls-line | 8934 | ;; below 3 modified by verilog-read-sub-decls-line |
| 8875 | sigs-out sigs-inout sigs-in sigs-intf sigs-intfd) | 8935 | sigs-out sigs-inout sigs-in sigs-intf sigs-intfd) |
| 8876 | (verilog-beg-of-defun-quick) | 8936 | (verilog-beg-of-defun-quick) |
| 8877 | (while (verilog-re-search-forward-quick "\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-mod-point t) | 8937 | (while (verilog-re-search-forward-quick "\\(/\\*AUTOINST\\*/\\|\\.\\*\\)" end-mod-point t) |
| 8878 | (save-excursion | 8938 | (save-excursion |
| 8879 | (goto-char (match-beginning 0)) | 8939 | (goto-char (match-beginning 0)) |
| 8940 | (setq par-values (and verilog-auto-inst-param-value | ||
| 8941 | verilog-auto-inst-param-value-type | ||
| 8942 | (verilog-read-inst-param-value))) | ||
| 8880 | (unless (verilog-inside-comment-or-string-p) | 8943 | (unless (verilog-inside-comment-or-string-p) |
| 8881 | ;; Attempt to snarf a comment | 8944 | ;; Attempt to snarf a comment |
| 8882 | (let* ((submod (verilog-read-inst-module)) | 8945 | (let* ((submod (verilog-read-inst-module)) |
| @@ -8894,7 +8957,7 @@ Outputs comments above subcell signals, for example: | |||
| 8894 | (point)) | 8957 | (point)) |
| 8895 | st-point (point)) | 8958 | st-point (point)) |
| 8896 | (forward-char 1) | 8959 | (forward-char 1) |
| 8897 | (verilog-read-sub-decls-gate submoddecls comment submod end-inst-point)) | 8960 | (verilog-read-sub-decls-gate submoddecls par-values comment submod end-inst-point)) |
| 8898 | ;; Non-primitive | 8961 | ;; Non-primitive |
| 8899 | (t | 8962 | (t |
| 8900 | (when (setq submodi (verilog-modi-lookup submod t)) | 8963 | (when (setq submodi (verilog-modi-lookup submod t)) |
| @@ -8908,19 +8971,19 @@ Outputs comments above subcell signals, for example: | |||
| 8908 | ;; However I want it to be runnable even on user's manually added signals | 8971 | ;; However I want it to be runnable even on user's manually added signals |
| 8909 | (let ((verilog-read-sub-decls-in-interfaced t)) | 8972 | (let ((verilog-read-sub-decls-in-interfaced t)) |
| 8910 | (while (re-search-forward "\\s *(?\\s *// Interfaced" end-inst-point t) | 8973 | (while (re-search-forward "\\s *(?\\s *// Interfaced" end-inst-point t) |
| 8911 | (verilog-read-sub-decls-line submoddecls comment))) ; Modifies sigs-ifd | 8974 | (verilog-read-sub-decls-line submoddecls par-values comment))) ; Modifies sigs-ifd |
| 8912 | (goto-char st-point) | 8975 | (goto-char st-point) |
| 8913 | (while (re-search-forward "\\s *(?\\s *// Interfaces" end-inst-point t) | 8976 | (while (re-search-forward "\\s *(?\\s *// Interfaces" end-inst-point t) |
| 8914 | (verilog-read-sub-decls-line submoddecls comment)) ; Modifies sigs-out | 8977 | (verilog-read-sub-decls-line submoddecls par-values comment)) ; Modifies sigs-out |
| 8915 | (goto-char st-point) | 8978 | (goto-char st-point) |
| 8916 | (while (re-search-forward "\\s *(?\\s *// Outputs" end-inst-point t) | 8979 | (while (re-search-forward "\\s *(?\\s *// Outputs" end-inst-point t) |
| 8917 | (verilog-read-sub-decls-line submoddecls comment)) ; Modifies sigs-out | 8980 | (verilog-read-sub-decls-line submoddecls par-values comment)) ; Modifies sigs-out |
| 8918 | (goto-char st-point) | 8981 | (goto-char st-point) |
| 8919 | (while (re-search-forward "\\s *(?\\s *// Inouts" end-inst-point t) | 8982 | (while (re-search-forward "\\s *(?\\s *// Inouts" end-inst-point t) |
| 8920 | (verilog-read-sub-decls-line submoddecls comment)) ; Modifies sigs-inout | 8983 | (verilog-read-sub-decls-line submoddecls par-values comment)) ; Modifies sigs-inout |
| 8921 | (goto-char st-point) | 8984 | (goto-char st-point) |
| 8922 | (while (re-search-forward "\\s *(?\\s *// Inputs" end-inst-point t) | 8985 | (while (re-search-forward "\\s *(?\\s *// Inputs" end-inst-point t) |
| 8923 | (verilog-read-sub-decls-line submoddecls comment)) ; Modifies sigs-in | 8986 | (verilog-read-sub-decls-line submoddecls par-values comment)) ; Modifies sigs-in |
| 8924 | ))))))) | 8987 | ))))))) |
| 8925 | ;; Combine duplicate bits | 8988 | ;; Combine duplicate bits |
| 8926 | ;;(setq rr (vector sigs-out sigs-inout sigs-in)) | 8989 | ;;(setq rr (vector sigs-out sigs-inout sigs-in)) |
| @@ -9111,7 +9174,7 @@ IGNORE-NEXT is true to ignore next token, fake from inside case statement." | |||
| 9111 | ;;(if dbg (setq dbg (concat dbg (format "\tgot-end %s\n" exit-keywd)))) | 9174 | ;;(if dbg (setq dbg (concat dbg (format "\tgot-end %s\n" exit-keywd)))) |
| 9112 | (setq ignore-next nil rvalue semi-rvalue) | 9175 | (setq ignore-next nil rvalue semi-rvalue) |
| 9113 | (if (not exit-keywd) (setq end-else-check t))) | 9176 | (if (not exit-keywd) (setq end-else-check t))) |
| 9114 | ((member keywd '("case" "casex" "casez")) | 9177 | ((member keywd '("case" "casex" "casez" "randcase")) |
| 9115 | (skip-syntax-forward "w_") | 9178 | (skip-syntax-forward "w_") |
| 9116 | (verilog-read-always-signals-recurse "endcase" t nil) | 9179 | (verilog-read-always-signals-recurse "endcase" t nil) |
| 9117 | (setq ignore-next nil rvalue semi-rvalue) | 9180 | (setq ignore-next nil rvalue semi-rvalue) |
| @@ -9337,29 +9400,43 @@ Optionally associate it with the specified enumeration ENUMNAME." | |||
| 9337 | If the filename is provided, `verilog-library-flags' will be used to | 9400 | If the filename is provided, `verilog-library-flags' will be used to |
| 9338 | resolve it. If optional RECURSE is non-nil, recurse through \\=`includes. | 9401 | resolve it. If optional RECURSE is non-nil, recurse through \\=`includes. |
| 9339 | 9402 | ||
| 9340 | Parameters must be simple assignments to constants, or have their own | 9403 | Localparams must be simple assignments to constants, or have their own |
| 9341 | \"parameter\" label rather than a list of parameters. Thus: | 9404 | \"localparam\" label rather than a list of localparams. Thus: |
| 9342 | 9405 | ||
| 9343 | parameter X = 5, Y = 10; // Ok | 9406 | localparam X = 5, Y = 10; // Ok |
| 9344 | parameter X = {1\\='b1, 2\\='h2}; // Ok | 9407 | localparam X = {1\\='b1, 2\\='h2}; // Ok |
| 9345 | parameter X = {1\\='b1, 2\\='h2}, Y = 10; // Bad, make into 2 parameter lines | 9408 | localparam X = {1\\='b1, 2\\='h2}, Y = 10; // Bad, make into 2 localparam lines |
| 9346 | 9409 | ||
| 9347 | Defines must be simple text substitutions, one on a line, starting | 9410 | Defines must be simple text substitutions, one on a line, starting |
| 9348 | at the beginning of the line. Any ifdefs or multiline comments around the | 9411 | at the beginning of the line. Any ifdefs or multiline comments around the |
| 9349 | define are ignored. | 9412 | define are ignored. |
| 9350 | 9413 | ||
| 9351 | Defines are stored inside Emacs variables using the name vh-{definename}. | 9414 | Defines are stored inside Emacs variables using the name |
| 9415 | vh-{definename}. | ||
| 9352 | 9416 | ||
| 9353 | This function is useful for setting vh-* variables. The file variables | 9417 | Localparams define what symbols are constants so that AUTOSENSE |
| 9354 | feature can be used to set defines that `verilog-mode' can see; put at the | 9418 | will not include them in sensitivity lists. However any |
| 9355 | *END* of your file something like: | 9419 | parameters in the include file are not considered ports in the |
| 9420 | including file, thus will not appear in AUTOINSTPARAM lists for a | ||
| 9421 | parent module.. | ||
| 9422 | |||
| 9423 | The file variables feature can be used to set defines that | ||
| 9424 | `verilog-mode' can see; put at the *END* of your file something | ||
| 9425 | like: | ||
| 9356 | 9426 | ||
| 9357 | // Local Variables: | 9427 | // Local Variables: |
| 9358 | // vh-macro:\"macro_definition\" | 9428 | // vh-macro:\"macro_definition\" |
| 9359 | // End: | 9429 | // End: |
| 9360 | 9430 | ||
| 9361 | If macros are defined earlier in the same file and you want their values, | 9431 | If macros are defined earlier in the same file and you want their values, |
| 9362 | you can read them automatically (provided `enable-local-eval' is on): | 9432 | you can read them automatically with: |
| 9433 | |||
| 9434 | // Local Variables: | ||
| 9435 | // verilog-auto-read-includes:t | ||
| 9436 | // End: | ||
| 9437 | |||
| 9438 | Or a more specific alternative example, which requires haing | ||
| 9439 | `enable-local-eval' non-nil: | ||
| 9363 | 9440 | ||
| 9364 | // Local Variables: | 9441 | // Local Variables: |
| 9365 | // eval:(verilog-read-defines) | 9442 | // eval:(verilog-read-defines) |
| @@ -9427,6 +9504,13 @@ file. | |||
| 9427 | It is often useful put at the *END* of your file something like: | 9504 | It is often useful put at the *END* of your file something like: |
| 9428 | 9505 | ||
| 9429 | // Local Variables: | 9506 | // Local Variables: |
| 9507 | // verilog-auto-read-includes:t | ||
| 9508 | // End: | ||
| 9509 | |||
| 9510 | Or the equivalent longer version, which requires having | ||
| 9511 | `enable-local-eval' non-nil: | ||
| 9512 | |||
| 9513 | // Local Variables: | ||
| 9430 | // eval:(verilog-read-defines) | 9514 | // eval:(verilog-read-defines) |
| 9431 | // eval:(verilog-read-includes) | 9515 | // eval:(verilog-read-includes) |
| 9432 | // End: | 9516 | // End: |
| @@ -9848,9 +9932,14 @@ Uses the CURRENT filename, `verilog-library-extensions', | |||
| 9848 | `verilog-library-directories' and `verilog-library-files' | 9932 | `verilog-library-directories' and `verilog-library-files' |
| 9849 | variables to build the path." | 9933 | variables to build the path." |
| 9850 | ;; Return search locations for it | 9934 | ;; Return search locations for it |
| 9851 | (append (list current) ; first, current buffer | 9935 | (append (list current) ; first, current buffer |
| 9852 | (verilog-library-filenames module current t) | 9936 | (verilog-library-filenames module current t) |
| 9853 | verilog-library-files)) ; finally, any libraries | 9937 | ;; Finally any libraries; fixed up if using e.g. tramp |
| 9938 | (mapcar (lambda (fname) | ||
| 9939 | (if (file-name-absolute-p fname) | ||
| 9940 | (concat (file-remote-p current) fname) | ||
| 9941 | fname)) | ||
| 9942 | verilog-library-files))) | ||
| 9854 | 9943 | ||
| 9855 | ;; | 9944 | ;; |
| 9856 | ;; Module Information | 9945 | ;; Module Information |
| @@ -10270,8 +10359,9 @@ When MODI is non-null, also add to modi-cache, for tracking." | |||
| 10270 | direction)) | 10359 | direction)) |
| 10271 | indent-pt) | 10360 | indent-pt) |
| 10272 | (insert (if v2k "," ";")) | 10361 | (insert (if v2k "," ";")) |
| 10273 | (if (or (not (verilog-sig-comment sig)) | 10362 | (if (or (not verilog-auto-wire-comment) |
| 10274 | (equal "" (verilog-sig-comment sig))) | 10363 | (not (verilog-sig-comment sig)) |
| 10364 | (equal "" (verilog-sig-comment sig))) | ||
| 10275 | (insert "\n") | 10365 | (insert "\n") |
| 10276 | (indent-to (max 48 (+ indent-pt 40))) | 10366 | (indent-to (max 48 (+ indent-pt 40))) |
| 10277 | (verilog-insert "// " (verilog-sig-comment sig) "\n")) | 10367 | (verilog-insert "// " (verilog-sig-comment sig) "\n")) |
| @@ -10821,9 +10911,9 @@ Ignores WHITESPACE if t, and writes output to stdout if SHOW." | |||
| 10821 | Differences are between buffers B1 and B2, starting at point | 10911 | Differences are between buffers B1 and B2, starting at point |
| 10822 | DIFFPT. This function is called via `verilog-diff-function'." | 10912 | DIFFPT. This function is called via `verilog-diff-function'." |
| 10823 | (let ((name1 (with-current-buffer b1 (buffer-file-name)))) | 10913 | (let ((name1 (with-current-buffer b1 (buffer-file-name)))) |
| 10824 | (verilog-warn "%s:%d: Difference in AUTO expansion found" | 10914 | (verilog-warn-error "%s:%d: Difference in AUTO expansion found" |
| 10825 | name1 (with-current-buffer b1 | 10915 | name1 (with-current-buffer b1 |
| 10826 | (count-lines (point-min) diffpt))) | 10916 | (count-lines (point-min) diffpt))) |
| 10827 | (cond (noninteractive | 10917 | (cond (noninteractive |
| 10828 | (verilog-diff-file-with-buffer name1 b2 t t)) | 10918 | (verilog-diff-file-with-buffer name1 b2 t t)) |
| 10829 | (t | 10919 | (t |
| @@ -13040,7 +13130,7 @@ Typing \\[verilog-auto] will make this into: | |||
| 13040 | (verilog-read-signals | 13130 | (verilog-read-signals |
| 13041 | (save-excursion | 13131 | (save-excursion |
| 13042 | (verilog-re-search-backward-quick | 13132 | (verilog-re-search-backward-quick |
| 13043 | "\\(@\\|\\<\\(begin\\|if\\|case\\|always\\(_latch\\|_ff\\|_comb\\)?\\)\\>\\)" nil t) | 13133 | "\\(@\\|\\<\\(begin\\|if\\|case[xz]?\\|always\\(_latch\\|_ff\\|_comb\\)?\\)\\>\\)" nil t) |
| 13044 | (point)) | 13134 | (point)) |
| 13045 | (point))))) | 13135 | (point))))) |
| 13046 | (save-excursion | 13136 | (save-excursion |