diff options
| author | Wilson Snyder | 2024-03-01 12:11:07 -0500 |
|---|---|---|
| committer | Wilson Snyder | 2024-03-01 12:11:07 -0500 |
| commit | b2d18ff944ae374fa03579ca2574f1fba8ae2e4b (patch) | |
| tree | 70de68738fec4460fe40fa23ec44a313d513ad06 | |
| parent | 31a4bec609578afd453caf232f78e275c3a075bc (diff) | |
| download | emacs-b2d18ff944ae374fa03579ca2574f1fba8ae2e4b.tar.gz emacs-b2d18ff944ae374fa03579ca2574f1fba8ae2e4b.zip | |
Verilog-mode update from upstream https://github.com/veripool/verilog-mode
* lisp/progmodes/verilog-mode.el (verilog-auto-inst)
(verilog-auto-inst-param): Remove intended formfeeds. Our ability to
detect unintended formfeeds elsewhere outweighs their limited utility here.
Contributed by Mattias EngdegÄrd.
(verilog-at-constraint-p)
(verilog-at-struct-mv-p, verilog-at-struct-p, verilog-calc-1)
(verilog-in-case-region-p, verilog-in-fork-region-p)
(verilog-in-generate-region-p, verilog-set-auto-endcomments):
Fix indentation problem when there is a signal named "module_something"
(#1861). Cleanup RexEx groupings.
(verilog-read-sub-decls-expr):
Fix apostrophe parser in AUTOWIRE (#1854) (#1855).
(verilog-auto-inst-port): Fix AUTOINST
multi-dimensional array [] substitution. Reported by Caleb Begly.
(verilog-property-re, verilog-beg-of-statement, verilog-calc-1):
Concurrent SVA statement pattern-matching learns 'restrict property' and
'cover sequence' expression for proper indentation around those constructs. This
addresses more patterns in IEEE 1800-2017's 'concurrent_sasertion_statement'
grammar.
(verilog-read-sub-decls-line):
Fix `verilog-auto-ignore-concat' with parenthesis signals.
Reported by Dmitri Sorkin.
(verilog-simplify-range-expression): Fix
`verilog-auto-inst-param-value' confusing structure selects.
Reported by Mike Bertone.
| -rw-r--r-- | lisp/progmodes/verilog-mode.el | 114 |
1 files changed, 69 insertions, 45 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el index 6081372af33..7af78f2229a 100644 --- a/lisp/progmodes/verilog-mode.el +++ b/lisp/progmodes/verilog-mode.el | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | ;; Keywords: languages | 9 | ;; Keywords: languages |
| 10 | ;; The "Version" is the date followed by the decimal rendition of the Git | 10 | ;; The "Version" is the date followed by the decimal rendition of the Git |
| 11 | ;; commit hex. | 11 | ;; commit hex. |
| 12 | ;; Version: 2023.06.06.141322628 | 12 | ;; Version: 2024.03.01.121933719 |
| 13 | 13 | ||
| 14 | ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this | 14 | ;; Yoni Rabkin <yoni@rabkins.net> contacted the maintainer of this |
| 15 | ;; file on 19/3/2008, and the maintainer agreed that when a bug is | 15 | ;; file on 19/3/2008, and the maintainer agreed that when a bug is |
| @@ -124,7 +124,7 @@ | |||
| 124 | ;; | 124 | ;; |
| 125 | 125 | ||
| 126 | ;; This variable will always hold the version number of the mode | 126 | ;; This variable will always hold the version number of the mode |
| 127 | (defconst verilog-mode-version "2023-06-06-86c6984-vpo-GNU" | 127 | (defconst verilog-mode-version "2024-03-01-7448f97-vpo-GNU" |
| 128 | "Version of this Verilog mode.") | 128 | "Version of this Verilog mode.") |
| 129 | (defconst verilog-mode-release-emacs t | 129 | (defconst verilog-mode-release-emacs t |
| 130 | "If non-nil, this version of Verilog mode was released with Emacs itself.") | 130 | "If non-nil, this version of Verilog mode was released with Emacs itself.") |
| @@ -2556,11 +2556,13 @@ find the errors." | |||
| 2556 | (defconst verilog-assignment-operation-re-2 | 2556 | (defconst verilog-assignment-operation-re-2 |
| 2557 | (concat "\\(.*?\\)" verilog-assignment-operator-re)) | 2557 | (concat "\\(.*?\\)" verilog-assignment-operator-re)) |
| 2558 | 2558 | ||
| 2559 | ;; Loosely related to IEEE 1800's concurrent_assertion_statement | ||
| 2560 | (defconst verilog-concurrent-assertion-statement-re | ||
| 2561 | "\\(\\<\\(assert\\|assume\\|cover\\|restrict\\)\\>\\s-+\\<\\(property\\|sequence\\)\\>\\)\\|\\(\\<assert\\>\\)") | ||
| 2562 | |||
| 2559 | (defconst verilog-label-re (concat verilog-identifier-sym-re "\\s-*:\\s-*")) | 2563 | (defconst verilog-label-re (concat verilog-identifier-sym-re "\\s-*:\\s-*")) |
| 2560 | (defconst verilog-property-re | 2564 | (defconst verilog-property-re |
| 2561 | (concat "\\(" verilog-label-re "\\)?" | 2565 | (concat "\\(" verilog-label-re "\\)?" verilog-concurrent-assertion-statement-re)) |
| 2562 | ;; "\\(assert\\|assume\\|cover\\)\\s-+property\\>" | ||
| 2563 | "\\(\\(assert\\|assume\\|cover\\)\\>\\s-+\\<property\\>\\)\\|\\(assert\\)")) | ||
| 2564 | 2566 | ||
| 2565 | (defconst verilog-no-indent-begin-re | 2567 | (defconst verilog-no-indent-begin-re |
| 2566 | (eval-when-compile | 2568 | (eval-when-compile |
| @@ -2715,7 +2717,6 @@ find the errors." | |||
| 2715 | "\\(\\<fork\\>\\)\\|" ; 7 | 2717 | "\\(\\<fork\\>\\)\\|" ; 7 |
| 2716 | "\\(\\<if\\>\\)\\|" | 2718 | "\\(\\<if\\>\\)\\|" |
| 2717 | verilog-property-re "\\|" | 2719 | verilog-property-re "\\|" |
| 2718 | "\\(\\(" verilog-label-re "\\)?\\<assert\\>\\)\\|" | ||
| 2719 | "\\(\\<clocking\\>\\)\\|" | 2720 | "\\(\\<clocking\\>\\)\\|" |
| 2720 | "\\(\\<task\\>\\)\\|" | 2721 | "\\(\\<task\\>\\)\\|" |
| 2721 | "\\(\\<function\\>\\)\\|" | 2722 | "\\(\\<function\\>\\)\\|" |
| @@ -4843,7 +4844,7 @@ Uses `verilog-scan' cache." | |||
| 4843 | (not (or (looking-at "\\<") (forward-word-strictly -1))) | 4844 | (not (or (looking-at "\\<") (forward-word-strictly -1))) |
| 4844 | ;; stop if we see an assertion (perhaps labeled) | 4845 | ;; stop if we see an assertion (perhaps labeled) |
| 4845 | (and | 4846 | (and |
| 4846 | (looking-at "\\(\\w+\\W*:\\W*\\)?\\(\\<\\(assert\\|assume\\|cover\\)\\>\\s-+\\<property\\>\\)\\|\\(\\<assert\\>\\)") | 4847 | (looking-at (concat "\\(\\w+\\W*:\\W*\\)?" verilog-concurrent-assertion-statement-re)) |
| 4847 | (progn | 4848 | (progn |
| 4848 | (setq h (point)) | 4849 | (setq h (point)) |
| 4849 | (save-excursion | 4850 | (save-excursion |
| @@ -4970,7 +4971,7 @@ More specifically, point @ in the line foo : @ begin" | |||
| 4970 | (while t | 4971 | (while t |
| 4971 | (verilog-re-search-backward | 4972 | (verilog-re-search-backward |
| 4972 | (concat "\\(\\<module\\>\\)\\|\\(\\<connectmodule\\>\\)\\|\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|" | 4973 | (concat "\\(\\<module\\>\\)\\|\\(\\<connectmodule\\>\\)\\|\\(\\<randcase\\>\\|\\<case[xz]?\\>[^:]\\)\\|" |
| 4973 | "\\(\\<endcase\\>\\)\\>") | 4974 | "\\(\\<endcase\\>\\)") |
| 4974 | nil 'move) | 4975 | nil 'move) |
| 4975 | (cond | 4976 | (cond |
| 4976 | ((match-end 4) | 4977 | ((match-end 4) |
| @@ -5010,7 +5011,7 @@ More specifically, after a generate and before an endgenerate." | |||
| 5010 | (while (and | 5011 | (while (and |
| 5011 | (/= nest 0) | 5012 | (/= nest 0) |
| 5012 | (verilog-re-search-backward | 5013 | (verilog-re-search-backward |
| 5013 | "\\<\\(module\\)\\|\\(connectmodule\\)\\|\\(endmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\|\\(if\\)\\|\\(case\\)\\|\\(for\\)\\>" nil 'move) | 5014 | "\\<\\(?:\\(module\\)\\|\\(connectmodule\\)\\|\\(endmodule\\)\\|\\(generate\\)\\|\\(endgenerate\\)\\|\\(if\\)\\|\\(case\\)\\|\\(for\\)\\)\\>" nil 'move) |
| 5014 | (cond | 5015 | (cond |
| 5015 | ((match-end 1) ; module - we have crawled out | 5016 | ((match-end 1) ; module - we have crawled out |
| 5016 | (throw 'done 1)) | 5017 | (throw 'done 1)) |
| @@ -5038,7 +5039,7 @@ More specifically, after a generate and before an endgenerate." | |||
| 5038 | (save-excursion | 5039 | (save-excursion |
| 5039 | (while (and | 5040 | (while (and |
| 5040 | (/= nest 0) | 5041 | (/= nest 0) |
| 5041 | (verilog-re-search-backward "\\<\\(fork\\)\\|\\(join\\(_any\\|_none\\)?\\)\\>" lim 'move) | 5042 | (verilog-re-search-backward "\\<\\(?:\\(fork\\)\\|\\(join\\(_any\\|_none\\)?\\)\\)\\>" lim 'move) |
| 5042 | (cond | 5043 | (cond |
| 5043 | ((match-end 1) ; fork | 5044 | ((match-end 1) ; fork |
| 5044 | (setq nest (1- nest))) | 5045 | (setq nest (1- nest))) |
| @@ -5335,7 +5336,7 @@ primitive or interface named NAME." | |||
| 5335 | (match-end 3) | 5336 | (match-end 3) |
| 5336 | (goto-char there) | 5337 | (goto-char there) |
| 5337 | (let ((nest 0) | 5338 | (let ((nest 0) |
| 5338 | (reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)\\|\\(\\<if\\>\\)\\|\\(assert\\)")) | 5339 | (reg "\\(\\<begin\\>\\)\\|\\(\\<end\\>\\)\\|\\(\\<if\\>\\)\\|\\(\\<assert\\>\\)")) |
| 5339 | (catch 'skip | 5340 | (catch 'skip |
| 5340 | (while (verilog-re-search-backward reg nil 'move) | 5341 | (while (verilog-re-search-backward reg nil 'move) |
| 5341 | (cond | 5342 | (cond |
| @@ -6244,7 +6245,7 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)." | |||
| 6244 | (match-end 22)) | 6245 | (match-end 22)) |
| 6245 | (throw 'continue 'foo)) | 6246 | (throw 'continue 'foo)) |
| 6246 | 6247 | ||
| 6247 | ((looking-at "\\<class\\|struct\\|function\\|task\\>") | 6248 | ((looking-at "\\<\\(?:class\\|struct\\|function\\|task\\)\\>") |
| 6248 | ;; *sigh* These words have an optional prefix: | 6249 | ;; *sigh* These words have an optional prefix: |
| 6249 | ;; extern {virtual|protected}? function a(); | 6250 | ;; extern {virtual|protected}? function a(); |
| 6250 | ;; and we don't want to confuse this with | 6251 | ;; and we don't want to confuse this with |
| @@ -6268,12 +6269,16 @@ Return a list of two elements: (INDENT-TYPE INDENT-LEVEL)." | |||
| 6268 | (throw 'nesting 'defun)))) | 6269 | (throw 'nesting 'defun)))) |
| 6269 | 6270 | ||
| 6270 | ;; | 6271 | ;; |
| 6271 | ((looking-at "\\<property\\>") | 6272 | ((looking-at "\\<\\(property\\|sequence\\)\\>") |
| 6272 | ;; *sigh* | 6273 | ;; *sigh* |
| 6273 | ;; {assert|assume|cover} property (); are complete | 6274 | ;; - {assert|assume|cover|restrict} property (); are complete |
| 6274 | ;; and could also be labeled: - foo: assert property | 6275 | ;; - cover sequence (); is complete |
| 6275 | ;; but | 6276 | ;; and could also be labeled: |
| 6276 | ;; property ID () ... needs endproperty | 6277 | ;; - foo: assert property |
| 6278 | ;; - bar: cover sequence | ||
| 6279 | ;; but: | ||
| 6280 | ;; - property ID () ... needs endproperty | ||
| 6281 | ;; - sequence ID () ... needs endsequence | ||
| 6277 | (verilog-beg-of-statement) | 6282 | (verilog-beg-of-statement) |
| 6278 | (if (looking-at verilog-property-re) | 6283 | (if (looking-at verilog-property-re) |
| 6279 | (throw 'continue 'statement) ; We don't need an endproperty for these | 6284 | (throw 'continue 'statement) ; We don't need an endproperty for these |
| @@ -6940,7 +6945,7 @@ Also move point to constraint." | |||
| 6940 | (let ( (pt (point)) (pass 0)) | 6945 | (let ( (pt (point)) (pass 0)) |
| 6941 | (verilog-backward-ws&directives) | 6946 | (verilog-backward-ws&directives) |
| 6942 | (verilog-backward-token) | 6947 | (verilog-backward-token) |
| 6943 | (if (looking-at (concat "\\<constraint\\|coverpoint\\|cross\\|with\\>\\|" verilog-in-constraint-re)) | 6948 | (if (looking-at (concat "\\<\\(?:constraint\\|coverpoint\\|cross\\|with\\)\\>\\|" verilog-in-constraint-re)) |
| 6944 | (progn (setq pass 1) | 6949 | (progn (setq pass 1) |
| 6945 | (if (looking-at "\\<with\\>") | 6950 | (if (looking-at "\\<with\\>") |
| 6946 | (progn (verilog-backward-ws&directives) | 6951 | (progn (verilog-backward-ws&directives) |
| @@ -6981,7 +6986,7 @@ Also move point to constraint." | |||
| 6981 | (save-excursion | 6986 | (save-excursion |
| 6982 | (if (and (equal (char-after) ?\{) | 6987 | (if (and (equal (char-after) ?\{) |
| 6983 | (verilog-backward-token)) | 6988 | (verilog-backward-token)) |
| 6984 | (looking-at "\\<struct\\|union\\|packed\\|\\(un\\)?signed\\>") | 6989 | (looking-at "\\<\\(?:struct\\|union\\|packed\\|\\(un\\)?signed\\)\\>") |
| 6985 | nil))) | 6990 | nil))) |
| 6986 | 6991 | ||
| 6987 | (defun verilog-at-struct-mv-p () | 6992 | (defun verilog-at-struct-mv-p () |
| @@ -6989,7 +6994,7 @@ Also move point to constraint." | |||
| 6989 | (let ((pt (point))) | 6994 | (let ((pt (point))) |
| 6990 | (if (and (equal (char-after) ?\{) | 6995 | (if (and (equal (char-after) ?\{) |
| 6991 | (verilog-backward-token)) | 6996 | (verilog-backward-token)) |
| 6992 | (if (looking-at "\\<struct\\|union\\|packed\\|\\(un\\)?signed\\>") | 6997 | (if (looking-at "\\<\\(?:struct\\|union\\|packed\\|\\(un\\)?signed\\)\\>") |
| 6993 | (progn (verilog-beg-of-statement) (point)) | 6998 | (progn (verilog-beg-of-statement) (point)) |
| 6994 | (progn (goto-char pt) nil)) | 6999 | (progn (goto-char pt) nil)) |
| 6995 | (progn (goto-char pt) nil)))) | 7000 | (progn (goto-char pt) nil)))) |
| @@ -9675,7 +9680,7 @@ Return an array of [outputs inouts inputs wire reg assign const gparam intf]." | |||
| 9675 | (cond | 9680 | (cond |
| 9676 | ;; {..., a, b} requires us to recurse on a,b | 9681 | ;; {..., a, b} requires us to recurse on a,b |
| 9677 | ;; To support {#{},{#{a,b}} we'll just split everything on [{},] | 9682 | ;; To support {#{},{#{a,b}} we'll just split everything on [{},] |
| 9678 | ((string-match "^\\s-*{\\(.*\\)}\\s-*$" expr) | 9683 | ((string-match "^\\s-*'?{\\(.*\\)}\\s-*$" expr) |
| 9679 | (let ((mlst (split-string (match-string 1 expr) "[{},]")) | 9684 | (let ((mlst (split-string (match-string 1 expr) "[{},]")) |
| 9680 | mstr) | 9685 | mstr) |
| 9681 | (while (setq mstr (pop mlst)) | 9686 | (while (setq mstr (pop mlst)) |
| @@ -9755,7 +9760,10 @@ Inserts the list of signals found, using submodi to look up each port." | |||
| 9755 | ;; We intentionally ignore (non-escaped) signals with .s in them | 9760 | ;; We intentionally ignore (non-escaped) signals with .s in them |
| 9756 | ;; this prevents AUTOWIRE etc from noticing hierarchical sigs. | 9761 | ;; this prevents AUTOWIRE etc from noticing hierarchical sigs. |
| 9757 | (when port | 9762 | (when port |
| 9758 | (cond ((looking-at "[^\n]*AUTONOHOOKUP")) | 9763 | (cond ((and verilog-auto-ignore-concat |
| 9764 | (looking-at "[({]")) | ||
| 9765 | nil) ; {...} or (...) historically ignored with auto-ignore-concat | ||
| 9766 | ((looking-at "[^\n]*AUTONOHOOKUP")) | ||
| 9759 | ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*)") | 9767 | ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*)") |
| 9760 | (verilog-read-sub-decls-sig | 9768 | (verilog-read-sub-decls-sig |
| 9761 | submoddecls par-values comment port | 9769 | submoddecls par-values comment port |
| @@ -11436,7 +11444,7 @@ This repairs those mis-inserted by an AUTOARG." | |||
| 11436 | (while (string-match | 11444 | (while (string-match |
| 11437 | (concat "\\([[({:*/<>+-]\\)" ; - must be last | 11445 | (concat "\\([[({:*/<>+-]\\)" ; - must be last |
| 11438 | "(\\<\\([0-9A-Za-z_]+\\))" | 11446 | "(\\<\\([0-9A-Za-z_]+\\))" |
| 11439 | "\\([])}:*/<>+-]\\)") | 11447 | "\\([])}:*/<>.+-]\\)") |
| 11440 | out) | 11448 | out) |
| 11441 | (setq out (replace-match "\\1\\2\\3" nil nil out))) | 11449 | (setq out (replace-match "\\1\\2\\3" nil nil out))) |
| 11442 | (while (string-match | 11450 | (while (string-match |
| @@ -11531,7 +11539,8 @@ This repairs those mis-inserted by an AUTOARG." | |||
| 11531 | ;;(verilog-simplify-range-expression "[(TEST[1])-1:0]") | 11539 | ;;(verilog-simplify-range-expression "[(TEST[1])-1:0]") |
| 11532 | ;;(verilog-simplify-range-expression "[1<<2:8>>2]") ; [4:2] | 11540 | ;;(verilog-simplify-range-expression "[1<<2:8>>2]") ; [4:2] |
| 11533 | ;;(verilog-simplify-range-expression "[2*4/(4-2) +2+4 <<4 >>2]") | 11541 | ;;(verilog-simplify-range-expression "[2*4/(4-2) +2+4 <<4 >>2]") |
| 11534 | ;;(verilog-simplify-range-expression "[WIDTH*2/8-1:0]") | 11542 | ;;(verilog-simplify-range-expression "[WIDTH*2/8-1:0]") ; "[WIDTH*2/8-1:0]" |
| 11543 | ;;(verilog-simplify-range-expression "[(FOO).size:0]") ; "[FOO.size:0]" | ||
| 11535 | 11544 | ||
| 11536 | (defun verilog-clog2 (value) | 11545 | (defun verilog-clog2 (value) |
| 11537 | "Compute $clog2 - ceiling log2 of VALUE." | 11546 | "Compute $clog2 - ceiling log2 of VALUE." |
| @@ -12247,18 +12256,12 @@ If PAR-VALUES replace final strings with these parameter values." | |||
| 12247 | (vl-memory (verilog-sig-memory port-st)) | 12256 | (vl-memory (verilog-sig-memory port-st)) |
| 12248 | (vl-mbits (if (verilog-sig-multidim port-st) | 12257 | (vl-mbits (if (verilog-sig-multidim port-st) |
| 12249 | (verilog-sig-multidim-string port-st) "")) | 12258 | (verilog-sig-multidim-string port-st) "")) |
| 12250 | (vl-bits (if (or (eq verilog-auto-inst-vector t) | 12259 | (vl-bits (or (verilog-sig-bits port-st) "")) |
| 12251 | (and (eq verilog-auto-inst-vector `unsigned) | ||
| 12252 | (not (verilog-sig-signed port-st))) | ||
| 12253 | (not (assoc port (verilog-decls-get-signals moddecls))) | ||
| 12254 | (not (equal (verilog-sig-bits port-st) | ||
| 12255 | (verilog-sig-bits | ||
| 12256 | (assoc port (verilog-decls-get-signals moddecls)))))) | ||
| 12257 | (or (verilog-sig-bits port-st) "") | ||
| 12258 | "")) | ||
| 12259 | (case-fold-search nil) | 12260 | (case-fold-search nil) |
| 12260 | (check-values par-values) | 12261 | (check-values par-values) |
| 12261 | tpl-net dflt-bits) | 12262 | auto-inst-vector |
| 12263 | auto-inst-vector-tpl | ||
| 12264 | tpl-net dflt-bits) | ||
| 12262 | ;; Replace parameters in bit-width | 12265 | ;; Replace parameters in bit-width |
| 12263 | (when (and check-values | 12266 | (when (and check-values |
| 12264 | (not (equal vl-bits ""))) | 12267 | (not (equal vl-bits ""))) |
| @@ -12281,6 +12284,16 @@ If PAR-VALUES replace final strings with these parameter values." | |||
| 12281 | vl-mbits (verilog-simplify-range-expression vl-mbits) | 12284 | vl-mbits (verilog-simplify-range-expression vl-mbits) |
| 12282 | vl-memory (when vl-memory (verilog-simplify-range-expression vl-memory)) | 12285 | vl-memory (when vl-memory (verilog-simplify-range-expression vl-memory)) |
| 12283 | vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed | 12286 | vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed |
| 12287 | (setq auto-inst-vector | ||
| 12288 | (if (or (eq verilog-auto-inst-vector t) | ||
| 12289 | (and (eq verilog-auto-inst-vector `unsigned) | ||
| 12290 | (not (verilog-sig-signed port-st))) | ||
| 12291 | (not (assoc port (verilog-decls-get-signals moddecls))) | ||
| 12292 | (not (equal (verilog-sig-bits port-st) | ||
| 12293 | (verilog-sig-bits | ||
| 12294 | (assoc port (verilog-decls-get-signals moddecls)))))) | ||
| 12295 | vl-bits | ||
| 12296 | "")) | ||
| 12284 | ;; Default net value if not found | 12297 | ;; Default net value if not found |
| 12285 | (setq dflt-bits (if (or (and (verilog-sig-bits port-st) | 12298 | (setq dflt-bits (if (or (and (verilog-sig-bits port-st) |
| 12286 | (verilog-sig-multidim port-st)) | 12299 | (verilog-sig-multidim port-st)) |
| @@ -12290,7 +12303,7 @@ If PAR-VALUES replace final strings with these parameter values." | |||
| 12290 | (if vl-memory "." "") | 12303 | (if vl-memory "." "") |
| 12291 | (if vl-memory vl-memory "") | 12304 | (if vl-memory vl-memory "") |
| 12292 | "*/") | 12305 | "*/") |
| 12293 | (concat vl-bits)) | 12306 | (concat auto-inst-vector)) |
| 12294 | tpl-net (concat port | 12307 | tpl-net (concat port |
| 12295 | (if (and vl-modport | 12308 | (if (and vl-modport |
| 12296 | ;; .modport cannot be added if attachment is | 12309 | ;; .modport cannot be added if attachment is |
| @@ -12329,10 +12342,21 @@ If PAR-VALUES replace final strings with these parameter values." | |||
| 12329 | (if (numberp value) (setq value (number-to-string value))) | 12342 | (if (numberp value) (setq value (number-to-string value))) |
| 12330 | value)) | 12343 | value)) |
| 12331 | (substring tpl-net (match-end 0)))))) | 12344 | (substring tpl-net (match-end 0)))))) |
| 12345 | ;; Get range based off template net | ||
| 12346 | (setq auto-inst-vector-tpl | ||
| 12347 | (if (or (eq verilog-auto-inst-vector t) | ||
| 12348 | (and (eq verilog-auto-inst-vector `unsigned) | ||
| 12349 | (not (verilog-sig-signed port-st))) | ||
| 12350 | (not (assoc tpl-net (verilog-decls-get-signals moddecls))) | ||
| 12351 | (not (equal (verilog-sig-bits port-st) | ||
| 12352 | (verilog-sig-bits | ||
| 12353 | (assoc tpl-net (verilog-decls-get-signals moddecls)))))) | ||
| 12354 | vl-bits | ||
| 12355 | "")) | ||
| 12332 | ;; Replace @ and [] magic variables in final output | 12356 | ;; Replace @ and [] magic variables in final output |
| 12333 | (setq tpl-net (verilog-string-replace-matches "@" tpl-num nil nil tpl-net)) | 12357 | (setq tpl-net (verilog-string-replace-matches "@" tpl-num nil nil tpl-net)) |
| 12334 | (setq tpl-net (verilog-string-replace-matches "\\[\\]\\[\\]" dflt-bits nil nil tpl-net)) | 12358 | (setq tpl-net (verilog-string-replace-matches "\\[\\]\\[\\]" dflt-bits nil nil tpl-net)) |
| 12335 | (setq tpl-net (verilog-string-replace-matches "\\[\\]" vl-bits nil nil tpl-net))) | 12359 | (setq tpl-net (verilog-string-replace-matches "\\[\\]" auto-inst-vector-tpl nil nil tpl-net))) |
| 12336 | ;; Insert it | 12360 | ;; Insert it |
| 12337 | (when (or tpl-ass (not verilog-auto-inst-template-required)) | 12361 | (when (or tpl-ass (not verilog-auto-inst-template-required)) |
| 12338 | (verilog--auto-inst-first indent-pt section) | 12362 | (verilog--auto-inst-first indent-pt section) |
| @@ -12502,7 +12526,7 @@ Typing \\[verilog-auto] will make this into: | |||
| 12502 | endmodule | 12526 | endmodule |
| 12503 | 12527 | ||
| 12504 | Where the list of inputs and outputs came from the inst module. | 12528 | Where the list of inputs and outputs came from the inst module. |
| 12505 | 12529 | ||
| 12506 | Exceptions: | 12530 | Exceptions: |
| 12507 | 12531 | ||
| 12508 | Unless you are instantiating a module multiple times, or the module is | 12532 | Unless you are instantiating a module multiple times, or the module is |
| @@ -12527,7 +12551,7 @@ Exceptions: | |||
| 12527 | // Outputs | 12551 | // Outputs |
| 12528 | .o (o[31:0])); | 12552 | .o (o[31:0])); |
| 12529 | 12553 | ||
| 12530 | 12554 | ||
| 12531 | Templates: | 12555 | Templates: |
| 12532 | 12556 | ||
| 12533 | For multiple instantiations based upon a single template, create a | 12557 | For multiple instantiations based upon a single template, create a |
| @@ -12598,7 +12622,7 @@ Templates: | |||
| 12598 | .ptl_bus (ptl_busnew[3:0]), | 12622 | .ptl_bus (ptl_busnew[3:0]), |
| 12599 | .... | 12623 | .... |
| 12600 | 12624 | ||
| 12601 | 12625 | ||
| 12602 | Multiple Module Templates: | 12626 | Multiple Module Templates: |
| 12603 | 12627 | ||
| 12604 | The same template lines can be applied to multiple modules with | 12628 | The same template lines can be applied to multiple modules with |
| @@ -12613,7 +12637,7 @@ Multiple Module Templates: | |||
| 12613 | */ | 12637 | */ |
| 12614 | 12638 | ||
| 12615 | Note there is only one AUTO_TEMPLATE opening parenthesis. | 12639 | Note there is only one AUTO_TEMPLATE opening parenthesis. |
| 12616 | 12640 | ||
| 12617 | @ Templates: | 12641 | @ Templates: |
| 12618 | 12642 | ||
| 12619 | It is common to instantiate a cell multiple times, so templates make it | 12643 | It is common to instantiate a cell multiple times, so templates make it |
| @@ -12678,7 +12702,7 @@ Multiple Module Templates: | |||
| 12678 | .ptl_mapvalidx (BAR_ptl_mapvalid), | 12702 | .ptl_mapvalidx (BAR_ptl_mapvalid), |
| 12679 | .ptl_mapvalidp1x (ptl_mapvalid_BAR)); | 12703 | .ptl_mapvalidp1x (ptl_mapvalid_BAR)); |
| 12680 | 12704 | ||
| 12681 | 12705 | ||
| 12682 | Regexp Templates: | 12706 | Regexp Templates: |
| 12683 | 12707 | ||
| 12684 | A template entry of the form | 12708 | A template entry of the form |
| @@ -12702,7 +12726,7 @@ Regexp Templates: | |||
| 12702 | subscript: | 12726 | subscript: |
| 12703 | 12727 | ||
| 12704 | .\\(.*\\)_l (\\1_[]), | 12728 | .\\(.*\\)_l (\\1_[]), |
| 12705 | 12729 | ||
| 12706 | Lisp Templates: | 12730 | Lisp Templates: |
| 12707 | 12731 | ||
| 12708 | First any regular expression template is expanded. | 12732 | First any regular expression template is expanded. |
| @@ -12747,7 +12771,7 @@ Lisp Templates: | |||
| 12747 | After the evaluation is completed, @ substitution and [] substitution | 12771 | After the evaluation is completed, @ substitution and [] substitution |
| 12748 | occur. | 12772 | occur. |
| 12749 | 12773 | ||
| 12750 | 12774 | ||
| 12751 | Ignoring Hookup: | 12775 | Ignoring Hookup: |
| 12752 | 12776 | ||
| 12753 | AUTOWIRE and related AUTOs will read the signals created by a template. | 12777 | AUTOWIRE and related AUTOs will read the signals created by a template. |
| @@ -12756,7 +12780,7 @@ Ignoring Hookup: | |||
| 12756 | 12780 | ||
| 12757 | .pci_req_l (pci_req_not_to_wire), //AUTONOHOOKUP | 12781 | .pci_req_l (pci_req_not_to_wire), //AUTONOHOOKUP |
| 12758 | 12782 | ||
| 12759 | 12783 | ||
| 12760 | For more information see the \\[verilog-faq] and forums at URL | 12784 | For more information see the \\[verilog-faq] and forums at URL |
| 12761 | `https://www.veripool.org'." | 12785 | `https://www.veripool.org'." |
| 12762 | (save-excursion | 12786 | (save-excursion |
| @@ -12910,7 +12934,7 @@ Typing \\[verilog-auto] will make this into: | |||
| 12910 | endmodule | 12934 | endmodule |
| 12911 | 12935 | ||
| 12912 | Where the list of parameter connections come from the inst module. | 12936 | Where the list of parameter connections come from the inst module. |
| 12913 | 12937 | ||
| 12914 | Templates: | 12938 | Templates: |
| 12915 | 12939 | ||
| 12916 | You can customize the parameter connections using AUTO_TEMPLATEs, | 12940 | You can customize the parameter connections using AUTO_TEMPLATEs, |