-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreset_generator.v
51 lines (41 loc) · 1.03 KB
/
reset_generator.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Generate a synchronous reset
// Reset signal (active low) is released on falling edge of the
// clock, to generate timing violation on rising edges on the clock
module reset_generator (/*AUTOARG*/
// Outputs
rst_n,
// Inputs
clk, rst_async
);
input clk;
input rst_async; // asynchronous reset
output rst_n; // synchronous reset
/*AUTOINPUT*/
/*AUTOOUTPUT*/
/*AUTOREG*/
/*AUTOWIRE*/
reg rst_async_m; // can be metastable
reg rst_async_r; // can be metastable
always @(negedge clk or negedge rst_async) begin
if(rst_async == 1'b0) begin
/*AUTORESET*/
// Beginning of autoreset for uninitialized flops
rst_async_m <= 1'h0;
rst_async_r <= 1'h0;
// End of automatics
end
else begin
rst_async_m <= 1'b1; // Can be metastable
rst_async_r <= rst_async_m;
end
end
// renaming
assign rst_n = rst_async_r;
endmodule // reset_generator
/*
Local Variables:
verilog-library-directories:(
"."
)
End:
*/