2014-03-24 21:41:00 +00:00
|
|
|
|
|
|
|
module util_sync_reset (
|
|
|
|
input async_resetn,
|
|
|
|
input clk,
|
|
|
|
output sync_resetn
|
|
|
|
);
|
|
|
|
|
|
|
|
// Keep it asserted for three clock cycles
|
2014-03-25 12:02:36 +00:00
|
|
|
reg [2:0] resetn = 3'b000;
|
2014-03-24 21:41:00 +00:00
|
|
|
|
2014-03-25 12:02:36 +00:00
|
|
|
assign sync_resetn = resetn[2];
|
2014-03-24 21:41:00 +00:00
|
|
|
|
|
|
|
always @(posedge clk or negedge async_resetn) begin
|
|
|
|
if (async_resetn == 1'b0) begin
|
2014-03-25 12:02:36 +00:00
|
|
|
resetn <= 3'b000;
|
2014-03-24 21:41:00 +00:00
|
|
|
end else begin
|
2014-03-25 12:02:36 +00:00
|
|
|
resetn <= {resetn[1:0], 1'b1};
|
2014-03-24 21:41:00 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
endmodule
|