emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/progmodes/verilog-mode.el,v


From: Dan Nicolaescu
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/verilog-mode.el,v
Date: Tue, 25 Mar 2008 15:45:54 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Dan Nicolaescu <dann>   08/03/25 15:45:53

Index: progmodes/verilog-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/verilog-mode.el,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- progmodes/verilog-mode.el   20 Mar 2008 06:38:35 -0000      1.16
+++ progmodes/verilog-mode.el   25 Mar 2008 15:45:48 -0000      1.17
@@ -7333,6 +7333,17 @@
        (setq enumlist (cdr enumlist))))
     (nreverse out-list)))
 
+(defun verilog-signals-matching-regexp (in-list regexp)
+  "Return all signals in IN-LIST matching the given REGEXP, if non-nil."
+  (if (not regexp)
+      in-list
+    (let (out-list)
+      (while in-list
+       (if (string-match regexp (verilog-sig-name (car in-list)))
+           (setq out-list (cons (car in-list) out-list)))
+       (setq in-list (cdr in-list)))
+      (nreverse out-list))))
+
 (defun verilog-signals-not-matching-regexp (in-list regexp)
   "Return all signals in IN-LIST not matching the given REGEXP, if non-nil."
   (if (not regexp)
@@ -7643,14 +7654,27 @@
     ;; Allow user to customize
     (run-hooks 'verilog-before-delete-auto-hook)
 
-    ;; Remove those that have multi-line insertions
-    (verilog-auto-re-search-do 
"/\\*AUTO\\(OUTPUTEVERY\\|CONCATCOMMENT\\|WIRE\\|REG\\|DEFINEVALUE\\|REGINPUT\\|INPUT\\|OUTPUT\\|INOUT\\|RESET\\|TIEOFF\\|UNUSED\\)\\*/"
-                              'verilog-delete-autos-lined)
-    ;; Remove those that have multi-line insertions with parameters
-    (verilog-auto-re-search-do 
"/\\*AUTO\\(INOUTMODULE\\|ASCIIENUM\\)([^)]*)\\*/"
+    ;; Remove those that have multi-line insertions, possibly with parameters
+    (verilog-auto-re-search-do 
+     (concat "/\\*"
+            (eval-when-compile
+              (verilog-regexp-words
+               `("AUTOASCIIENUM" "AUTOCONCATCOMMENT" "AUTODEFINEVALUE"
+                 "AUTOINOUT" "AUTOINOUTMODULE" "AUTOINPUT" "AUTOOUTPUT"
+                 "AUTOOUTPUTEVERY"
+                 "AUTOREG" "AUTOREGINPUT" "AUTORESET" "AUTOTIEOFF"
+                 "AUTOUNUSED" "AUTOWIRE")))
+            "\\(\\|([^)]*)\\|(\"[^\"]*\")\\)" ; Optional parens or quoted 
parameter
+            "\\*/")
                               'verilog-delete-autos-lined)
     ;; Remove those that are in parenthesis
-    (verilog-auto-re-search-do 
"/\\*\\(AS\\|AUTO\\(ARG\\|CONCATWIDTH\\|INST\\|INSTPARAM\\|SENSE\\)\\)\\*/"
+    (verilog-auto-re-search-do
+     (concat "/\\*"
+            (eval-when-compile
+              (verilog-regexp-words
+               `("AS" "AUTOARG" "AUTOCONCATWIDTH" "AUTOINST" "AUTOINSTPARAM"
+                 "AUTOSENSE")))
+            "\\*/")
                               'verilog-delete-to-paren)
     ;; Do .* instantiations, but avoid removing any user pins by looking for 
our magic comments
     (verilog-auto-re-search-do "\\.\\*"
@@ -8636,7 +8660,7 @@
          (goto-char pnt)
          (verilog-pretty-expr "//"))))))
 
-(defun verilog-auto-output ()
+(defun verilog-auto-output (&optional with-params)
   "Expand AUTOOUTPUT statements, as part of \\[verilog-auto].
 Make output statements for any output signal from an /*AUTOINST*/ that
 isn't a input to another AUTOINST.  This is useful for modules which
@@ -8676,10 +8700,18 @@
                      .ov                       (ov[31:0]),
                      // Inputs
                      .i                        (i));
-       endmodule"
+       endmodule
+
+You may also provide an optional regular expression, in which case only
+signals matching the regular expression will be included.  For example the
+same expansion will result from only extracting outputs starting with ov:
+
+          /*AUTOOUTPUT(\"^ov\")*/"
   (save-excursion
     ;; Point must be at insertion point.
     (let* ((indent-pt (current-indentation))
+          (regexp (and with-params
+                       (nth 0 (verilog-read-auto-params 1))))
           (v2k  (verilog-in-paren))
           (modi (verilog-modi-current))
           (sig-list (verilog-signals-not-in
@@ -8688,6 +8720,9 @@
                              (verilog-modi-get-inouts modi)
                              (verilog-modi-get-sub-inputs modi)
                              (verilog-modi-get-sub-inouts modi)))))
+      (when regexp
+       (setq sig-list (verilog-signals-matching-regexp
+                       sig-list regexp)))
       (setq sig-list (verilog-signals-not-matching-regexp
                      sig-list verilog-auto-output-ignore-regexp))
       (forward-line 1)
@@ -8749,7 +8784,7 @@
        (verilog-insert-indent "// End of automatics\n"))
       (when v2k (verilog-repair-close-comma)))))
 
-(defun verilog-auto-input ()
+(defun verilog-auto-input (&optional with-params)
   "Expand AUTOINPUT statements, as part of \\[verilog-auto].
 Make input statements for any input signal into an /*AUTOINST*/ that
 isn't declared elsewhere inside the module.  This is useful for modules which
@@ -8789,9 +8824,17 @@
                      .ov                       (ov[31:0]),
                      // Inputs
                      .i                        (i));
-       endmodule"
+       endmodule
+
+You may also provide an optional regular expression, in which case only
+signals matching the regular expression will be included.  For example the
+same expansion will result from only extracting inputs starting with i:
+
+          /*AUTOINPUT(\"^i\")*/"
   (save-excursion
     (let* ((indent-pt (current-indentation))
+          (regexp (and with-params
+                       (nth 0 (verilog-read-auto-params 1))))
           (v2k  (verilog-in-paren))
           (modi (verilog-modi-current))
           (sig-list (verilog-signals-not-in
@@ -8804,6 +8847,9 @@
                              (verilog-modi-get-gparams modi)
                              (verilog-modi-get-sub-outputs modi)
                              (verilog-modi-get-sub-inouts modi)))))
+      (when regexp
+       (setq sig-list (verilog-signals-matching-regexp
+                       sig-list regexp)))
       (setq sig-list (verilog-signals-not-matching-regexp
                      sig-list verilog-auto-input-ignore-regexp))
       (forward-line 1)
@@ -8815,7 +8861,7 @@
        (verilog-insert-indent "// End of automatics\n"))
       (when v2k (verilog-repair-close-comma)))))
 
-(defun verilog-auto-inout ()
+(defun verilog-auto-inout (&optional with-params)
   "Expand AUTOINOUT statements, as part of \\[verilog-auto].
 Make inout statements for any inout signal in an /*AUTOINST*/ that
 isn't declared elsewhere inside the module.
@@ -8854,10 +8900,18 @@
                      .ov                       (ov[31:0]),
                      // Inputs
                      .i                        (i));
-       endmodule"
+       endmodule
+
+You may also provide an optional regular expression, in which case only
+signals matching the regular expression will be included.  For example the
+same expansion will result from only extracting inouts starting with i:
+
+          /*AUTOINOUT(\"^i\")*/"
   (save-excursion
     ;; Point must be at insertion point.
     (let* ((indent-pt (current-indentation))
+          (regexp (and with-params
+                       (nth 0 (verilog-read-auto-params 1))))
           (v2k  (verilog-in-paren))
           (modi (verilog-modi-current))
           (sig-list (verilog-signals-not-in
@@ -8867,6 +8921,9 @@
                              (verilog-modi-get-inputs modi)
                              (verilog-modi-get-sub-inputs modi)
                              (verilog-modi-get-sub-outputs modi)))))
+      (when regexp
+       (setq sig-list (verilog-signals-matching-regexp
+                       sig-list regexp)))
       (setq sig-list (verilog-signals-not-matching-regexp
                      sig-list verilog-auto-inout-ignore-regexp))
       (forward-line 1)
@@ -9556,9 +9613,15 @@
           ;; first in/outs from other files
           (verilog-auto-re-search-do "/\\*AUTOINOUTMODULE([^)]*)\\*/" 
'verilog-auto-inout-module)
           ;; next in/outs which need previous sucked inputs first
-          (verilog-auto-search-do "/*AUTOOUTPUT*/" 'verilog-auto-output)
-          (verilog-auto-search-do "/*AUTOINPUT*/" 'verilog-auto-input)
-          (verilog-auto-search-do "/*AUTOINOUT*/" 'verilog-auto-inout)
+          (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\((\"[^\"]*\")\\)\\*/"
+                                     '(lambda () (verilog-auto-output t)))
+          (verilog-auto-re-search-do "/\\*AUTOOUTPUT\\*/" 'verilog-auto-output)
+          (verilog-auto-re-search-do "/\\*AUTOINPUT\\((\"[^\"]*\")\\)\\*/"
+                                     '(lambda () (verilog-auto-input t)))
+          (verilog-auto-re-search-do "/\\*AUTOINPUT\\*/"  'verilog-auto-input)
+          (verilog-auto-re-search-do "/\\*AUTOINOUT\\((\"[^\"]*\")\\)\\*/"
+                                     '(lambda () (verilog-auto-inout t)))
+          (verilog-auto-re-search-do "/\\*AUTOINOUT\\*/" 'verilog-auto-inout)
           ;; Then tie off those in/outs
           (verilog-auto-search-do "/*AUTOTIEOFF*/" 'verilog-auto-tieoff)
           ;; Wires/regs must be after inputs/outputs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]