1 |
32 |
redbear |
// (C) 2001-2017 Intel Corporation. All rights reserved.
|
2 |
|
|
// Your use of Intel Corporation's design tools, logic functions and other
|
3 |
|
|
// software and tools, and its AMPP partner logic functions, and any output
|
4 |
40 |
redbear |
// files from any of the foregoing (including device programming or simulation
|
5 |
32 |
redbear |
// files), and any associated documentation or information are expressly subject
|
6 |
|
|
// to the terms and conditions of the Intel Program License Subscription
|
7 |
40 |
redbear |
// Agreement, Intel FPGA IP License Agreement, or other applicable
|
8 |
32 |
redbear |
// license agreement, including, without limitation, that your use is for the
|
9 |
|
|
// sole purpose of programming logic devices manufactured by Intel and sold by
|
10 |
|
|
// Intel or its authorized distributors. Please refer to the applicable
|
11 |
|
|
// agreement for further details.
|
12 |
|
|
|
13 |
|
|
|
14 |
40 |
redbear |
// $Id: //acds/rel/17.1std/ip/merlin/altera_reset_controller/altera_reset_synchronizer.v#1 $
|
15 |
32 |
redbear |
// $Revision: #1 $
|
16 |
40 |
redbear |
// $Date: 2017/07/30 $
|
17 |
32 |
redbear |
// $Author: swbranch $
|
18 |
|
|
|
19 |
|
|
// -----------------------------------------------
|
20 |
|
|
// Reset Synchronizer
|
21 |
|
|
// -----------------------------------------------
|
22 |
|
|
`timescale 1 ns / 1 ns
|
23 |
|
|
|
24 |
|
|
module altera_reset_synchronizer
|
25 |
|
|
#(
|
26 |
|
|
parameter ASYNC_RESET = 1,
|
27 |
|
|
parameter DEPTH = 2
|
28 |
|
|
)
|
29 |
|
|
(
|
30 |
|
|
input reset_in /* synthesis ALTERA_ATTRIBUTE = "SUPPRESS_DA_RULE_INTERNAL=R101" */,
|
31 |
|
|
|
32 |
|
|
input clk,
|
33 |
|
|
output reset_out
|
34 |
|
|
);
|
35 |
|
|
|
36 |
|
|
// -----------------------------------------------
|
37 |
|
|
// Synchronizer register chain. We cannot reuse the
|
38 |
|
|
// standard synchronizer in this implementation
|
39 |
|
|
// because our timing constraints are different.
|
40 |
|
|
//
|
41 |
|
|
// Instead of cutting the timing path to the d-input
|
42 |
|
|
// on the first flop we need to cut the aclr input.
|
43 |
|
|
//
|
44 |
|
|
// We omit the "preserve" attribute on the final
|
45 |
|
|
// output register, so that the synthesis tool can
|
46 |
|
|
// duplicate it where needed.
|
47 |
|
|
// -----------------------------------------------
|
48 |
|
|
(*preserve*) reg [DEPTH-1:0] altera_reset_synchronizer_int_chain;
|
49 |
|
|
reg altera_reset_synchronizer_int_chain_out;
|
50 |
|
|
|
51 |
|
|
generate if (ASYNC_RESET) begin
|
52 |
|
|
|
53 |
|
|
// -----------------------------------------------
|
54 |
|
|
// Assert asynchronously, deassert synchronously.
|
55 |
|
|
// -----------------------------------------------
|
56 |
|
|
always @(posedge clk or posedge reset_in) begin
|
57 |
|
|
if (reset_in) begin
|
58 |
|
|
altera_reset_synchronizer_int_chain <= {DEPTH{1'b1}};
|
59 |
|
|
altera_reset_synchronizer_int_chain_out <= 1'b1;
|
60 |
|
|
end
|
61 |
|
|
else begin
|
62 |
|
|
altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1];
|
63 |
|
|
altera_reset_synchronizer_int_chain[DEPTH-1] <= 0;
|
64 |
|
|
altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0];
|
65 |
|
|
end
|
66 |
|
|
end
|
67 |
|
|
|
68 |
|
|
assign reset_out = altera_reset_synchronizer_int_chain_out;
|
69 |
|
|
|
70 |
|
|
end else begin
|
71 |
|
|
|
72 |
|
|
// -----------------------------------------------
|
73 |
|
|
// Assert synchronously, deassert synchronously.
|
74 |
|
|
// -----------------------------------------------
|
75 |
|
|
always @(posedge clk) begin
|
76 |
|
|
altera_reset_synchronizer_int_chain[DEPTH-2:0] <= altera_reset_synchronizer_int_chain[DEPTH-1:1];
|
77 |
|
|
altera_reset_synchronizer_int_chain[DEPTH-1] <= reset_in;
|
78 |
|
|
altera_reset_synchronizer_int_chain_out <= altera_reset_synchronizer_int_chain[0];
|
79 |
|
|
end
|
80 |
|
|
|
81 |
|
|
assign reset_out = altera_reset_synchronizer_int_chain_out;
|
82 |
|
|
|
83 |
|
|
end
|
84 |
|
|
endgenerate
|
85 |
|
|
|
86 |
|
|
endmodule
|
87 |
|
|
|