aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilson Snyder2015-11-13 21:17:57 -0500
committerWilson Snyder2015-11-13 21:17:57 -0500
commit9e00a029c4d7a8fa510fca878102623c74b50f85 (patch)
tree10a5013d84e8de7fdf5dcf6441909f0a588a5adb
parent138ad3d93b7abe08ac399f582aa6c8aac869e17e (diff)
downloademacs-9e00a029c4d7a8fa510fca878102623c74b50f85.tar.gz
emacs-9e00a029c4d7a8fa510fca878102623c74b50f85.zip
Update verilog-mode.el to 2015-11-09-b121d60-vpo.
* verilog-mode.el (verilog-auto, verilog-delete-auto) (verilog-modi-cache-results, verilog-save-buffer-state) (verilog-save-font-no-change-functions): When internally suppressing change functions, use `inhibit-modification-hooks' and call `after-change-funtions' to more nicely work with user hooks. Reported by Stefan Monnier. (verilog-auto, verilog-delete-auto, verilog-delete-auto-buffer): Create `verilog-delete-auto-buffer' to avoid double-calling fontification hooks. (verilog-restore-buffer-modified-p, verilog-auto) (verilog-save-buffer-state): Prefer restore-buffer-modified-p over set-buffer-modified-p. Reported by Stefan Monnier. (verilog-diff-auto, verilog-diff-buffers-p) (verilog-diff-ignore-regexp): Add `verilog-diff-ignore-regexp'. (verilog-auto-inst-port, verilog-read-sub-decls-expr): Fix AUTOINST with unpacked dimensional parameters, bug981. Reported by by Amol Nagapurkar. (verilog-read-decls, verilog-read-sub-decls-line): Avoid unneeded properties inside internal structures. No functional change intended.
-rw-r--r--lisp/progmodes/verilog-mode.el499
1 files changed, 272 insertions, 227 deletions
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 489094b2e4f..5e03cf4dd6b 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 "2015-09-18-314cf1d-vpo-GNU" 126(defconst verilog-mode-version "2015-11-09-b121d60-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.")
@@ -230,10 +230,9 @@ STRING should be given if the last search was by `string-match' on STRING."
230 `(customize ,var)) 230 `(customize ,var))
231 ) 231 )
232 232
233 (unless (boundp 'inhibit-point-motion-hooks) 233 (defvar inhibit-modification-hooks)
234 (defvar inhibit-point-motion-hooks nil)) 234 (defvar inhibit-point-motion-hooks)
235 (unless (boundp 'deactivate-mark) 235 (defvar deactivate-mark)
236 (defvar deactivate-mark nil))
237 ) 236 )
238 ;; 237 ;;
239 ;; OK, do this stuff if we are NOT XEmacs: 238 ;; OK, do this stuff if we are NOT XEmacs:
@@ -327,6 +326,14 @@ wherever possible, since it is slow."
327 (not (null pos))))))) 326 (not (null pos)))))))
328 327
329(eval-and-compile 328(eval-and-compile
329 (cond
330 ((fboundp 'restore-buffer-modified-p)
331 ;; Faster, as does not update mode line when nothing changes
332 (defalias 'verilog-restore-buffer-modified-p 'restore-buffer-modified-p))
333 (t
334 (defalias 'verilog-restore-buffer-modified-p 'set-buffer-modified-p))))
335
336(eval-and-compile
330 ;; Both xemacs and emacs 337 ;; Both xemacs and emacs
331 (condition-case nil 338 (condition-case nil
332 (require 'diff) ; diff-command and diff-switches 339 (require 'diff) ; diff-command and diff-switches
@@ -827,6 +834,10 @@ Function takes three arguments, the original buffer, the
827difference buffer, and the point in original buffer with the 834difference buffer, and the point in original buffer with the
828first difference.") 835first difference.")
829 836
837(defvar verilog-diff-ignore-regexp nil
838 "Non-nil specifies regexp which `verilog-diff-auto' will ignore.
839This is typically nil.")
840
830;;; Compile support: 841;;; Compile support:
831;; 842;;
832 843
@@ -2937,8 +2948,6 @@ find the errors."
2937 (modify-syntax-entry ?> "." table) 2948 (modify-syntax-entry ?> "." table)
2938 (modify-syntax-entry ?& "." table) 2949 (modify-syntax-entry ?& "." table)
2939 (modify-syntax-entry ?| "." table) 2950 (modify-syntax-entry ?| "." table)
2940 ;; FIXME: This goes against Emacs conventions. Use "_" syntax instead and
2941 ;; then use regexps with things like "\\_<...\\_>".
2942 (modify-syntax-entry ?` "w" table) ; ` is part of definition symbols in Verilog 2951 (modify-syntax-entry ?` "w" table) ; ` is part of definition symbols in Verilog
2943 (modify-syntax-entry ?_ "w" table) 2952 (modify-syntax-entry ?_ "w" table)
2944 (modify-syntax-entry ?\' "." table) 2953 (modify-syntax-entry ?\' "." table)
@@ -3230,9 +3239,10 @@ user-visible changes to the buffer must not be within a
3230 (buffer-undo-list t) 3239 (buffer-undo-list t)
3231 (inhibit-read-only t) 3240 (inhibit-read-only t)
3232 (inhibit-point-motion-hooks t) 3241 (inhibit-point-motion-hooks t)
3242 (inhibit-modification-hooks t)
3233 (verilog-no-change-functions t) 3243 (verilog-no-change-functions t)
3234 before-change-functions 3244 before-change-functions ; XEmacs ignores inhibit-modification-hooks
3235 after-change-functions 3245 after-change-functions ; XEmacs ignores inhibit-modification-hooks
3236 deactivate-mark 3246 deactivate-mark
3237 buffer-file-name ; Prevent primitives checking 3247 buffer-file-name ; Prevent primitives checking
3238 buffer-file-truename) ; for file modification 3248 buffer-file-truename) ; for file modification
@@ -3240,41 +3250,44 @@ user-visible changes to the buffer must not be within a
3240 (progn ,@body) 3250 (progn ,@body)
3241 (and (not modified) 3251 (and (not modified)
3242 (buffer-modified-p) 3252 (buffer-modified-p)
3243 (set-buffer-modified-p nil))))) 3253 (verilog-restore-buffer-modified-p nil)))))
3244 3254
3245(defmacro verilog-save-no-change-functions (&rest body)
3246 "Execute BODY forms, disabling all change hooks in BODY.
3247For insignificant changes, see instead `verilog-save-buffer-state'."
3248 `(let* ((inhibit-point-motion-hooks t)
3249 (verilog-no-change-functions t)
3250 before-change-functions
3251 after-change-functions)
3252 (progn ,@body)))
3253 3255
3254(defvar verilog-save-font-mod-hooked nil 3256(defvar verilog-save-font-mod-hooked nil
3255 "Local variable when inside a `verilog-save-font-mods' block.") 3257 "Local variable when inside a `verilog-save-font-no-change-functions' block.")
3256(make-variable-buffer-local 'verilog-save-font-mod-hooked) 3258(make-variable-buffer-local 'verilog-save-font-mod-hooked)
3257 3259
3258(defmacro verilog-save-font-mods (&rest body) 3260(defmacro verilog-save-font-no-change-functions (&rest body)
3259 "Execute BODY forms, disabling text modifications to allow performing BODY. 3261 "Execute BODY forms, disabling all change hooks in BODY.
3260Includes temporary disabling of `font-lock' to restore the buffer 3262Includes temporary disabling of `font-lock' to restore the buffer
3261to full text form for parsing. Additional actions may be specified with 3263to full text form for parsing. Additional actions may be specified with
3262`verilog-before-save-font-hook' and `verilog-after-save-font-hook'." 3264`verilog-before-save-font-hook' and `verilog-after-save-font-hook'.
3263 ;; Before version 20, match-string with font-lock returns a 3265For insignificant changes, see instead `verilog-save-buffer-state'."
3264 ;; vector that is not equal to the string. IE if on "input" 3266 `(if verilog-save-font-mod-hooked ; A recursive call?
3265 ;; nil==(equal "input" (progn (looking-at "input") (match-string 0))) 3267 (progn ,@body)
3266 `(let* ((hooked (unless verilog-save-font-mod-hooked 3268 ;; Before version 20, match-string with font-lock returns a
3267 (verilog-run-hooks 'verilog-before-save-font-hook) 3269 ;; vector that is not equal to the string. IE if on "input"
3268 t)) 3270 ;; nil==(equal "input" (progn (looking-at "input") (match-string 0)))
3269 (verilog-save-font-mod-hooked t) 3271 ;; Therefore we must remove and restore font-lock mode
3270 (fontlocked (when (and (boundp 'font-lock-mode) font-lock-mode) 3272 (verilog-run-hooks 'verilog-before-save-font-hook)
3271 (font-lock-mode 0) 3273 (let* ((verilog-save-font-mod-hooked (- (point-max) (point-min)))
3272 t))) 3274 (fontlocked (when (and (boundp 'font-lock-mode) font-lock-mode)
3273 (unwind-protect 3275 (font-lock-mode 0)
3274 (progn ,@body) 3276 t)))
3275 ;; Unwind forms 3277 (run-hook-with-args 'before-change-functions (point-min) (point-max))
3276 (when fontlocked (font-lock-mode t)) 3278 (unwind-protect
3277 (when hooked (verilog-run-hooks 'verilog-after-save-font-hook))))) 3279 ;; Must inhibit and restore hooks before restoring font-lock
3280 (let* ((inhibit-point-motion-hooks t)
3281 (inhibit-modification-hooks t)
3282 (verilog-no-change-functions t)
3283 before-change-functions ; XEmacs ignores inhibit-modification-hooks
3284 after-change-functions) ; XEmacs ignores inhibit-modification-hooks
3285 (progn ,@body))
3286 ;; Unwind forms
3287 (run-hook-with-args 'after-change-functions (point-min) (point-max)
3288 verilog-save-font-mod-hooked) ; old length
3289 (when fontlocked (font-lock-mode t))
3290 (verilog-run-hooks 'verilog-after-save-font-hook)))))
3278 3291
3279;; 3292;;
3280;; Comment detection and caching 3293;; Comment detection and caching
@@ -8074,7 +8087,7 @@ Duplicate signals are also removed. For example A[2] and A[1] become A[2:1]."
8074 (when (and sv-busstring 8087 (when (and sv-busstring
8075 (not (equal sv-busstring (verilog-sig-bits sig)))) 8088 (not (equal sv-busstring (verilog-sig-bits sig))))
8076 (when nil ; Debugging 8089 (when nil ; Debugging
8077 (message (concat "Warning, can't merge into single bus %s%s" 8090 (message (concat "Warning, can't merge into single bus `%s%s'"
8078 ", the AUTOs may be wrong") 8091 ", the AUTOs may be wrong")
8079 sv-name bus)) 8092 sv-name bus))
8080 (setq buswarn ", Couldn't Merge")) 8093 (setq buswarn ", Couldn't Merge"))
@@ -8377,18 +8390,18 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8377 (setcar (cdr (cdr (cdr newsig))) 8390 (setcar (cdr (cdr (cdr newsig)))
8378 (if (verilog-sig-memory newsig) 8391 (if (verilog-sig-memory newsig)
8379 (concat (verilog-sig-memory newsig) (match-string 1)) 8392 (concat (verilog-sig-memory newsig) (match-string 1))
8380 (match-string 1)))) 8393 (match-string-no-properties 1))))
8381 (vec ; Multidimensional 8394 (vec ; Multidimensional
8382 (setq multidim (cons vec multidim)) 8395 (setq multidim (cons vec multidim))
8383 (setq vec (verilog-string-replace-matches 8396 (setq vec (verilog-string-replace-matches
8384 "\\s-+" "" nil nil (match-string 1)))) 8397 "\\s-+" "" nil nil (match-string-no-properties 1))))
8385 (t ; Bit width 8398 (t ; Bit width
8386 (setq vec (verilog-string-replace-matches 8399 (setq vec (verilog-string-replace-matches
8387 "\\s-+" "" nil nil (match-string 1)))))) 8400 "\\s-+" "" nil nil (match-string-no-properties 1))))))
8388 ;; Normal or escaped identifier -- note we remember the \ if escaped 8401 ;; Normal or escaped identifier -- note we remember the \ if escaped
8389 ((looking-at "\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ \t\n\f]+\\)") 8402 ((looking-at "\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ \t\n\f]+\\)")
8390 (goto-char (match-end 0)) 8403 (goto-char (match-end 0))
8391 (setq keywd (match-string 1)) 8404 (setq keywd (match-string-no-properties 1))
8392 (when (string-match "^\\\\" (match-string 1)) 8405 (when (string-match "^\\\\" (match-string 1))
8393 (setq keywd (concat keywd " "))) ; Escaped ID needs space at end 8406 (setq keywd (concat keywd " "))) ; Escaped ID needs space at end
8394 ;; Add any :: package names to same identifier 8407 ;; Add any :: package names to same identifier
@@ -8573,11 +8586,12 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8573 (defvar sigs-out-unk) 8586 (defvar sigs-out-unk)
8574 (defvar sigs-temp) 8587 (defvar sigs-temp)
8575 ;; These are known to be from other packages and may not be defined 8588 ;; These are known to be from other packages and may not be defined
8576 (defvar diff-command nil) 8589 (defvar diff-command)
8577 ;; There are known to be from newer versions of Emacs 8590 ;; There are known to be from newer versions of Emacs
8578 (defvar create-lockfiles)) 8591 (defvar create-lockfiles)
8592 (defvar which-func-modes))
8579 8593
8580(defun verilog-read-sub-decls-sig (submoddecls comment port sig vec multidim) 8594(defun verilog-read-sub-decls-sig (submoddecls comment port sig vec multidim mem)
8581 "For `verilog-read-sub-decls-line', add a signal." 8595 "For `verilog-read-sub-decls-line', add a signal."
8582 ;; sig eq t to indicate .name syntax 8596 ;; sig eq t to indicate .name syntax
8583 ;;(message "vrsds: %s(%S)" port sig) 8597 ;;(message "vrsds: %s(%S)" port sig)
@@ -8588,6 +8602,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8588 (setq sig (if dotname port (verilog-symbol-detick-denumber sig))) 8602 (setq sig (if dotname port (verilog-symbol-detick-denumber sig)))
8589 (if vec (setq vec (verilog-symbol-detick-denumber vec))) 8603 (if vec (setq vec (verilog-symbol-detick-denumber vec)))
8590 (if multidim (setq multidim (mapcar `verilog-symbol-detick-denumber multidim))) 8604 (if multidim (setq multidim (mapcar `verilog-symbol-detick-denumber multidim)))
8605 (if mem (setq mem (verilog-symbol-detick-denumber mem)))
8591 (unless (or (not sig) 8606 (unless (or (not sig)
8592 (equal sig "")) ; Ignore .foo(1'b1) assignments 8607 (equal sig "")) ; Ignore .foo(1'b1) assignments
8593 (cond ((or (setq portdata (assoc port (verilog-decls-get-inouts submoddecls))) 8608 (cond ((or (setq portdata (assoc port (verilog-decls-get-inouts submoddecls)))
@@ -8597,7 +8612,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8597 sig 8612 sig
8598 (if dotname (verilog-sig-bits portdata) vec) 8613 (if dotname (verilog-sig-bits portdata) vec)
8599 (concat "To/From " comment) 8614 (concat "To/From " comment)
8600 (verilog-sig-memory portdata) 8615 mem
8601 nil 8616 nil
8602 (verilog-sig-signed portdata) 8617 (verilog-sig-signed portdata)
8603 (unless (member (verilog-sig-type portdata) '("wire" "reg")) 8618 (unless (member (verilog-sig-type portdata) '("wire" "reg"))
@@ -8611,7 +8626,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8611 sig 8626 sig
8612 (if dotname (verilog-sig-bits portdata) vec) 8627 (if dotname (verilog-sig-bits portdata) vec)
8613 (concat "From " comment) 8628 (concat "From " comment)
8614 (verilog-sig-memory portdata) 8629 mem
8615 nil 8630 nil
8616 (verilog-sig-signed portdata) 8631 (verilog-sig-signed portdata)
8617 ;; Though ok in SV, in V2K code, propagating the 8632 ;; Though ok in SV, in V2K code, propagating the
@@ -8630,7 +8645,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8630 sig 8645 sig
8631 (if dotname (verilog-sig-bits portdata) vec) 8646 (if dotname (verilog-sig-bits portdata) vec)
8632 (concat "To " comment) 8647 (concat "To " comment)
8633 (verilog-sig-memory portdata) 8648 mem
8634 nil 8649 nil
8635 (verilog-sig-signed portdata) 8650 (verilog-sig-signed portdata)
8636 (unless (member (verilog-sig-type portdata) '("wire" "reg")) 8651 (unless (member (verilog-sig-type portdata) '("wire" "reg"))
@@ -8643,7 +8658,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8643 sig 8658 sig
8644 (if dotname (verilog-sig-bits portdata) vec) 8659 (if dotname (verilog-sig-bits portdata) vec)
8645 (concat "To/From " comment) 8660 (concat "To/From " comment)
8646 (verilog-sig-memory portdata) 8661 mem
8647 nil 8662 nil
8648 (verilog-sig-signed portdata) 8663 (verilog-sig-signed portdata)
8649 (verilog-sig-type portdata) 8664 (verilog-sig-type portdata)
@@ -8656,7 +8671,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8656 sig 8671 sig
8657 (if dotname (verilog-sig-bits portdata) vec) 8672 (if dotname (verilog-sig-bits portdata) vec)
8658 (concat "To/From " comment) 8673 (concat "To/From " comment)
8659 (verilog-sig-memory portdata) 8674 mem
8660 nil 8675 nil
8661 (verilog-sig-signed portdata) 8676 (verilog-sig-signed portdata)
8662 (verilog-sig-type portdata) 8677 (verilog-sig-type portdata)
@@ -8669,7 +8684,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8669 "For `verilog-read-sub-decls-line', parse a subexpression and add signals." 8684 "For `verilog-read-sub-decls-line', parse a subexpression and add signals."
8670 ;;(message "vrsde: `%s'" expr) 8685 ;;(message "vrsde: `%s'" expr)
8671 ;; Replace special /*[....]*/ comments inserted by verilog-auto-inst-port 8686 ;; Replace special /*[....]*/ comments inserted by verilog-auto-inst-port
8672 (setq expr (verilog-string-replace-matches "/\\*\\(\\[[^*]+\\]\\)\\*/" "\\1" nil nil expr)) 8687 (setq expr (verilog-string-replace-matches "/\\*\\(\\.?\\[[^*]+\\]\\)\\*/" "\\1" nil nil expr))
8673 ;; Remove front operators 8688 ;; Remove front operators
8674 (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" nil nil expr)) 8689 (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" nil nil expr))
8675 ;; 8690 ;;
@@ -8683,7 +8698,7 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8683 (while (setq mstr (pop mlst)) 8698 (while (setq mstr (pop mlst))
8684 (verilog-read-sub-decls-expr submoddecls comment port mstr))))) 8699 (verilog-read-sub-decls-expr submoddecls comment port mstr)))))
8685 (t 8700 (t
8686 (let (sig vec multidim) 8701 (let (sig vec multidim mem)
8687 ;; Remove leading reduction operators, etc 8702 ;; Remove leading reduction operators, etc
8688 (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" nil nil expr)) 8703 (setq expr (verilog-string-replace-matches "^\\s-*[---+~!|&]+\\s-*" "" nil nil expr))
8689 ;;(message "vrsde-ptop: `%s'" expr) 8704 ;;(message "vrsde-ptop: `%s'" expr)
@@ -8703,10 +8718,15 @@ Return an array of [outputs inouts inputs wire reg assign const]."
8703 (when vec (setq multidim (cons vec multidim))) 8718 (when vec (setq multidim (cons vec multidim)))
8704 (setq vec (match-string 1 expr) 8719 (setq vec (match-string 1 expr)
8705 expr (substring expr (match-end 0)))) 8720 expr (substring expr (match-end 0))))
8721 ;; Find .[unpacked_memory] or .[unpacked][unpacked]...
8722 (while (string-match "^\\s-*\\.\\(\\[[^]]+\\]\\)" expr)
8723 ;;(message "vrsde-m: `%s'" (match-string 1 expr))
8724 (setq mem (match-string 1 expr)
8725 expr (substring expr (match-end 0))))
8706 ;; If found signal, and nothing unrecognized, add the signal 8726 ;; If found signal, and nothing unrecognized, add the signal
8707 ;;(message "vrsde-rem: `%s'" expr) 8727 ;;(message "vrsde-rem: `%s'" expr)
8708 (when (and sig (string-match "^\\s-*$" expr)) 8728 (when (and sig (string-match "^\\s-*$" expr))
8709 (verilog-read-sub-decls-sig submoddecls comment port sig vec multidim)))))) 8729 (verilog-read-sub-decls-sig submoddecls comment port sig vec multidim mem))))))
8710 8730
8711(defun verilog-read-sub-decls-line (submoddecls comment) 8731(defun verilog-read-sub-decls-line (submoddecls comment)
8712 "For `verilog-read-sub-decls', read lines of port defs until none match. 8732 "For `verilog-read-sub-decls', read lines of port defs until none match.
@@ -8717,23 +8737,23 @@ Inserts the list of signals found, using submodi to look up each port."
8717 (while (not done) 8737 (while (not done)
8718 ;; Get port name 8738 ;; Get port name
8719 (cond ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*(\\s-*") 8739 (cond ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*(\\s-*")
8720 (setq port (match-string 1)) 8740 (setq port (match-string-no-properties 1))
8721 (goto-char (match-end 0))) 8741 (goto-char (match-end 0)))
8722 ;; .\escaped ( 8742 ;; .\escaped (
8723 ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*(\\s-*") 8743 ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*(\\s-*")
8724 (setq port (concat (match-string 1) " ")) ; escaped id's need trailing space 8744 (setq port (concat (match-string-no-properties 1) " ")) ; escaped id's need trailing space
8725 (goto-char (match-end 0))) 8745 (goto-char (match-end 0)))
8726 ;; .name 8746 ;; .name
8727 ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*[,)/]") 8747 ((looking-at "\\s-*\\.\\s-*\\([a-zA-Z0-9`_$]*\\)\\s-*[,)/]")
8728 (verilog-read-sub-decls-sig 8748 (verilog-read-sub-decls-sig
8729 submoddecls comment (match-string 1) t ; sig==t for .name 8749 submoddecls comment (match-string-no-properties 1) t ; sig==t for .name
8730 nil nil) ; vec multidim 8750 nil nil nil) ; vec multidim mem
8731 (setq port nil)) 8751 (setq port nil))
8732 ;; .\escaped_name 8752 ;; .\escaped_name
8733 ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*[,)/]") 8753 ((looking-at "\\s-*\\.\\s-*\\(\\\\[^ \t\n\f]*\\)\\s-*[,)/]")
8734 (verilog-read-sub-decls-sig 8754 (verilog-read-sub-decls-sig
8735 submoddecls comment (concat (match-string 1) " ") t ; sig==t for .name 8755 submoddecls comment (concat (match-string-no-properties 1) " ") t ; sig==t for .name
8736 nil nil) ; vec multidim 8756 nil nil nil) ; vec multidim mem
8737 (setq port nil)) 8757 (setq port nil))
8738 ;; random 8758 ;; random
8739 ((looking-at "\\s-*\\.[^(]*(") 8759 ((looking-at "\\s-*\\.[^(]*(")
@@ -8748,20 +8768,20 @@ Inserts the list of signals found, using submodi to look up each port."
8748 (cond ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*)") 8768 (cond ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*)")
8749 (verilog-read-sub-decls-sig 8769 (verilog-read-sub-decls-sig
8750 submoddecls comment port 8770 submoddecls comment port
8751 (verilog-string-remove-spaces (match-string 1)) ; sig 8771 (verilog-string-remove-spaces (match-string-no-properties 1)) ; sig
8752 nil nil)) ; vec multidim 8772 nil nil nil)) ; vec multidim mem
8753 ;; 8773 ;;
8754 ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*\\(\\[[^]]+\\]\\)\\s-*)") 8774 ((looking-at "\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*\\(\\[[^]]+\\]\\)\\s-*)")
8755 (verilog-read-sub-decls-sig 8775 (verilog-read-sub-decls-sig
8756 submoddecls comment port 8776 submoddecls comment port
8757 (verilog-string-remove-spaces (match-string 1)) ; sig 8777 (verilog-string-remove-spaces (match-string-no-properties 1)) ; sig
8758 (match-string 2) nil)) ; vec multidim 8778 (match-string-no-properties 2) nil nil)) ; vec multidim mem
8759 ;; Fastpath was above looking-at's. 8779 ;; Fastpath was above looking-at's.
8760 ;; For something more complicated invoke a parser 8780 ;; For something more complicated invoke a parser
8761 ((looking-at "[^)]+") 8781 ((looking-at "[^)]+")
8762 (verilog-read-sub-decls-expr 8782 (verilog-read-sub-decls-expr
8763 submoddecls comment port 8783 submoddecls comment port
8764 (buffer-substring 8784 (buffer-substring-no-properties
8765 (point) (1- (progn (search-backward "(") ; start at ( 8785 (point) (1- (progn (search-backward "(") ; start at (
8766 (verilog-forward-sexp-ign-cmt 1) 8786 (verilog-forward-sexp-ign-cmt 1)
8767 (point)))))))) ; expr 8787 (point)))))))) ; expr
@@ -9894,7 +9914,7 @@ Return modi if successful, else print message unless IGNORE-ERROR is true."
9894 (or mif ignore-error 9914 (or mif ignore-error
9895 (error 9915 (error
9896 (concat 9916 (concat
9897 "%s: Can't locate %s module definition%s" 9917 "%s: Can't locate `%s' module definition%s"
9898 "\n Check the verilog-library-directories variable." 9918 "\n Check the verilog-library-directories variable."
9899 "\n I looked in (if not listed, doesn't exist):\n\t%s") 9919 "\n I looked in (if not listed, doesn't exist):\n\t%s")
9900 (verilog-point-text) module 9920 (verilog-point-text) module
@@ -9959,9 +9979,9 @@ Cache the output of function so next call may have faster access."
9959 (t 9979 (t
9960 ;; Read from file 9980 ;; Read from file
9961 ;; Clear then restore any highlighting to make emacs19 happy 9981 ;; Clear then restore any highlighting to make emacs19 happy
9962 (let (func-returns) 9982 (let ((func-returns
9963 (verilog-save-font-mods 9983 (verilog-save-font-no-change-functions
9964 (setq func-returns (funcall function))) 9984 (funcall function))))
9965 ;; Cache for next time 9985 ;; Cache for next time
9966 (setq verilog-modi-cache-list 9986 (setq verilog-modi-cache-list
9967 (cons (list (list modi function) 9987 (cons (list (list modi function)
@@ -10003,7 +10023,7 @@ Report errors unless optional IGNORE-ERROR."
10003 (let* ((realname (verilog-symbol-detick name t)) 10023 (let* ((realname (verilog-symbol-detick name t))
10004 (modport (assoc name (verilog-decls-get-modports (verilog-modi-get-decls modi))))) 10024 (modport (assoc name (verilog-decls-get-modports (verilog-modi-get-decls modi)))))
10005 (or modport ignore-error 10025 (or modport ignore-error
10006 (error "%s: Can't locate %s modport definition%s" 10026 (error "%s: Can't locate `%s' modport definition%s"
10007 (verilog-point-text) name 10027 (verilog-point-text) name
10008 (if (not (equal name realname)) 10028 (if (not (equal name realname))
10009 (concat " (Expanded macro to " realname ")") 10029 (concat " (Expanded macro to " realname ")")
@@ -10193,7 +10213,7 @@ When MODI is non-null, also add to modi-cache, for tracking."
10193 ((equal direction "parameter") 10213 ((equal direction "parameter")
10194 (verilog-modi-cache-add-gparams modi sigs)) 10214 (verilog-modi-cache-add-gparams modi sigs))
10195 (t 10215 (t
10196 (error "Unsupported verilog-insert-definition direction: %s" direction)))) 10216 (error "Unsupported verilog-insert-definition direction: `%s'" direction))))
10197 (or dont-sort 10217 (or dont-sort
10198 (setq sigs (sort (copy-alist sigs) `verilog-signals-sort-compare))) 10218 (setq sigs (sort (copy-alist sigs) `verilog-signals-sort-compare)))
10199 (while sigs 10219 (while sigs
@@ -10224,7 +10244,7 @@ When MODI is non-null, also add to modi-cache, for tracking."
10224 10244
10225(eval-when-compile 10245(eval-when-compile
10226 (if (not (boundp 'indent-pt)) 10246 (if (not (boundp 'indent-pt))
10227 (defvar indent-pt nil "Local used by insert-indent"))) 10247 (defvar indent-pt nil "Local used by `verilog-insert-indent'.")))
10228 10248
10229(defun verilog-insert-indent (&rest stuff) 10249(defun verilog-insert-indent (&rest stuff)
10230 "Indent to position stored in local `indent-pt' variable, then insert STUFF. 10250 "Indent to position stored in local `indent-pt' variable, then insert STUFF.
@@ -10510,6 +10530,41 @@ removed."
10510 (re-search-backward ",") 10530 (re-search-backward ",")
10511 (delete-char 1)))))) 10531 (delete-char 1))))))
10512 10532
10533(defun verilog-delete-auto-buffer ()
10534 "Perform `verilog-delete-auto' on the current buffer.
10535Intended for internal use inside a `verilog-save-font-no-change-functions' block."
10536 ;; Allow user to customize
10537 (verilog-run-hooks 'verilog-before-delete-auto-hook)
10538
10539 ;; Remove those that have multi-line insertions, possibly with parameters
10540 ;; We allow anything beginning with AUTO, so that users can add their own
10541 ;; patterns
10542 (verilog-auto-re-search-do
10543 (concat "/\\*AUTO[A-Za-z0-9_]+"
10544 ;; Optional parens or quoted parameter or .* for (((...)))
10545 "\\(\\|([^)]*)\\|(\"[^\"]*\")\\).*?"
10546 "\\*/")
10547 'verilog-delete-autos-lined)
10548 ;; Remove those that are in parenthesis
10549 (verilog-auto-re-search-do
10550 (concat "/\\*"
10551 (eval-when-compile
10552 (verilog-regexp-words
10553 `("AS" "AUTOARG" "AUTOCONCATWIDTH" "AUTOINST" "AUTOINSTPARAM"
10554 "AUTOSENSE")))
10555 "\\*/")
10556 'verilog-delete-to-paren)
10557 ;; Do .* instantiations, but avoid removing any user pins by looking for our magic comments
10558 (verilog-auto-re-search-do "\\.\\*"
10559 'verilog-delete-auto-star-all)
10560 ;; Remove template comments ... anywhere in case was pasted after AUTOINST removed
10561 (goto-char (point-min))
10562 (while (re-search-forward "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)?$" nil t)
10563 (replace-match ""))
10564
10565 ;; Final customize
10566 (verilog-run-hooks 'verilog-delete-auto-hook))
10567
10513(defun verilog-delete-auto () 10568(defun verilog-delete-auto ()
10514 "Delete the automatic outputs, regs, and wires created by \\[verilog-auto]. 10569 "Delete the automatic outputs, regs, and wires created by \\[verilog-auto].
10515Use \\[verilog-auto] to re-insert the updated AUTOs. 10570Use \\[verilog-auto] to re-insert the updated AUTOs.
@@ -10520,39 +10575,10 @@ called before and after this function, respectively."
10520 (save-excursion 10575 (save-excursion
10521 (if (buffer-file-name) 10576 (if (buffer-file-name)
10522 (find-file-noselect (buffer-file-name))) ; To check we have latest version 10577 (find-file-noselect (buffer-file-name))) ; To check we have latest version
10523 (verilog-save-no-change-functions 10578 (verilog-save-font-no-change-functions
10524 (verilog-save-scan-cache 10579 (verilog-save-scan-cache
10525 ;; Allow user to customize 10580 (verilog-delete-auto-buffer)))))
10526 (verilog-run-hooks 'verilog-before-delete-auto-hook)
10527
10528 ;; Remove those that have multi-line insertions, possibly with parameters
10529 ;; We allow anything beginning with AUTO, so that users can add their own
10530 ;; patterns
10531 (verilog-auto-re-search-do
10532 (concat "/\\*AUTO[A-Za-z0-9_]+"
10533 ;; Optional parens or quoted parameter or .* for (((...)))
10534 "\\(\\|([^)]*)\\|(\"[^\"]*\")\\).*?"
10535 "\\*/")
10536 'verilog-delete-autos-lined)
10537 ;; Remove those that are in parenthesis
10538 (verilog-auto-re-search-do
10539 (concat "/\\*"
10540 (eval-when-compile
10541 (verilog-regexp-words
10542 `("AS" "AUTOARG" "AUTOCONCATWIDTH" "AUTOINST" "AUTOINSTPARAM"
10543 "AUTOSENSE")))
10544 "\\*/")
10545 'verilog-delete-to-paren)
10546 ;; Do .* instantiations, but avoid removing any user pins by looking for our magic comments
10547 (verilog-auto-re-search-do "\\.\\*"
10548 'verilog-delete-auto-star-all)
10549 ;; Remove template comments ... anywhere in case was pasted after AUTOINST removed
10550 (goto-char (point-min))
10551 (while (re-search-forward "\\s-*// \\(Templated\\|Implicit \\.\\*\\)\\([ \tLT0-9]*\\| LHS: .*\\)?$" nil t)
10552 (replace-match ""))
10553 10581
10554 ;; Final customize
10555 (verilog-run-hooks 'verilog-delete-auto-hook)))))
10556 10582
10557;;; Auto inject: 10583;;; Auto inject:
10558;; 10584;;
@@ -10679,10 +10705,11 @@ Typing \\[verilog-inject-auto] will make this into:
10679;; Auto diff: 10705;; Auto diff:
10680;; 10706;;
10681 10707
10682(defun verilog-diff-buffers-p (b1 b2 &optional whitespace) 10708(defun verilog-diff-buffers-p (b1 b2 &optional whitespace regexp)
10683 "Return nil if buffers B1 and B2 have same contents. 10709 "Return nil if buffers B1 and B2 have same contents.
10684Else, return point in B1 that first mismatches. 10710Else, return point in B1 that first mismatches.
10685If optional WHITESPACE true, ignore whitespace." 10711If optional WHITESPACE true, ignore whitespace.
10712If optional REGEXP, ignore differences matching it."
10686 (save-excursion 10713 (save-excursion
10687 (let* ((case-fold-search nil) ; compare-buffer-substrings cares 10714 (let* ((case-fold-search nil) ; compare-buffer-substrings cares
10688 (p1 (with-current-buffer b1 (goto-char (point-min)))) 10715 (p1 (with-current-buffer b1 (goto-char (point-min))))
@@ -10703,6 +10730,15 @@ If optional WHITESPACE true, ignore whitespace."
10703 (goto-char p2) 10730 (goto-char p2)
10704 (skip-chars-forward " \t\n\r\f\v") 10731 (skip-chars-forward " \t\n\r\f\v")
10705 (setq p2 (point)))) 10732 (setq p2 (point))))
10733 (when regexp
10734 (with-current-buffer b1
10735 (goto-char p1)
10736 (when (looking-at regexp)
10737 (setq p1 (match-end 0))))
10738 (with-current-buffer b2
10739 (goto-char p2)
10740 (when (looking-at regexp)
10741 (setq p2 (match-end 0)))))
10706 (setq size (min (- maxp1 p1) (- maxp2 p2))) 10742 (setq size (min (- maxp1 p1) (- maxp2 p2)))
10707 (setq progress (compare-buffer-substrings b2 p2 (+ size p2) 10743 (setq progress (compare-buffer-substrings b2 p2 (+ size p2)
10708 b1 p1 (+ size p1))) 10744 b1 p1 (+ size p1)))
@@ -10723,7 +10759,7 @@ Ignores WHITESPACE if t, and writes output to stdout if SHOW."
10723 ;; call `diff' as `diff' has different calling semantics on different 10759 ;; call `diff' as `diff' has different calling semantics on different
10724 ;; versions of Emacs. 10760 ;; versions of Emacs.
10725 (if (not (file-exists-p f1)) 10761 (if (not (file-exists-p f1))
10726 (message "Buffer %s has no associated file on disc" (buffer-name b2)) 10762 (message "Buffer `%s' has no associated file on disk" (buffer-name b2))
10727 (with-temp-buffer "*Verilog-Diff*" 10763 (with-temp-buffer "*Verilog-Diff*"
10728 (let ((outbuf (current-buffer)) 10764 (let ((outbuf (current-buffer))
10729 (f2 (make-temp-file "vm-diff-auto-"))) 10765 (f2 (make-temp-file "vm-diff-auto-")))
@@ -10791,7 +10827,7 @@ or `diff' in batch mode."
10791 ;; Restore name if unwind 10827 ;; Restore name if unwind
10792 (with-current-buffer b1 (setq buffer-file-name name1))))) 10828 (with-current-buffer b1 (setq buffer-file-name name1)))))
10793 ;; 10829 ;;
10794 (setq diffpt (verilog-diff-buffers-p b1 b2 t)) 10830 (setq diffpt (verilog-diff-buffers-p b1 b2 t verilog-diff-ignore-regexp))
10795 (cond ((not diffpt) 10831 (cond ((not diffpt)
10796 (unless noninteractive (message "AUTO expansion identical")) 10832 (unless noninteractive (message "AUTO expansion identical"))
10797 (kill-buffer newname)) ; Nice to cleanup after oneself 10833 (kill-buffer newname)) ; Nice to cleanup after oneself
@@ -11054,6 +11090,7 @@ If PAR-VALUES replace final strings with these parameter values."
11054 (vl-name (verilog-sig-name port-st)) 11090 (vl-name (verilog-sig-name port-st))
11055 (vl-width (verilog-sig-width port-st)) 11091 (vl-width (verilog-sig-width port-st))
11056 (vl-modport (verilog-sig-modport port-st)) 11092 (vl-modport (verilog-sig-modport port-st))
11093 (vl-memory (verilog-sig-memory port-st))
11057 (vl-mbits (if (verilog-sig-multidim port-st) 11094 (vl-mbits (if (verilog-sig-multidim port-st)
11058 (verilog-sig-multidim-string port-st) "")) 11095 (verilog-sig-multidim-string port-st) ""))
11059 (vl-bits (if (or verilog-auto-inst-vector 11096 (vl-bits (if (or verilog-auto-inst-vector
@@ -11078,15 +11115,25 @@ If PAR-VALUES replace final strings with these parameter values."
11078 (concat "\\<" (nth 0 (car check-values)) "\\>") 11115 (concat "\\<" (nth 0 (car check-values)) "\\>")
11079 (concat "(" (nth 1 (car check-values)) ")") 11116 (concat "(" (nth 1 (car check-values)) ")")
11080 t t vl-mbits) 11117 t t vl-mbits)
11118 vl-memory (when vl-memory
11119 (verilog-string-replace-matches
11120 (concat "\\<" (nth 0 (car check-values)) "\\>")
11121 (concat "(" (nth 1 (car check-values)) ")")
11122 t t vl-memory))
11081 check-values (cdr check-values))) 11123 check-values (cdr check-values)))
11082 (setq vl-bits (verilog-simplify-range-expression vl-bits) 11124 (setq vl-bits (verilog-simplify-range-expression vl-bits)
11083 vl-mbits (verilog-simplify-range-expression vl-mbits) 11125 vl-mbits (verilog-simplify-range-expression vl-mbits)
11126 vl-memory (when vl-memory (verilog-simplify-range-expression vl-memory))
11084 vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed 11127 vl-width (verilog-make-width-expression vl-bits))) ; Not in the loop for speed
11085 ;; Default net value if not found 11128 ;; Default net value if not found
11086 (setq dflt-bits (if (and (verilog-sig-bits port-st) 11129 (setq dflt-bits (if (or (and (verilog-sig-bits port-st)
11087 (or (verilog-sig-multidim port-st) 11130 (verilog-sig-multidim port-st))
11088 (verilog-sig-memory port-st))) 11131 (verilog-sig-memory port-st))
11089 (concat "/*" vl-mbits vl-bits "*/") 11132 (concat "/*" vl-mbits vl-bits
11133 ;; .[ used to separate packed from unpacked
11134 (if vl-memory "." "")
11135 (if vl-memory vl-memory "")
11136 "*/")
11090 (concat vl-bits)) 11137 (concat vl-bits))
11091 tpl-net (concat port 11138 tpl-net (concat port
11092 (if (and vl-modport 11139 (if (and vl-modport
@@ -11157,7 +11204,7 @@ If PAR-VALUES replace final strings with these parameter values."
11157 (for-star 11204 (for-star
11158 (indent-to (+ (if (< verilog-auto-inst-column 48) 24 16) 11205 (indent-to (+ (if (< verilog-auto-inst-column 48) 24 16)
11159 verilog-auto-inst-column)) 11206 verilog-auto-inst-column))
11160 (verilog-insert " // Implicit .\*\n")) ;For some reason the . or * must be escaped... 11207 (verilog-insert " // Implicit .*\n"))
11161 (t 11208 (t
11162 (insert "\n"))))) 11209 (insert "\n")))))
11163;;(verilog-auto-inst-port (list "foo" "[5:0]") 10 (list (list "foo" "a@\"(% (+ @ 1) 4)\"a")) "3") 11210;;(verilog-auto-inst-port (list "foo" "[5:0]") 10 (list (list "foo" "a@\"(% (+ @ 1) 4)\"a")) "3")
@@ -13316,13 +13363,16 @@ Typing \\[verilog-auto] will make this into:
13316 (sig-list-all (verilog-decls-get-iovars moddecls)) 13363 (sig-list-all (verilog-decls-get-iovars moddecls))
13317 ;; 13364 ;;
13318 (undecode-sig (or (assoc undecode-name sig-list-all) 13365 (undecode-sig (or (assoc undecode-name sig-list-all)
13319 (error "%s: Signal %s not found in design" (verilog-point-text) undecode-name))) 13366 (error "%s: Signal `%s' not found in design"
13367 (verilog-point-text) undecode-name)))
13320 (undecode-enum (or (verilog-sig-enum undecode-sig) 13368 (undecode-enum (or (verilog-sig-enum undecode-sig)
13321 (error "%s: Signal %s does not have an enum tag" (verilog-point-text) undecode-name))) 13369 (error "%s: Signal `%s' does not have an enum tag"
13370 (verilog-point-text) undecode-name)))
13322 ;; 13371 ;;
13323 (enum-sigs (verilog-signals-not-in 13372 (enum-sigs (verilog-signals-not-in
13324 (or (verilog-signals-matching-enum sig-list-consts undecode-enum) 13373 (or (verilog-signals-matching-enum sig-list-consts undecode-enum)
13325 (error "%s: No state definitions for %s" (verilog-point-text) undecode-enum)) 13374 (error "%s: No state definitions for `%s'"
13375 (verilog-point-text) undecode-enum))
13326 nil)) 13376 nil))
13327 ;; 13377 ;;
13328 (one-hot (or 13378 (one-hot (or
@@ -13518,120 +13568,115 @@ Wilson Snyder (wsnyder@wsnyder.org)."
13518 (unless noninteractive (message "Updating AUTOs...")) 13568 (unless noninteractive (message "Updating AUTOs..."))
13519 (if (fboundp 'dinotrace-unannotate-all) 13569 (if (fboundp 'dinotrace-unannotate-all)
13520 (dinotrace-unannotate-all)) 13570 (dinotrace-unannotate-all))
13521 (verilog-save-font-mods 13571 ;; Disable change hooks for speed
13572 ;; This let can't be part of above let; must restore
13573 ;; after-change-functions before font-lock resumes
13574 (verilog-save-font-no-change-functions
13522 (let ((oldbuf (if (not (buffer-modified-p)) 13575 (let ((oldbuf (if (not (buffer-modified-p))
13523 (buffer-string))) 13576 (buffer-string)))
13524 (case-fold-search verilog-case-fold) 13577 (case-fold-search verilog-case-fold)
13525 ;; Cache directories; we don't write new files, so can't change 13578 ;; Cache directories; we don't write new files, so can't change
13526 (verilog-dir-cache-preserving t) 13579 (verilog-dir-cache-preserving t)
13527 ;; Cache current module 13580 ;; Cache current module
13528 (verilog-modi-cache-current-enable t) 13581 (verilog-modi-cache-current-enable t)
13529 (verilog-modi-cache-current-max (point-min)) ; IE it's invalid 13582 (verilog-modi-cache-current-max (point-min)) ; IE it's invalid
13530 verilog-modi-cache-current) 13583 verilog-modi-cache-current)
13531 (unwind-protect 13584 (verilog-save-scan-cache
13532 ;; Disable change hooks for speed 13585 (save-excursion
13533 ;; This let can't be part of above let; must restore 13586 ;; Wipe cache; otherwise if we AUTOed a block above this one,
13534 ;; after-change-functions before font-lock resumes 13587 ;; we'll misremember we have generated IOs, confusing AUTOOUTPUT
13535 (verilog-save-no-change-functions 13588 (setq verilog-modi-cache-list nil)
13536 (verilog-save-scan-cache 13589 ;; Local state
13537 (save-excursion 13590 (verilog-read-auto-template-init)
13538 ;; Wipe cache; otherwise if we AUTOed a block above this one, 13591 ;; If we're not in verilog-mode, change syntax table so parsing works right
13539 ;; we'll misremember we have generated IOs, confusing AUTOOUTPUT 13592 (unless (eq major-mode `verilog-mode) (verilog-mode))
13540 (setq verilog-modi-cache-list nil) 13593 ;; Allow user to customize
13541 ;; Local state 13594 (verilog-run-hooks 'verilog-before-auto-hook)
13542 (verilog-read-auto-template-init) 13595 ;; Try to save the user from needing to revert-file to reread file local-variables
13543 ;; If we're not in verilog-mode, change syntax table so parsing works right 13596 (verilog-auto-reeval-locals)
13544 (unless (eq major-mode `verilog-mode) (verilog-mode)) 13597 (verilog-read-auto-lisp-present)
13545 ;; Allow user to customize 13598 (verilog-read-auto-lisp (point-min) (point-max))
13546 (verilog-run-hooks 'verilog-before-auto-hook) 13599 (verilog-getopt-flags)
13547 ;; Try to save the user from needing to revert-file to reread file local-variables 13600 ;; From here on out, we can cache anything we read from disk
13548 (verilog-auto-reeval-locals) 13601 (verilog-preserve-dir-cache
13549 (verilog-read-auto-lisp-present) 13602 ;; These two may seem obvious to do always, but on large includes it can be way too slow
13550 (verilog-read-auto-lisp (point-min) (point-max)) 13603 (when verilog-auto-read-includes
13551 (verilog-getopt-flags) 13604 (verilog-read-includes)
13552 ;; From here on out, we can cache anything we read from disk 13605 (verilog-read-defines nil nil t))
13553 (verilog-preserve-dir-cache 13606 ;; Setup variables due to SystemVerilog expansion
13554 ;; These two may seem obvious to do always, but on large includes it can be way too slow 13607 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic-setup)
13555 (when verilog-auto-read-includes 13608 ;; This particular ordering is important
13556 (verilog-read-includes) 13609 ;; INST: Lower modules correct, no internal dependencies, FIRST
13557 (verilog-read-defines nil nil t)) 13610 (verilog-preserve-modi-cache
13558 ;; Setup variables due to SystemVerilog expansion 13611 ;; Clear existing autos else we'll be screwed by existing ones
13559 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic-setup) 13612 (verilog-delete-auto-buffer)
13560 ;; This particular ordering is important 13613 ;; Injection if appropriate
13561 ;; INST: Lower modules correct, no internal dependencies, FIRST 13614 (when inject
13562 (verilog-preserve-modi-cache 13615 (verilog-inject-inst)
13563 ;; Clear existing autos else we'll be screwed by existing ones 13616 (verilog-inject-sense)
13564 (verilog-delete-auto) 13617 (verilog-inject-arg))
13565 ;; Injection if appropriate 13618 ;;
13566 (when inject 13619 ;; Do user inserts first, so their code can insert AUTOs
13567 (verilog-inject-inst) 13620 (verilog-auto-re-search-do "/\\*AUTOINSERTLISP(.*?)\\*/"
13568 (verilog-inject-sense) 13621 'verilog-auto-insert-lisp)
13569 (verilog-inject-arg)) 13622 ;; Expand instances before need the signals the instances input/output
13570 ;; 13623 (verilog-auto-re-search-do "/\\*AUTOINSTPARAM\\*/" 'verilog-auto-inst-param)
13571 ;; Do user inserts first, so their code can insert AUTOs 13624 (verilog-auto-re-search-do "/\\*AUTOINST\\*/" 'verilog-auto-inst)
13572 (verilog-auto-re-search-do "/\\*AUTOINSERTLISP(.*?)\\*/" 13625 (verilog-auto-re-search-do "\\.\\*" 'verilog-auto-star)
13573 'verilog-auto-insert-lisp) 13626 ;; Doesn't matter when done, but combine it with a common changer
13574 ;; Expand instances before need the signals the instances input/output 13627 (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense)
13575 (verilog-auto-re-search-do "/\\*AUTOINSTPARAM\\*/" 'verilog-auto-inst-param) 13628 (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset)
13576 (verilog-auto-re-search-do "/\\*AUTOINST\\*/" 'verilog-auto-inst) 13629 ;; Must be done before autoin/out as creates a reg
13577 (verilog-auto-re-search-do "\\.\\*" 'verilog-auto-star) 13630 (verilog-auto-re-search-do "/\\*AUTOASCIIENUM(.*?)\\*/" 'verilog-auto-ascii-enum)
13578 ;; Doesn't matter when done, but combine it with a common changer 13631 ;;
13579 (verilog-auto-re-search-do "/\\*\\(AUTOSENSE\\|AS\\)\\*/" 'verilog-auto-sense) 13632 ;; first in/outs from other files
13580 (verilog-auto-re-search-do "/\\*AUTORESET\\*/" 'verilog-auto-reset) 13633 (verilog-auto-re-search-do "/\\*AUTOINOUTMODPORT(.*?)\\*/" 'verilog-auto-inout-modport)
13581 ;; Must be done before autoin/out as creates a reg 13634 (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE(.*?)\\*/" 'verilog-auto-inout-module)
13582 (verilog-auto-re-search-do "/\\*AUTOASCIIENUM(.*?)\\*/" 'verilog-auto-ascii-enum) 13635 (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP(.*?)\\*/" 'verilog-auto-inout-comp)
13583 ;; 13636 (verilog-auto-re-search-do "/\\*AUTOINOUTIN(.*?)\\*/" 'verilog-auto-inout-in)
13584 ;; first in/outs from other files 13637 (verilog-auto-re-search-do "/\\*AUTOINOUTPARAM(.*?)\\*/" 'verilog-auto-inout-param)
13585 (verilog-auto-re-search-do "/\\*AUTOINOUTMODPORT(.*?)\\*/" 'verilog-auto-inout-modport) 13638 ;; next in/outs which need previous sucked inputs first
13586 (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE(.*?)\\*/" 'verilog-auto-inout-module) 13639 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((.*?)\\)?\\*/" 'verilog-auto-output)
13587 (verilog-auto-re-search-do "/\\*AUTOINOUTCOMP(.*?)\\*/" 'verilog-auto-inout-comp) 13640 (verilog-auto-re-search-do "/\\*AUTOINPUT\\((.*?)\\)?\\*/" 'verilog-auto-input)
13588 (verilog-auto-re-search-do "/\\*AUTOINOUTIN(.*?)\\*/" 'verilog-auto-inout-in) 13641 (verilog-auto-re-search-do "/\\*AUTOINOUT\\((.*?)\\)?\\*/" 'verilog-auto-inout)
13589 (verilog-auto-re-search-do "/\\*AUTOINOUTPARAM(.*?)\\*/" 'verilog-auto-inout-param) 13642 ;; Then tie off those in/outs
13590 ;; next in/outs which need previous sucked inputs first 13643 (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff)
13591 (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((.*?)\\)?\\*/" 'verilog-auto-output) 13644 ;; These can be anywhere after AUTOINSERTLISP
13592 (verilog-auto-re-search-do "/\\*AUTOINPUT\\((.*?)\\)?\\*/" 'verilog-auto-input) 13645 (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((.*?)\\)?\\*/" 'verilog-auto-undef)
13593 (verilog-auto-re-search-do "/\\*AUTOINOUT\\((.*?)\\)?\\*/" 'verilog-auto-inout) 13646 ;; Wires/regs must be after inputs/outputs
13594 ;; Then tie off those in/outs 13647 (verilog-auto-re-search-do "/\\*AUTOASSIGNMODPORT(.*?)\\*/" 'verilog-auto-assign-modport)
13595 (verilog-auto-re-search-do "/\\*AUTOTIEOFF\\*/" 'verilog-auto-tieoff) 13648 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic)
13596 ;; These can be anywhere after AUTOINSERTLISP 13649 (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire)
13597 (verilog-auto-re-search-do "/\\*AUTOUNDEF\\((.*?)\\)?\\*/" 'verilog-auto-undef) 13650 (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg)
13598 ;; Wires/regs must be after inputs/outputs 13651 (verilog-auto-re-search-do "/\\*AUTOREGINPUT\\*/" 'verilog-auto-reg-input)
13599 (verilog-auto-re-search-do "/\\*AUTOASSIGNMODPORT(.*?)\\*/" 'verilog-auto-assign-modport) 13652 ;; outputevery needs AUTOOUTPUTs done first
13600 (verilog-auto-re-search-do "/\\*AUTOLOGIC\\*/" 'verilog-auto-logic) 13653 (verilog-auto-re-search-do "/\\*AUTOOUTPUTEVERY\\((.*?)\\)?\\*/" 'verilog-auto-output-every)
13601 (verilog-auto-re-search-do "/\\*AUTOWIRE\\*/" 'verilog-auto-wire) 13654 ;; After we've created all new variables
13602 (verilog-auto-re-search-do "/\\*AUTOREG\\*/" 'verilog-auto-reg) 13655 (verilog-auto-re-search-do "/\\*AUTOUNUSED\\*/" 'verilog-auto-unused)
13603 (verilog-auto-re-search-do "/\\*AUTOREGINPUT\\*/" 'verilog-auto-reg-input) 13656 ;; Must be after all inputs outputs are generated
13604 ;; outputevery needs AUTOOUTPUTs done first 13657 (verilog-auto-re-search-do "/\\*AUTOARG\\*/" 'verilog-auto-arg)
13605 (verilog-auto-re-search-do "/\\*AUTOOUTPUTEVERY\\((.*?)\\)?\\*/" 'verilog-auto-output-every) 13658 ;; User inserts
13606 ;; After we've created all new variables 13659 (verilog-auto-re-search-do "/\\*AUTOINSERTLAST(.*?)\\*/" 'verilog-auto-insert-last)
13607 (verilog-auto-re-search-do "/\\*AUTOUNUSED\\*/" 'verilog-auto-unused) 13660 ;; Fix line numbers (comments only)
13608 ;; Must be after all inputs outputs are generated 13661 (when verilog-auto-inst-template-numbers
13609 (verilog-auto-re-search-do "/\\*AUTOARG\\*/" 'verilog-auto-arg) 13662 (verilog-auto-templated-rel))
13610 ;; User inserts 13663 (when verilog-auto-template-warn-unused
13611 (verilog-auto-re-search-do "/\\*AUTOINSERTLAST(.*?)\\*/" 'verilog-auto-insert-last) 13664 (verilog-auto-template-lint))))
13612 ;; Fix line numbers (comments only) 13665 ;;
13613 (when verilog-auto-inst-template-numbers 13666 (verilog-run-hooks 'verilog-auto-hook)
13614 (verilog-auto-templated-rel)) 13667 ;;
13615 (when verilog-auto-template-warn-unused 13668 (when verilog-auto-delete-trailing-whitespace
13616 (verilog-auto-template-lint)))) 13669 (verilog-delete-trailing-whitespace))
13617 ;; 13670 ;;
13618 (verilog-run-hooks 'verilog-auto-hook) 13671 (set (make-local-variable 'verilog-auto-update-tick) (buffer-chars-modified-tick))
13619 ;; 13672 ;;
13620 (when verilog-auto-delete-trailing-whitespace 13673 ;; If end result is same as when started, clear modified flag
13621 (verilog-delete-trailing-whitespace)) 13674 (cond ((and oldbuf (equal oldbuf (buffer-string)))
13622 ;; 13675 (verilog-restore-buffer-modified-p nil)
13623 (set (make-local-variable 'verilog-auto-update-tick) (buffer-chars-modified-tick)) 13676 (unless noninteractive (message "Updating AUTOs...done (no changes)")))
13624 ;; 13677 (t (unless noninteractive (message "Updating AUTOs...done"))))
13625 ;; If end result is same as when started, clear modified flag 13678 ;; End of save-cache
13626 (cond ((and oldbuf (equal oldbuf (buffer-string))) 13679 )))))
13627 (set-buffer-modified-p nil)
13628 (unless noninteractive (message "Updating AUTOs...done (no changes)")))
13629 (t (unless noninteractive (message "Updating AUTOs...done"))))
13630 ;; End of after-change protection
13631 )))
13632 ;; Unwind forms
13633 ;; Currently handled in verilog-save-font-mods
13634 ))))
13635 13680
13636;;; Skeletons: 13681;;; Skeletons:
13637;; 13682;;