1 |
26 |
jefflieu |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// Clk_ctrl.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// This file is part of the Ethernet IP core project ////
|
6 |
|
|
//// http://www.opencores.org/projects.cgi/web/ethernet_tri_mode/////
|
7 |
|
|
//// ////
|
8 |
|
|
//// Author(s): ////
|
9 |
|
|
//// - Jon Gao (gaojon@yahoo.com) ////
|
10 |
|
|
//// ////
|
11 |
|
|
//// ////
|
12 |
|
|
//////////////////////////////////////////////////////////////////////
|
13 |
|
|
//// ////
|
14 |
|
|
//// Copyright (C) 2001 Authors ////
|
15 |
|
|
//// ////
|
16 |
|
|
//// This source file may be used and distributed without ////
|
17 |
|
|
//// restriction provided that this copyright statement is not ////
|
18 |
|
|
//// removed from the file and that any derivative work contains ////
|
19 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
20 |
|
|
//// ////
|
21 |
|
|
//// This source file is free software; you can redistribute it ////
|
22 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
23 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
24 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
25 |
|
|
//// later version. ////
|
26 |
|
|
//// ////
|
27 |
|
|
//// This source is distributed in the hope that it will be ////
|
28 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
29 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
30 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
31 |
|
|
//// details. ////
|
32 |
|
|
//// ////
|
33 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
34 |
|
|
//// Public License along with this source; if not, download it ////
|
35 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
36 |
|
|
//// ////
|
37 |
|
|
//////////////////////////////////////////////////////////////////////
|
38 |
|
|
//
|
39 |
|
|
// CVS Revision History
|
40 |
|
|
//
|
41 |
|
|
// $Log: not supported by cvs2svn $
|
42 |
|
|
// Revision 1.2 2005/12/16 06:44:13 Administrator
|
43 |
|
|
// replaced tab with space.
|
44 |
|
|
// passed 9.6k length frame test.
|
45 |
|
|
//
|
46 |
|
|
// Revision 1.1.1.1 2005/12/13 01:51:44 Administrator
|
47 |
|
|
// no message
|
48 |
|
|
//
|
49 |
|
|
|
50 |
|
|
module Clk_ctrl_V4port(
|
51 |
|
|
Reset ,
|
52 |
|
|
Clk_125M ,
|
53 |
|
|
//host interface,
|
54 |
|
|
Speed ,
|
55 |
|
|
//Phy interface ,
|
56 |
|
|
Gtx_clk ,
|
57 |
|
|
Rx_clk ,
|
58 |
|
|
Tx_clk ,
|
59 |
|
|
//interface clk ,
|
60 |
|
|
MAC_tx_clk ,
|
61 |
|
|
MAC_rx_clk ,
|
62 |
|
|
MAC_tx_clk_div ,
|
63 |
|
|
MAC_rx_clk_div
|
64 |
|
|
);
|
65 |
|
|
input Reset ;
|
66 |
|
|
input Clk_125M ;
|
67 |
|
|
//host interface
|
68 |
|
|
input [2:0] Speed ;
|
69 |
|
|
//Phy interface
|
70 |
|
|
output Gtx_clk ;//used only in GMII mode
|
71 |
|
|
input Rx_clk ;
|
72 |
|
|
input Tx_clk ;//used only in MII mode
|
73 |
|
|
//interface clk signals
|
74 |
|
|
output MAC_tx_clk ;
|
75 |
|
|
output MAC_rx_clk ;
|
76 |
|
|
output MAC_tx_clk_div ;
|
77 |
|
|
output MAC_rx_clk_div ;
|
78 |
|
|
|
79 |
|
|
|
80 |
|
|
//******************************************************************************
|
81 |
|
|
//internal signals
|
82 |
|
|
//******************************************************************************
|
83 |
|
|
wire Rx_clk_div2 ;
|
84 |
|
|
wire Tx_clk_div2 ;
|
85 |
|
|
|
86 |
|
|
wire Clk125i, Clk125;
|
87 |
|
|
wire Clk25i, Clk25;
|
88 |
|
|
//******************************************************************************
|
89 |
|
|
//
|
90 |
|
|
//******************************************************************************
|
91 |
|
|
assign Gtx_clk =Clk_125M ;
|
92 |
|
|
assign MAC_rx_clk =Rx_clk ;
|
93 |
|
|
|
94 |
|
|
DCM_BASE #(
|
95 |
|
|
.CLKDV_DIVIDE(5.0), // Divide by: 1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5
|
96 |
|
|
// 7.0,7.5,8.0,9.0,10.0,11.0,12.0,13.0,14.0,15.0 or 16.0
|
97 |
|
|
.CLKFX_DIVIDE(5), // Can be any integer from 1 to 32
|
98 |
|
|
.CLKFX_MULTIPLY(1), // Can be any integer from 2 to 32
|
99 |
|
|
.CLKIN_DIVIDE_BY_2("FALSE"), // TRUE/FALSE to enable CLKIN divide by two feature
|
100 |
|
|
.CLKIN_PERIOD(10.0), // Specify period of input clock in ns from 1.25 to 1000.00
|
101 |
|
|
.CLKOUT_PHASE_SHIFT("NONE"), // Specify phase shift mode of NONE or FIXED
|
102 |
|
|
.CLK_FEEDBACK("1X"), // Specify clock feedback of NONE, 1X or 2X
|
103 |
|
|
.DCM_PERFORMANCE_MODE("MAX_SPEED"), // Can be MAX_SPEED or MAX_RANGE
|
104 |
|
|
.DESKEW_ADJUST("SYSTEM_SYNCHRONOUS"), // SOURCE_SYNCHRONOUS, SYSTEM_SYNCHRONOUS or
|
105 |
|
|
// an integer from 0 to 15
|
106 |
|
|
.DFS_FREQUENCY_MODE("LOW"), // LOW or HIGH frequency mode for frequency synthesis
|
107 |
|
|
.DLL_FREQUENCY_MODE("LOW"), // LOW, HIGH, or HIGH_SER frequency mode for DLL
|
108 |
|
|
.DUTY_CYCLE_CORRECTION("TRUE"), // Duty cycle correction, TRUE or FALSE
|
109 |
|
|
.FACTORY_JF(16'hf0f0), // FACTORY JF value suggested to be set to 16'hf0f0
|
110 |
|
|
.PHASE_SHIFT(0), // Amount of fixed phase shift from -255 to 1023
|
111 |
|
|
.STARTUP_WAIT("FALSE") // Delay configuration DONE until DCM LOCK, TRUE/FALSE
|
112 |
|
|
) DCM_BASE_TX125M (
|
113 |
|
|
.CLK0(Clk125), // 0 degree DCM CLK output
|
114 |
|
|
.CLK180(), // 180 degree DCM CLK output
|
115 |
|
|
.CLK270(), // 270 degree DCM CLK output
|
116 |
|
|
.CLK2X(), // 2X DCM CLK output
|
117 |
|
|
.CLK2X180(), // 2X, 180 degree DCM CLK out
|
118 |
|
|
.CLK90(), // 90 degree DCM CLK output
|
119 |
|
|
.CLKDV(Clk25), // Divided DCM CLK out (CLKDV_DIVIDE)
|
120 |
|
|
.CLKFX(), // DCM CLK synthesis out (M/D)
|
121 |
|
|
.CLKFX180(), // 180 degree CLK synthesis out
|
122 |
|
|
.LOCKED(), // DCM LOCK status output
|
123 |
|
|
.CLKFB(Clk125i), // DCM clock feedback
|
124 |
|
|
.CLKIN(Clk_125M), // Clock input (from IBUFG, BUFG or DCM)
|
125 |
|
|
.RST(rst) // DCM asynchronous reset input
|
126 |
|
|
);
|
127 |
|
|
|
128 |
|
|
BUFG
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
//pragma synthesis_off
|
132 |
|
|
CLK_DIV2_Wrapper U_0_CLK_DIV2(
|
133 |
|
|
.Reset (Reset ),
|
134 |
|
|
.IN (Rx_clk ),
|
135 |
|
|
.OUT (Rx_clk_div2 )
|
136 |
|
|
);
|
137 |
|
|
|
138 |
|
|
CLK_DIV2_Wrapper U_1_CLK_DIV2(
|
139 |
|
|
.Reset (Reset ),
|
140 |
|
|
.IN (Tx_clk ),
|
141 |
|
|
.OUT (Tx_clk_div2 )
|
142 |
|
|
);
|
143 |
|
|
|
144 |
|
|
CLK_SWITCH U_0_CLK_SWITCH(
|
145 |
|
|
.IN_0 (Rx_clk_div2 ),
|
146 |
|
|
.IN_1 (Rx_clk ),
|
147 |
|
|
.SW (Speed[2] ),
|
148 |
|
|
.OUT (MAC_rx_clk_div )
|
149 |
|
|
);
|
150 |
|
|
|
151 |
|
|
CLK_SWITCH U_1_CLK_SWITCH(
|
152 |
|
|
.IN_0 (Tx_clk ),
|
153 |
|
|
.IN_1 (Clk_125M ),
|
154 |
|
|
.SW (Speed[2] ),
|
155 |
|
|
.OUT (MAC_tx_clk )
|
156 |
|
|
);
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
CLK_SWITCH U_2_CLK_SWITCH(
|
160 |
|
|
.IN_0 (Tx_clk_div2 ),
|
161 |
|
|
.IN_1 (Clk_125M ),
|
162 |
|
|
.SW (Speed[2] ),
|
163 |
|
|
.OUT (MAC_tx_clk_div )
|
164 |
|
|
);
|
165 |
|
|
|
166 |
|
|
//pragma synthesis_on
|
167 |
|
|
|
168 |
|
|
endmodule
|