verilog-auto-reset
verilog-auto-reset is an interactive compiled Lisp function in `verilog-mode.el
'.
(verilog-auto-reset)
Expand AUTORESET statements, as part of M-x verilog-auto.
Replace the /*AUTORESET*/ comment with code to initialize all
registers set elsewhere in the always block.
Limitations:
AUTORESET will not clear memories.
AUTORESET uses <= if the signal has a <= assignment in the block,
else it uses =.
If <= is used, all = assigned variables are ignored if
`verilog-auto-reset-blocking-in-non' is nil; they are presumed
to be temporaries.
/*AUTORESET*/ presumes that any signals mentioned between the previous
begin/case/if statement and the AUTORESET comment are being reset manually
and should not be automatically reset. This includes omitting any signals
used on the right hand side of assignments.
By default, AUTORESET will include the width of the signal in the
autos, SystemVerilog designs may want to change this. To control
this behavior, see `verilog-auto-reset-widths'. In some cases
AUTORESET must use a '0 assignment and it will print NOWIDTH; use
`verilog-auto-reset-widths' unbased to prevent this.
AUTORESET ties signals to deasserted, which is presumed to be zero.
Signals that match `verilog-active-low-regexp' will be deasserted by tying
them to a one.
AUTORESET may try to reset arrays or structures that cannot be
reset by a simple assignment, resulting in compile errors. This
is a feature to be taken as a hint that you need to reset these
signals manually (or put them into a "`ifdef NEVER signal<=`0;
`endif" so Verilog-Mode ignores them.)
An example:
always @(posedge clk or negedge reset_l) begin
if (!reset_l) begin
c <= 1;
/*AUTORESET*/
end
else begin
a <= in_a;
b <= in_b;
c <= in_c;
end
end
Typing M-x verilog-auto will make this into:
always @(posedge core_clk or negedge reset_l) begin
if (!reset_l) begin
c <= 1;
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
a <= 0;
b = 0; // if `verilog-auto-reset-blocking-in-non' true
// End of automatics
end
else begin
a <= in_a;
b = in_b;
c <= in_c;
end
end