Function: verilog-auto-arg
verilog-auto-arg is a byte-compiled function defined in
verilog-mode.el.gz.
Signature
(verilog-auto-arg)
Documentation
Expand AUTOARG statements.
Replace the argument declarations at the beginning of the
module with ones automatically derived from input and output
statements. This can be dangerous if the module is instantiated
using position-based connections, so use only name-based when
instantiating the resulting module. Long lines are split based
on the fill-column, see C-x f (set-fill-column).
Limitations:
Concatenation and outputting partial buses is not supported.
Typedefs must match verilog-typedef-regexp, which is disabled by default.
For example:
module ExampArg (/*AUTOARG*/);
input i;
output o;
endmodule
Typing M-x verilog-auto (verilog-auto) will make this into:
module ExampArg (/*AUTOARG*/
// Outputs
o,
// Inputs
i);
input i;
output o;
endmodule
The argument declarations may be printed in declaration order to
best suit order based instantiations, or alphabetically, based on
the verilog-auto-arg-sort variable.
Formatting is controlled with verilog-auto-arg-format variable.
Any ports declared between the ( and /*AUTOARG*/ are presumed to be predeclared and are not redeclared by AUTOARG. AUTOARG will make a conservative guess on adding a comma for the first signal, if you have any ifdefs or complicated expressions before the AUTOARG you will need to choose the comma yourself.
Avoid declaring ports manually, as it makes code harder to maintain.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/verilog-mode.el.gz
(defun verilog-auto-arg ()
"Expand AUTOARG statements.
Replace the argument declarations at the beginning of the
module with ones automatically derived from input and output
statements. This can be dangerous if the module is instantiated
using position-based connections, so use only name-based when
instantiating the resulting module. Long lines are split based
on the `fill-column', see \\[set-fill-column].
Limitations:
Concatenation and outputting partial buses is not supported.
Typedefs must match `verilog-typedef-regexp', which is disabled by default.
For example:
module ExampArg (/*AUTOARG*/);
input i;
output o;
endmodule
Typing \\[verilog-auto] will make this into:
module ExampArg (/*AUTOARG*/
// Outputs
o,
// Inputs
i);
input i;
output o;
endmodule
The argument declarations may be printed in declaration order to
best suit order based instantiations, or alphabetically, based on
the `verilog-auto-arg-sort' variable.
Formatting is controlled with `verilog-auto-arg-format' variable.
Any ports declared between the ( and /*AUTOARG*/ are presumed to be
predeclared and are not redeclared by AUTOARG. AUTOARG will make a
conservative guess on adding a comma for the first signal, if you have
any ifdefs or complicated expressions before the AUTOARG you will need
to choose the comma yourself.
Avoid declaring ports manually, as it makes code harder to maintain."
(save-excursion
(let* ((modi (verilog-modi-current))
(moddecls (verilog-modi-get-decls modi))
(skip-pins (aref (verilog-read-arg-pins) 0)))
(verilog-repair-open-comma)
(verilog-auto-arg-ports (verilog-signals-not-in
(verilog-decls-get-outputs moddecls)
skip-pins)
"// Outputs"
verilog-indent-level-declaration)
(verilog-auto-arg-ports (verilog-signals-not-in
(verilog-decls-get-inouts moddecls)
skip-pins)
"// Inouts"
verilog-indent-level-declaration)
(verilog-auto-arg-ports (verilog-signals-not-in
(verilog-decls-get-inputs moddecls)
skip-pins)
"// Inputs"
verilog-indent-level-declaration)
(verilog-repair-close-comma)
(unless (eq (char-before) ?/ )
(insert "\n"))
(indent-to verilog-indent-level-declaration))))