// reset_sync.sv // Reset synchroniser: asserts asynchronously, deasserts synchronously to clk. // rst_n_out goes low as soon as arst_n goes low, even with no clock running. // It goes high two clk edges after arst_n is released, so every flop in the // domain leaves reset on the same clock edge. `timescale 1ns/1ps module reset_sync ( input logic clk, input logic arst_n, // asynchronous active-low reset (button, PLL lock, other domain) output logic rst_n_out // active-low reset for this clock domain ); (* ASYNC_REG = "TRUE" *) logic [1:0] rst_ff; always_ff @(posedge clk or negedge arst_n) begin if (!arst_n) begin rst_ff <= 2'b00; end else begin rst_ff <= {rst_ff[0], 1'b1}; end end assign rst_n_out = rst_ff[1]; endmodule