1 |
3 |
kuzmi4 |
//------------------------------------------------------------------------------
|
2 |
|
|
// File : tri_mode_ethernet_mac_0_example_design_clock.v
|
3 |
|
|
// Author : Xilinx Inc.
|
4 |
|
|
// -----------------------------------------------------------------------------
|
5 |
|
|
// (c) Copyright 2012 Xilinx, Inc. All rights reserved.
|
6 |
|
|
//
|
7 |
|
|
// This file contains confidential and proprietary information
|
8 |
|
|
// of Xilinx, Inc. and is protected under U.S. and
|
9 |
|
|
// international copyright and other intellectual property
|
10 |
|
|
// laws.
|
11 |
|
|
//
|
12 |
|
|
// DISCLAIMER
|
13 |
|
|
// This disclaimer is not a license and does not grant any
|
14 |
|
|
// rights to the materials distributed herewith. Except as
|
15 |
|
|
// otherwise provided in a valid license issued to you by
|
16 |
|
|
// Xilinx, and to the maximum extent permitted by applicable
|
17 |
|
|
// law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND
|
18 |
|
|
// WITH ALL FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES
|
19 |
|
|
// AND CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING
|
20 |
|
|
// BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, NON-
|
21 |
|
|
// INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; and
|
22 |
|
|
// (2) Xilinx shall not be liable (whether in contract or tort,
|
23 |
|
|
// including negligence, or under any other theory of
|
24 |
|
|
// liability) for any loss or damage of any kind or nature
|
25 |
|
|
// related to, arising under or in connection with these
|
26 |
|
|
// materials, including for any direct, or any indirect,
|
27 |
|
|
// special, incidental, or consequential loss or damage
|
28 |
|
|
// (including loss of data, profits, goodwill, or any type of
|
29 |
|
|
// loss or damage suffered as a result of any action brought
|
30 |
|
|
// by a third party) even if such damage or loss was
|
31 |
|
|
// reasonably foreseeable or Xilinx had been advised of the
|
32 |
|
|
// possibility of the same.
|
33 |
|
|
//
|
34 |
|
|
// CRITICAL APPLICATIONS
|
35 |
|
|
// Xilinx products are not designed or intended to be fail-
|
36 |
|
|
// safe, or for use in any application requiring fail-safe
|
37 |
|
|
// performance, such as life-support or safety devices or
|
38 |
|
|
// systems, Class III medical devices, nuclear facilities,
|
39 |
|
|
// applications related to the deployment of airbags, or any
|
40 |
|
|
// other applications that could lead to death, personal
|
41 |
|
|
// injury, or severe property or environmental damage
|
42 |
|
|
// (individually and collectively, "Critical
|
43 |
|
|
// Applications"). Customer assumes the sole risk and
|
44 |
|
|
// liability of any use of Xilinx products in Critical
|
45 |
|
|
// Applications, subject only to applicable laws and
|
46 |
|
|
// regulations governing limitations on product liability.
|
47 |
|
|
//
|
48 |
|
|
// THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS
|
49 |
|
|
// PART OF THIS FILE AT ALL TIMES.
|
50 |
|
|
// -----------------------------------------------------------------------------
|
51 |
|
|
// Description: This block generates the clocking logic required for the
|
52 |
|
|
// example design.
|
53 |
|
|
|
54 |
|
|
`timescale 1 ps/1 ps
|
55 |
|
|
|
56 |
|
|
module tri_mode_ethernet_mac_0_example_design_clocks
|
57 |
|
|
(
|
58 |
|
|
// differential clock inputs
|
59 |
|
|
input clk_in_p,
|
60 |
|
|
input clk_in_n,
|
61 |
|
|
|
62 |
|
|
// asynchronous control/resets
|
63 |
|
|
input glbl_rst,
|
64 |
|
|
output dcm_locked,
|
65 |
|
|
|
66 |
|
|
// clock outputs
|
67 |
|
|
output gtx_clk_bufg,
|
68 |
|
|
output refclk_bufg,
|
69 |
|
|
output s_axi_aclk
|
70 |
|
|
);
|
71 |
|
|
|
72 |
|
|
|
73 |
|
|
wire clkin1;
|
74 |
|
|
wire mmcm_rst;
|
75 |
|
|
wire clkin1_bufg;
|
76 |
|
|
wire dcm_locked_int;
|
77 |
|
|
wire dcm_locked_sync;
|
78 |
|
|
reg dcm_locked_reg = 1;
|
79 |
|
|
reg dcm_locked_edge = 1;
|
80 |
|
|
|
81 |
|
|
// Input buffering
|
82 |
|
|
//------------------------------------
|
83 |
|
|
IBUFDS clkin1_buf
|
84 |
|
|
(.O (clkin1),
|
85 |
|
|
.I (clk_in_p),
|
86 |
|
|
.IB (clk_in_n));
|
87 |
|
|
|
88 |
|
|
// route clkin1 through a BUFGCE for the MMCM reset generation logic
|
89 |
|
|
BUFGCE bufg_clkin1 (.I(clkin1), .CE (1'b1), .O(clkin1_bufg));
|
90 |
|
|
|
91 |
|
|
// detect a falling edge on dcm_locked (after resyncing to this domain)
|
92 |
|
|
tri_mode_ethernet_mac_0_sync_block lock_sync (
|
93 |
|
|
.clk (clkin1_bufg),
|
94 |
|
|
.data_in (dcm_locked_int),
|
95 |
|
|
.data_out (dcm_locked_sync)
|
96 |
|
|
);
|
97 |
|
|
|
98 |
|
|
// for the falling edge detect we want to force this at power on so init the flop to 1
|
99 |
|
|
always @(posedge clkin1_bufg)
|
100 |
|
|
begin
|
101 |
|
|
dcm_locked_reg <= dcm_locked_sync;
|
102 |
|
|
dcm_locked_edge <= dcm_locked_reg & !dcm_locked_sync;
|
103 |
|
|
end
|
104 |
|
|
|
105 |
|
|
// the MMCM reset should be at least 5ns - that is one cycle of the input clock -
|
106 |
|
|
// since the source of the input reset is unknown (a push switch in board design)
|
107 |
|
|
// this needs to be debounced
|
108 |
|
|
tri_mode_ethernet_mac_0_reset_sync mmcm_reset_gen (
|
109 |
|
|
.clk (clkin1_bufg),
|
110 |
|
|
.enable (1'b1),
|
111 |
|
|
.reset_in (glbl_rst | dcm_locked_edge),
|
112 |
|
|
.reset_out (mmcm_rst)
|
113 |
|
|
);
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
//----------------------------------------------------------------------------
|
117 |
|
|
// Generate clocks using the clock wizard
|
118 |
|
|
//----------------------------------------------------------------------------
|
119 |
|
|
|
120 |
|
|
tri_mode_ethernet_mac_0_clk_wiz clock_generator
|
121 |
|
|
(
|
122 |
|
|
// Clock in ports
|
123 |
|
|
.CLK_IN1 (clkin1),
|
124 |
|
|
// Clock out ports
|
125 |
|
|
.CLK_OUT1 (gtx_clk_bufg),
|
126 |
|
|
.CLK_OUT2 (s_axi_aclk),
|
127 |
|
|
.CLK_OUT3 (refclk_bufg),
|
128 |
|
|
// Status and control signals
|
129 |
|
|
.RESET (mmcm_rst),
|
130 |
|
|
.LOCKED (dcm_locked_int)
|
131 |
|
|
);
|
132 |
|
|
|
133 |
|
|
assign dcm_locked = dcm_locked_int;
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
|
137 |
|
|
endmodule
|