Synchronous reset
Use an active-low reset to compare a pulse that overlaps a sampling edge with one that falls entirely between edges. Mark when Q takes the reset value and when the first data word can be written after release.
The panel holds 31 in Q. First pull rst_n low between rising edges. Then hold it low across a rising edge. Which pulse clears the register?
The rising edge samples reset
This reset is active-low and synchronous. rst_n=0 requests a clear. Q becomes 00 when a rising edge samples reset low. That clear takes priority over any value then on D.
Test rst_n first at each rising edge
The block runs on posedge clk. At the rising edge, it checks rst_n first and captures D when reset is inactive.
module synchronous_reset8 (
input logic clk,
input logic rst_n,
input logic [7:0] d,
output logic [7:0] q
);
always_ff @(posedge clk) begin
if (!rst_n)
q <= 8'h00;
else
q <= d;
end
endmodule
Compare two low pulses
Rising edges are 10 ns apart. The data is hexadecimal, and Q shows the simulated value after each event. The pulse from 7 to 9 ns lies entirely between E0 and E1. The pulse from 19 to 27 ns overlaps E2.
| ns | Event | rst_n | Q |
|---|---|---|---|
| 5 | E0 stores 31 | 1 | 31 |
| 7 to 9 | Low pulse and release | 0→1 | 31 |
| 15 | E1 stores 52 | 1 | 52 |
| 19 | Reset goes low again | 0 | 52 |
| 25 | E2 samples reset | 0 | 00 |
| 27 | Reset releases | 1 | 00 |
| 35 | E3 stores A6 | 1 | A6 |
After release at 27 ns, Q holds the cleared value until 35 ns. If the clock stops, synchronous reset waits for the next rising edge. Apply the same stimulus to the asynchronous-reset circuit to compare when Q clears.
Replay the lab
Extract the executable lab on Linux or WSL and run bash run.sh. Icarus Verilog 12.0 checked 8 timed observations. The archive contains the RTL, testbench, log, VCD and generic Yosys structure. The checks include two assertions, two releases and four rising edges. Continue with F07 on registers, F14 on clock-domain crossings.
Interactive lab
Store a word with rst_n high. Then pull rst_n low and release it without applying an edge.
- Stored Q
Show the last eight observations
Teaching film
Run the RTL yourself
Extract the lab and follow the commands in its README. Compare the simulated outputs and waveform with your predictions from the interactive lab.
Download Synchronous reset RTL (.zip)