Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / mcu / rtl / mcu_bnksm_ctl.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: mcu_bnksm_ctl.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 ============================================
35module mcu_bnksm_ctl (
36 rcd_cnt_is_zero,
37 rc_cnt_is_zero,
38 dal_cnt_is_zero,
39 drif_abnk_ras_picked,
40 drif_abnk_cas_picked,
41 drif_bcbnk_ras_picked,
42 drif_bcbnk_cas_picked,
43 drif_cmd_picked_d1,
44 rcd_reg,
45 rc_reg,
46 dal_reg,
47 ral_reg,
48 fbdic_sync_frame_req_l,
49 l1clk,
50 scan_in,
51 scan_out,
52 tcu_aclk,
53 tcu_bclk,
54 tcu_scan_en);
55wire siclk;
56wire soclk;
57wire se;
58wire drif_bnk_ras_picked;
59wire drif_bnk_cas_picked;
60wire [3:0] rcd_cnt_next;
61wire [3:0] rcd_cnt;
62wire ff_rcd_cnt_scanin;
63wire ff_rcd_cnt_scanout;
64wire [4:0] rc_cnt_next;
65wire [4:0] rc_cnt;
66wire ff_rc_cnt_scanin;
67wire ff_rc_cnt_scanout;
68wire [4:0] dal_cnt_next;
69wire [4:0] dal_cnt;
70wire ff_dal_cnt_scanin;
71wire ff_dal_cnt_scanout;
72
73
74output rcd_cnt_is_zero;
75output rc_cnt_is_zero;
76output dal_cnt_is_zero;
77
78input drif_abnk_ras_picked;
79input drif_abnk_cas_picked;
80input drif_bcbnk_ras_picked;
81input drif_bcbnk_cas_picked;
82input drif_cmd_picked_d1;
83input [3:0] rcd_reg;
84input [4:0] rc_reg;
85input [4:0] dal_reg;
86input [4:0] ral_reg;
87input fbdic_sync_frame_req_l;
88
89input l1clk;
90input scan_in;
91output scan_out;
92input tcu_aclk;
93input tcu_bclk;
94input tcu_scan_en;
95
96// Code
97assign siclk = tcu_aclk;
98assign soclk = tcu_bclk;
99assign se = tcu_scan_en;
100
101assign drif_bnk_ras_picked = drif_abnk_ras_picked | drif_bcbnk_ras_picked;
102assign drif_bnk_cas_picked = drif_abnk_cas_picked | drif_bcbnk_cas_picked;
103
104//////////////////////////////////////////////////////////////////
105// mcu bank SM
106//////////////////////////////////////////////////////////////////
107
108// ras to cas delay timer
109assign rcd_cnt_next[3:0] = drif_bnk_ras_picked & fbdic_sync_frame_req_l ? rcd_reg[3:0] - 4'h1 :
110 (rcd_cnt[3:0] == 4'h0) ? 4'h0 : rcd_cnt[3:0] - 4'h1;
111
112mcu_bnksm_ctl_msff_ctl_macro__width_4 ff_rcd_cnt (
113 .scan_in(ff_rcd_cnt_scanin),
114 .scan_out(ff_rcd_cnt_scanout),
115 .din(rcd_cnt_next[3:0]),
116 .dout(rcd_cnt[3:0]),
117 .l1clk(l1clk),
118 .siclk(siclk),
119 .soclk(soclk));
120
121assign rcd_cnt_is_zero = (rcd_cnt[3:0] == 4'h0);
122
123// ras to ras (bankA to bankA) delay timer
124assign rc_cnt_next[4:0] = drif_bnk_ras_picked & fbdic_sync_frame_req_l ? rc_reg[4:0] :
125 (rc_cnt[4:0] == 5'h0) ? 5'h0 : rc_cnt[4:0] - 5'h1;
126
127mcu_bnksm_ctl_msff_ctl_macro__width_5 ff_rc_cnt (
128 .scan_in(ff_rc_cnt_scanin),
129 .scan_out(ff_rc_cnt_scanout),
130 .din(rc_cnt_next[4:0]),
131 .dout(rc_cnt[4:0]),
132 .l1clk(l1clk),
133 .siclk(siclk),
134 .soclk(soclk));
135
136assign rc_cnt_is_zero = (rc_cnt[4:0] == 5'h0);
137
138// read/write to ras (DAL) delay timer
139assign dal_cnt_next[4:0] = drif_bnk_cas_picked & fbdic_sync_frame_req_l ?
140 ((drif_cmd_picked_d1 & drif_abnk_cas_picked | drif_bcbnk_cas_picked) ?
141 dal_reg[4:0] : ral_reg[4:0]) :
142 ((dal_cnt[4:0] == 5'h0) ? 5'h0 : dal_cnt[4:0] - 5'h1);
143
144mcu_bnksm_ctl_msff_ctl_macro__width_5 ff_dal_cnt (
145 .scan_in(ff_dal_cnt_scanin),
146 .scan_out(ff_dal_cnt_scanout),
147 .din(dal_cnt_next[4:0]),
148 .dout(dal_cnt[4:0]),
149 .l1clk(l1clk),
150 .siclk(siclk),
151 .soclk(soclk));
152
153assign dal_cnt_is_zero = (dal_cnt[4:0] == 5'h0);
154
155// fixscan start:
156assign ff_rcd_cnt_scanin = scan_in ;
157assign ff_rc_cnt_scanin = ff_rcd_cnt_scanout ;
158assign ff_dal_cnt_scanin = ff_rc_cnt_scanout ;
159assign scan_out = ff_dal_cnt_scanout ;
160// fixscan end:
161endmodule
162
163
164
165
166
167
168// any PARAMS parms go into naming of macro
169
170module mcu_bnksm_ctl_msff_ctl_macro__width_4 (
171 din,
172 l1clk,
173 scan_in,
174 siclk,
175 soclk,
176 dout,
177 scan_out);
178wire [3:0] fdin;
179wire [2:0] so;
180
181 input [3:0] din;
182 input l1clk;
183 input scan_in;
184
185
186 input siclk;
187 input soclk;
188
189 output [3:0] dout;
190 output scan_out;
191assign fdin[3:0] = din[3:0];
192
193
194
195
196
197
198dff #(4) d0_0 (
199.l1clk(l1clk),
200.siclk(siclk),
201.soclk(soclk),
202.d(fdin[3:0]),
203.si({scan_in,so[2:0]}),
204.so({so[2:0],scan_out}),
205.q(dout[3:0])
206);
207
208
209
210
211
212
213
214
215
216
217
218
219endmodule
220
221
222
223
224
225
226
227
228
229
230
231
232
233// any PARAMS parms go into naming of macro
234
235module mcu_bnksm_ctl_msff_ctl_macro__width_5 (
236 din,
237 l1clk,
238 scan_in,
239 siclk,
240 soclk,
241 dout,
242 scan_out);
243wire [4:0] fdin;
244wire [3:0] so;
245
246 input [4:0] din;
247 input l1clk;
248 input scan_in;
249
250
251 input siclk;
252 input soclk;
253
254 output [4:0] dout;
255 output scan_out;
256assign fdin[4:0] = din[4:0];
257
258
259
260
261
262
263dff #(5) d0_0 (
264.l1clk(l1clk),
265.siclk(siclk),
266.soclk(soclk),
267.d(fdin[4:0]),
268.si({scan_in,so[3:0]}),
269.so({so[3:0],scan_out}),
270.q(dout[4:0])
271);
272
273
274
275
276
277
278
279
280
281
282
283
284endmodule
285
286
287
288
289
290
291
292