verilog-mode

verilog-mode is an interactive autoloaded compiled Lisp function in `verilog-mode.el'.


(verilog-mode)

Parent mode: `prog-mode'.

Major mode for editing Verilog code.

See C-h f verilog-auto (C-c C-a) for details on how
AUTOs can improve coding efficiency.

Use M-x verilog-faq for a pointer to frequently asked questions.

NEWLINE, TAB indents for Verilog code.
Delete converts tabs to spaces as it moves back.

Supports highlighting.

Turning on Verilog mode calls the value of the variable `verilog-mode-hook'
with no args, if that value is non-nil.

Variables controlling indentation/edit style:

variable `verilog-indent-level' (default 3)
Indentation of Verilog statements with respect to containing block.
`verilog-indent-level-module' (default 3)
Absolute indentation of Module level Verilog statements.
Set to 0 to get initial and always statements lined up
on the left side of your screen.
`verilog-indent-level-declaration' (default 3)
Indentation of declarations with respect to containing block.
Set to 0 to get them list right under containing block.
`verilog-indent-level-behavioral' (default 3)
Indentation of first begin in a task or function block
Set to 0 to get such code to lined up underneath the task or
function keyword.
`verilog-indent-level-directive' (default 1)
Indentation of `ifdef/`endif blocks.
`verilog-cexp-indent' (default 1)
Indentation of Verilog statements broken across lines i.e.:
if (a)
begin
`verilog-case-indent' (default 2)
Indentation for case statements.
`verilog-auto-newline' (default nil)
Non-nil means automatically newline after semicolons and the punctuation
mark after an end.
`verilog-auto-indent-on-newline' (default t)
Non-nil means automatically indent line after newline.
`verilog-tab-always-indent' (default t)
Non-nil means TAB in Verilog mode should always reindent the current line,
regardless of where in the line point is when the TAB command is used.
`verilog-indent-begin-after-if' (default t)
Non-nil means to indent begin statements following a preceding
if, else, while, for and repeat statements, if any. Otherwise,
the begin is lined up with the preceding token. If t, you get:
if (a)
begin // amount of indent based on `verilog-cexp-indent'
otherwise you get:
if (a)
begin
`verilog-auto-endcomments' (default t)
Non-nil means a comment /* ... */ is set after the ends which ends
cases, tasks, functions and modules.
The type and name of the object will be set between the braces.
`verilog-minimum-comment-distance' (default 10)
Minimum distance (in lines) between begin and end required before a comment
will be inserted. Setting this variable to zero results in every
end acquiring a comment; the default avoids too many redundant
comments in tight quarters.
`verilog-auto-lineup' (default 'declarations)
List of contexts where auto lineup of code should be done.

Variables controlling other actions:

`verilog-linter' (default surelint)
Unix program to call to run the lint checker. This is the default
command for M-x compile-command and C-c C-s.

See M-x customize for the complete list of variables.

AUTO expansion functions are, in part:

C-c C-a Expand AUTO statements.
C-c C-k Remove the AUTOs.
C-c C-z Insert AUTOs for the first time.

Some other functions are:

C-M-i Complete word with appropriate possibilities.
M-x verilog-mark-defun Mark function.
M-x verilog-beg-of-defun Move to beginning of current function.
M-x verilog-end-of-defun Move to end of current function.
C-c C-r Label matching begin ... end, fork ... join, etc statements.

C-c C-c Put marked area in a comment.
C-c C-u Uncomment an area commented with C-c C-c.
M-x verilog-insert-block Insert begin ... end.
M-* Insert /* ... */.

C-c C-t a Insert an always @(AS) begin .. end block.
C-c C-t b Insert a begin .. end block.
C-c C-t c Insert a case block, prompting for details.
C-c C-t f Insert a for (...) begin .. end block, prompting for details.
C-c C-t g Insert a generate .. endgenerate block.
C-c C-t h Insert a header block at the top of file.
C-c C-t i Insert an initial begin .. end block.
C-c C-t j Insert a fork begin .. end .. join block.
C-c C-t m Insert a module .. (/*AUTOARG*/);.. endmodule block.
C-c C-t o Insert an OVM Class block.
C-c C-t u Insert an UVM Object block.
C-c C-t U Insert an UVM Component block.
C-c C-t p Insert a primitive .. (.. );.. endprimitive block.
C-c C-t r Insert a repeat (..) begin .. end block.
C-c C-t s Insert a specify .. endspecify block.
C-c C-t t Insert a task .. begin .. end endtask block.
C-c C-t w Insert a while (...) begin .. end block, prompting for details.
C-c C-t x Insert a casex (...) item: begin.. end endcase block, prompting for details.
C-c C-t z Insert a casez (...) item: begin.. end endcase block, prompting for details.
C-c C-t ? Insert an if (..) begin .. end block.
C-c C-t : Insert an else if (..) begin .. end block.
C-c C-t / Insert a comment block.
C-c C-t A Insert an assign .. = ..; statement.
C-c C-t F Insert a function .. begin .. end endfunction block.
C-c C-t I Insert an input declaration, prompting for details.
C-c C-t O Insert an output declaration, prompting for details.
C-c C-t S Insert a state machine definition, prompting for details.
C-c C-t = Insert an inout declaration, prompting for details.
C-c C-t W Insert a wire declaration, prompting for details.
C-c C-t R Insert a register declaration, prompting for details.
C-c C-t D Define signal under point as a register at the top of the module.

All key bindings can be seen in a Verilog-buffer with C-h b.
Key bindings specific to `verilog-mode-map' are:

key binding
--- -------

C-c Prefix Command
TAB electric-verilog-tab
RET electric-verilog-terminate-line
ESC Prefix Command
: electric-verilog-colon
; electric-verilog-semi
` electric-verilog-tick
C-; electric-verilog-semi-with-comment
<M-delete> kill-word
<backspace> backward-delete-char-untabify
<delete> delete-char

C-c C-a verilog-auto
C-c C-b verilog-submit-bug-report
C-c C-c verilog-comment-region
C-c C-d verilog-goto-defun
C-c C-e verilog-expand-vector
C-c C-h verilog-header
C-c TAB verilog-pretty-declarations
C-c C-k verilog-delete-auto
C-c C-p verilog-preprocess
C-c C-r verilog-label-be
C-c C-s verilog-auto-save-compile
C-c C-t Prefix Command
C-c C-u verilog-uncomment-region
C-c C-z verilog-inject-auto
C-c * verilog-delete-auto-star-implicit
C-c = verilog-pretty-expr
C-c ? verilog-diff-auto
C-c ` verilog-lint-off

C-M-b electric-verilog-backward-sexp
C-M-f electric-verilog-forward-sexp
C-M-i verilog-complete-word
M-RET electric-verilog-terminate-and-indent
M-* verilog-star-comment
M-? verilog-show-completions

C-c C-t / verilog-sk-comment
C-c C-t : verilog-sk-else-if
C-c C-t = verilog-sk-inout
C-c C-t ? verilog-sk-if
C-c C-t A verilog-sk-assign
C-c C-t D verilog-sk-define-signal
C-c C-t F verilog-sk-function
C-c C-t I verilog-sk-input
C-c C-t O verilog-sk-output
C-c C-t R verilog-sk-reg
C-c C-t S verilog-sk-state-machine
C-c C-t U verilog-sk-uvm-component
C-c C-t W verilog-sk-wire
C-c C-t a verilog-sk-always
C-c C-t b verilog-sk-begin
C-c C-t c verilog-sk-case
C-c C-t f verilog-sk-for
C-c C-t g verilog-sk-generate
C-c C-t h verilog-sk-header
C-c C-t i verilog-sk-initial
C-c C-t j verilog-sk-fork
C-c C-t m verilog-sk-module
C-c C-t o verilog-sk-ovm-class
C-c C-t p verilog-sk-primitive
C-c C-t r verilog-sk-repeat
C-c C-t s verilog-sk-specify
C-c C-t t verilog-sk-task
C-c C-t u verilog-sk-uvm-object
C-c C-t w verilog-sk-while
C-c C-t x verilog-sk-casex
C-c C-t z verilog-sk-casez