Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / verif / env / mcu / nb_bitlane_deskew.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: nb_bitlane_deskew.v
4// Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved
5// 4150 Network Circle, Santa Clara, California 95054, U.S.A.
6//
7// * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8//
9// This program is free software; you can redistribute it and/or modify
10// it under the terms of the GNU General Public License as published by
11// the Free Software Foundation; version 2 of the License.
12//
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU General Public License for more details.
17//
18// You should have received a copy of the GNU General Public License
19// along with this program; if not, write to the Free Software
20// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21//
22// For the avoidance of doubt, and except that if any non-GPL license
23// choice is available it will apply instead, Sun elects to use only
24// the General Public License version 2 (GPLv2) at this time for any
25// software where a choice of GPL license versions is made
26// available with the language indicating that GPLv2 or any later version
27// may be used, or where a choice of which version of the GPL is applied is
28// otherwise unspecified.
29//
30// Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
31// CA 95054 USA or visit www.sun.com if you need additional information or
32// have any questions.
33//
34// ========== Copyright Header End ============================================
35`timescale 1fs/1fs
36
37module nb_bitlane_deskew(
38 fbdimm0a_rx_p_top, fbdimm0a_rx_n_top, fbdimm0b_rx_p_top, fbdimm0b_rx_n_top,
39 fbdimm1a_rx_p_top, fbdimm1a_rx_n_top, fbdimm1b_rx_p_top, fbdimm1b_rx_n_top,
40 fbdimm2a_rx_p_top, fbdimm2a_rx_n_top, fbdimm2b_rx_p_top, fbdimm2b_rx_n_top,
41 fbdimm3a_rx_p_top, fbdimm3a_rx_n_top, fbdimm3b_rx_p_top, fbdimm3b_rx_n_top,
42 FBDIMM0A_RX_P_TOP, FBDIMM0A_RX_N_TOP, FBDIMM0B_RX_P_TOP, FBDIMM0B_RX_N_TOP,
43 FBDIMM1A_RX_P_TOP, FBDIMM1A_RX_N_TOP, FBDIMM1B_RX_P_TOP, FBDIMM1B_RX_N_TOP,
44 FBDIMM2A_RX_P_TOP, FBDIMM2A_RX_N_TOP, FBDIMM2B_RX_P_TOP, FBDIMM2B_RX_N_TOP,
45 FBDIMM3A_RX_P_TOP, FBDIMM3A_RX_N_TOP, FBDIMM3B_RX_P_TOP, FBDIMM3B_RX_N_TOP,
46 sysclk
47);
48
49input [13:0] fbdimm0a_rx_p_top;
50input [13:0] fbdimm0a_rx_n_top;
51input [13:0] fbdimm0b_rx_p_top;
52input [13:0] fbdimm0b_rx_n_top;
53input [13:0] fbdimm1a_rx_p_top;
54input [13:0] fbdimm1a_rx_n_top;
55input [13:0] fbdimm1b_rx_p_top;
56input [13:0] fbdimm1b_rx_n_top;
57input [13:0] fbdimm2a_rx_p_top;
58input [13:0] fbdimm2a_rx_n_top;
59input [13:0] fbdimm2b_rx_p_top;
60input [13:0] fbdimm2b_rx_n_top;
61input [13:0] fbdimm3a_rx_p_top;
62input [13:0] fbdimm3a_rx_n_top;
63input [13:0] fbdimm3b_rx_p_top;
64input [13:0] fbdimm3b_rx_n_top;
65
66output [13:0] FBDIMM0A_RX_P_TOP;
67output [13:0] FBDIMM0A_RX_N_TOP;
68output [13:0] FBDIMM0B_RX_P_TOP;
69output [13:0] FBDIMM0B_RX_N_TOP;
70output [13:0] FBDIMM1A_RX_P_TOP;
71output [13:0] FBDIMM1A_RX_N_TOP;
72output [13:0] FBDIMM1B_RX_P_TOP;
73output [13:0] FBDIMM1B_RX_N_TOP;
74output [13:0] FBDIMM2A_RX_P_TOP;
75output [13:0] FBDIMM2A_RX_N_TOP;
76output [13:0] FBDIMM2B_RX_P_TOP;
77output [13:0] FBDIMM2B_RX_N_TOP;
78output [13:0] FBDIMM3A_RX_P_TOP;
79output [13:0] FBDIMM3A_RX_N_TOP;
80output [13:0] FBDIMM3B_RX_P_TOP;
81output [13:0] FBDIMM3B_RX_N_TOP;
82
83input sysclk;
84
85`ifdef MCU_GATE
86wire init_done_0 = (`MCU0.fbdic__n15588) ;
87wire init_done_1 = (`MCU1.fbdic__n15588) ;
88wire init_done_2 = (`MCU2.fbdic__n15588) ;
89wire init_done_3 = (`MCU3.fbdic__n15588) ;
90`else
91wire init_done_0 = (`MCU0.fbdic.fbdic_l0_state) ;
92wire init_done_1 = (`MCU1.fbdic.fbdic_l0_state) ;
93wire init_done_2 = (`MCU2.fbdic.fbdic_l0_state) ;
94wire init_done_3 = (`MCU3.fbdic.fbdic_l0_state) ;
95`endif // mcu_gate
96
97wire skew_enable_0;
98wire skew_enable_1;
99wire skew_enable_2;
100wire skew_enable_3;
101
102reg dtm_enabled;
103
104reg ref_dram_12x_clk_reg;
105wire dram_12x_clk;
106integer ref_dram_12x_clk_period;
107integer time1_r, time2_r;
108
109assign skew_enable_0 = dtm_enabled ? init_done_0 : 1'b1;
110assign skew_enable_1 = dtm_enabled ? init_done_1 : 1'b1;
111assign skew_enable_2 = dtm_enabled ? init_done_2 : 1'b1;
112assign skew_enable_3 = dtm_enabled ? init_done_3 : 1'b1;
113
114// ---- Clock Generator for FBD Channel clock ; dr_clk X 12 (linkclk) -----
115
116initial
117begin
118 #1;
119
120 if ($test$plusargs("DTM_ENABLED"))
121 dtm_enabled = 1;
122 else
123 dtm_enabled = 0;
124
125 ref_dram_12x_clk_reg=0;
126 @ (posedge `CCU.ccu_rst_sync_stable);
127 @ (posedge sysclk);
128 time1_r=$realtime;
129 @ (posedge sysclk);
130 time2_r=$realtime;
131 if (dtm_enabled)
132 ref_dram_12x_clk_period=(time2_r-time1_r)/(12);
133 else
134 ref_dram_12x_clk_period=(time2_r-time1_r)/(12*2);
135 forever begin #(ref_dram_12x_clk_period/2) ref_dram_12x_clk_reg = ~ref_dram_12x_clk_reg; end
136end
137
138 assign dram_12x_clk = ref_dram_12x_clk_reg ;
139
140//-----------------------------------
141// NB Bit Lane Deskew Modules
142//-----------------------------------
143
144nb_bit_lane_deskew nb_bitdskw0a_p (
145 .pn_in (fbdimm0a_rx_p_top[13:0]),
146 .pn_out (FBDIMM0A_RX_P_TOP[13:0]),
147 .init (skew_enable_0),
148 .sclk (dram_12x_clk)
149);
150
151nb_bit_lane_deskew nb_bitdskw0a_n (
152 .pn_in (fbdimm0a_rx_n_top[13:0]),
153 .pn_out (FBDIMM0A_RX_N_TOP[13:0]),
154 .init (skew_enable_0),
155 .sclk (dram_12x_clk)
156);
157
158nb_bit_lane_deskew nb_bitdskw0b_p (
159 .pn_in (fbdimm0b_rx_p_top[13:0]),
160 .pn_out (FBDIMM0B_RX_P_TOP[13:0]),
161 .init (skew_enable_0),
162 .sclk (dram_12x_clk)
163);
164
165nb_bit_lane_deskew nb_bitdskw0b_n (
166 .pn_in (fbdimm0b_rx_n_top[13:0]),
167 .pn_out (FBDIMM0B_RX_N_TOP[13:0]),
168 .init (skew_enable_0),
169 .sclk (dram_12x_clk)
170);
171
172nb_bit_lane_deskew nb_bitdskw1a_p (
173 .pn_in (fbdimm1a_rx_p_top[13:0]),
174 .pn_out (FBDIMM1A_RX_P_TOP[13:0]),
175 .init (skew_enable_1),
176 .sclk (dram_12x_clk)
177);
178
179nb_bit_lane_deskew nb_bitdskw1a_n (
180 .pn_in (fbdimm1a_rx_n_top[13:0]),
181 .pn_out (FBDIMM1A_RX_N_TOP[13:0]),
182 .init (skew_enable_1),
183 .sclk (dram_12x_clk)
184);
185
186nb_bit_lane_deskew nb_bitdskw1b_p (
187 .pn_in (fbdimm1b_rx_p_top[13:0]),
188 .pn_out (FBDIMM1B_RX_P_TOP[13:0]),
189 .init (skew_enable_1),
190 .sclk (dram_12x_clk)
191);
192
193nb_bit_lane_deskew nb_bitdskw1b_n (
194 .pn_in (fbdimm1b_rx_n_top[13:0]),
195 .pn_out (FBDIMM1B_RX_N_TOP[13:0]),
196 .init (skew_enable_1),
197 .sclk (dram_12x_clk)
198);
199
200nb_bit_lane_deskew nb_bitdskw2a_p (
201 .pn_in (fbdimm2a_rx_p_top[13:0]),
202 .pn_out (FBDIMM2A_RX_P_TOP[13:0]),
203 .init (skew_enable_2),
204 .sclk (dram_12x_clk)
205);
206
207nb_bit_lane_deskew nb_bitdskw2a_n (
208 .pn_in (fbdimm2a_rx_n_top[13:0]),
209 .pn_out (FBDIMM2A_RX_N_TOP[13:0]),
210 .init (skew_enable_2),
211 .sclk (dram_12x_clk)
212);
213
214nb_bit_lane_deskew nb_bitdskw2b_p (
215 .pn_in (fbdimm2b_rx_p_top[13:0]),
216 .pn_out (FBDIMM2B_RX_P_TOP[13:0]),
217 .init (skew_enable_2),
218 .sclk (dram_12x_clk)
219);
220
221nb_bit_lane_deskew nb_bitdskw2b_n (
222 .pn_in (fbdimm2b_rx_n_top[13:0]),
223 .pn_out (FBDIMM2B_RX_N_TOP[13:0]),
224 .init (skew_enable_2),
225 .sclk (dram_12x_clk)
226);
227
228nb_bit_lane_deskew nb_bitdskw3a_p (
229 .pn_in (fbdimm3a_rx_p_top[13:0]),
230 .pn_out (FBDIMM3A_RX_P_TOP[13:0]),
231 .init (skew_enable_3),
232 .sclk (dram_12x_clk)
233);
234
235nb_bit_lane_deskew nb_bitdskw3a_n (
236 .pn_in (fbdimm3a_rx_n_top[13:0]),
237 .pn_out (FBDIMM3A_RX_N_TOP[13:0]),
238 .init (skew_enable_3),
239 .sclk (dram_12x_clk)
240);
241
242nb_bit_lane_deskew nb_bitdskw3b_p (
243 .pn_in (fbdimm3b_rx_p_top[13:0]),
244 .pn_out (FBDIMM3B_RX_P_TOP[13:0]),
245 .init (skew_enable_3),
246 .sclk (dram_12x_clk)
247);
248
249nb_bit_lane_deskew nb_bitdskw3b_n (
250 .pn_in (fbdimm3b_rx_n_top[13:0]),
251 .pn_out (FBDIMM3B_RX_N_TOP[13:0]),
252 .init (skew_enable_3),
253 .sclk (dram_12x_clk)
254);
255
256endmodule