-
Notifications
You must be signed in to change notification settings - Fork 0
/
alt_reset_delay.v
63 lines (54 loc) · 2.28 KB
/
alt_reset_delay.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
52
53
54
55
56
57
58
59
60
61
62
////////////////////////////////////////////////////////////////////////////
// Copyright 2019 Intel Corporation.
//
// This reference design file is subject licensed to you by the terms and
// conditions of the applicable License Terms and Conditions for Hardware
// Reference Designs and/or Design Examples (either as signed by you or
// found at https://www.altera.com/common/legal/leg-license_agreement.html ).
//
// As stated in the license, you agree to only use this reference design
// solely in conjunction with Intel FPGAs or Intel CPLDs.
//
// THE REFERENCE DESIGN IS PROVIDED "AS IS" WITHOUT ANY EXPRESS OR IMPLIED
// WARRANTY OF ANY KIND INCLUDING WARRANTIES OF MERCHANTABILITY,
// NONINFRINGEMENT, OR FITNESS FOR A PARTICULAR PURPOSE. Intel does not
// warrant or assume responsibility for the accuracy or completeness of any
// information, links or other items within the Reference Design and any
// accompanying materials.
//
// In the event that you do not agree with such terms and conditions, do not
// use the reference design file.
////////////////////////////////////////////////////////////////////////////
`timescale 1 ps / 1 ps
// DESCRIPTION
//
// This is a more elaborate version of aclr_filter, typically used for
// bringing up SERDES pins or PLLs. When the input ready condition is
// not met the output is immediately driven to not ready. When the input
// ready becomes true the output will become ready after a programmable delay.
//
// CONFIDENCE
// This is used very liberally in Altera test and demo designs
//
module alt_reset_delay #(
parameter CNTR_BITS = 16
)
(
input clk,
input ready_in,
output ready_out
);
reg [2:0] rs_meta = 3'b0 /* synthesis preserve dont_replicate */
/* synthesis ALTERA_ATTRIBUTE = "-name SDC_STATEMENT \"set_false_path -from [get_fanins -async *reset_delay*rs_meta\[*\]] -to [get_keepers *reset_delay*rs_meta\[*\]]\" " */;
always @(posedge clk or negedge ready_in) begin
if (!ready_in) rs_meta <= 3'b000;
else rs_meta <= {rs_meta[1:0],1'b1};
end
wire ready_sync = rs_meta[2];
reg [CNTR_BITS-1:0] cntr = {CNTR_BITS{1'b0}} /* synthesis preserve */;
assign ready_out = cntr[CNTR_BITS-1];
always @(posedge clk or negedge ready_sync) begin
if (!ready_sync) cntr <= {CNTR_BITS{1'b0}};
else if (!ready_out) cntr <= cntr + 1'b1;
end
endmodule