diff --git a/first/reset_conditioner.v b/first/reset_conditioner.v new file mode 100644 index 0000000..aa94218 --- /dev/null +++ b/first/reset_conditioner.v @@ -0,0 +1,31 @@ +/* + Parameters: + STAGES = 4 +*/ +module reset_conditioner ( + input clk, + input rin, + output reg rout + ); + + localparam STAGES = 3'h4; + + + reg [3:0] M_stage_d, M_stage_q = 4'hf; + + always @* begin + M_stage_d = M_stage_q; + + M_stage_d = {M_stage_q[0+2-:3], 1'h0}; + rout = M_stage_q[3+0-:1]; + end + + always @(posedge clk) begin + if (rin == 1'b1) begin + M_stage_q <= 4'hf; + end else begin + M_stage_q <= M_stage_d; + end + end + +endmodule