Home / Learn Verilog / Reset: Starting in a Known State
Reset: Starting in a Known State
Without reset, registers start as x. A reset forces them to a known value.
Bottom lineWithout reset, registers start as x. A reset forces them to a known value.
Breaking it down
What it is
A reset signal puts all registers into a defined starting state. Synchronous reset is checked at a clock edge; asynchronous reset acts immediately.
Why it matters
Real flip-flops power up with random values. Without a reset your design starts in an unknown state and may never recover.
Mechanically speaking
Add a reset input. In the always block, test reset first and assign the initial value. Active-low reset (rst_n) is common.
Shows up in
- Every sequential design
- FPGA configuration
- System start-up
Without and with reset
Counter without reset stays xVerilog: edit and run
The counter without reset never leaves x because x + 1 is x. The counter with reset starts at 0 and counts.
Careful:FPGAs let you set an initial value in the declaration (reg q = 0). ASICs need a real reset signal. Good habit: always provide a reset.
Check yourself
1. Without a reset, a register starts as...
In simulation it is x.
2. rst_n means...
The _n suffix marks active low.