Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / dmu / rtl / dmu_ilu_eil_xfrfsm.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: dmu_ilu_eil_xfrfsm.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 dmu_ilu_eil_xfrfsm (
36 clk,
37 rst_l,
38
39 d2p_ehb_we,
40 n_d2p_ehb_we,
41
42 rcd_empty,
43 rcd_deq,
44 y2k_rcd_deq,
45
46 xfrfsm_is_wfh,
47 data_start,
48 data_done,
49 only_one_rd_and_can_move,
50
51 ehb_full,
52
53 has_payld,
54
55 cib2eil_drain,
56
57 // idle check
58 xfrfsm_is_idle,
59
60 // Header parity invert
61 ilu_diagnos_ehi_trig_hw_clr,
62 ilu_diagnos_ehi_trig_hw_read,
63 ilu_diagnos_ehi_par_hw_read,
64 d2p_ehb_dpar_0,
65 d2p_ehb_dpar,
66
67 // debug
68 xfr_state );
69
70 // synopsys sync_set_reset "rst_l"
71
72 // >>>>>>>>>>>>>>>>>>>>>>>>> Parameter Declarations <<<<<<<<<<<<<<<<<<<<<<<<<
73
74 // states
75 parameter // summit enum xfr_enum
76 IDLE = 0,
77 DATA = 1,
78 DEQ = 2,
79 WFH = 3; // wait for EHB header space
80
81 // state number
82 parameter STATE_NUM = 4;
83
84 // >>>>>>>>>>>>>>>>>>>>>>>>> Port Declarations <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
85
86 //---------------------------------------------------------------------
87 // Clock and Reset Signals
88 //---------------------------------------------------------------------
89 input clk; // input clock
90 input rst_l; // input reset
91
92 //---------------------------------------------------------------------
93 // rcd FIFO interface
94 //---------------------------------------------------------------------
95 input rcd_empty; // from *_rcdbldr.v
96 output rcd_deq; // to *_rcdbldr.v
97 output y2k_rcd_deq;
98
99 //---------------------------------------------------------------------
100 // EHB
101 //---------------------------------------------------------------------
102 output d2p_ehb_we; // EHB write stroke
103 output n_d2p_ehb_we; // drives d2p_ehb_we, to *_bufmgr.v
104
105 //---------------------------------------------------------------------
106 // talk to datafsm.v
107 //---------------------------------------------------------------------
108 output data_start; // to *_datafsm.v
109 input data_done; // from *_datafsm.v
110 input only_one_rd_and_can_move; // num_rds == 1 to DOU
111
112 //---------------------------------------------------------------------
113 // talk to bufmgr.v
114 //---------------------------------------------------------------------
115 input ehb_full; // from *_bufmgr.v
116
117 //---------------------------------------------------------------------
118 // talk to rcdbldr.v
119 //---------------------------------------------------------------------
120 output xfrfsm_is_wfh;
121 input has_payld;
122
123 //------------------------------------------------------------------------
124 // special handling
125 //------------------------------------------------------------------------
126 input cib2eil_drain; // drain signal from CIB
127
128 //---------------------------------------------------------------------
129 // debug signals
130 //---------------------------------------------------------------------
131 output [STATE_NUM-1:0] xfr_state;
132
133 //---------------------------------------------------------------------
134 // idle check
135 //---------------------------------------------------------------------
136 output xfrfsm_is_idle;
137
138 // SV 04/06/05 (EHB) Header Parity invert logic
139 input [`FIRE_DLC_ILU_CIB_CSR_ILU_DIAGNOS_EHI_PAR_INT_SLC] ilu_diagnos_ehi_par_hw_read;
140 // This signal provides the current value of ilu_diagnos_ehi_par.
141 output ilu_diagnos_ehi_trig_hw_clr; // Hardware clear signal for
142 // ilu_diagnos_ehi_trig. When set
143 // ilu_diagnos will be set to zero.
144 input ilu_diagnos_ehi_trig_hw_read; // This signal provides the current value
145 // of ilu_diagnos_ehi_trig.
146 input [3:0] d2p_ehb_dpar_0 ;
147 output [3:0] d2p_ehb_dpar ;
148
149 // >>>>>>>>>>>>>>>>>>>>>>>>> Data Type Declarations <<<<<<<<<<<<<<<<<<<<<<<<<
150
151 // ~~~~~~~~~~~~~~~~~~~~~~~~~ REGISTER - FLOPS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
152 reg d2p_ehb_we;
153
154 reg [STATE_NUM-1:0] xfr_state;
155
156 // ~~~~~~~~~~~~~~~~~~~~~~~~~ REGISTER - NON-FLOPS ~~~~~~~~~~~~~~~~~~~~~~~~
157 reg [STATE_NUM-1:0] n_xfr_state;
158
159 reg data_start;
160
161 // ~~~~~~~~~~~~~~~~~~~~~~~~~ NETS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
162
163 // >>>>>>>>>>>>>>>>>>>>>>>>> Zero In Checkers <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
164
165 // 0in one_hot -var xfr_state
166
167 // 0in known_driven -var ehb_full
168
169 /* 0in state -var xfr_state -val (4'b1 << IDLE) -next
170 (4'b1 << IDLE)
171 (4'b1 << DATA)
172 (4'b1 << DEQ)
173 (4'b1 << WFH) */
174
175 /* 0in state -var xfr_state -val (4'b1 << DEQ) -next
176 (4'b1 << IDLE)
177 (4'b1 << DATA)
178 (4'b1 << DEQ)
179 (4'b1 << WFH) */
180
181 /* 0in state -var xfr_state -val (4'b1 << DATA) -next
182 (4'b1 << DATA)
183 (4'b1 << WFH)
184 (4'b1 << DEQ) */
185
186 /* 0in state -var xfr_state -val (4'b1 << WFH) -next
187 (4'b1 << WFH)
188 (4'b1 << DEQ) */
189
190 // >>>>>>>>>>>>>>>>>>>>>>>>> RTL/Behavioral Model <<<<<<<<<<<<<<<<<<<<<<<<<<<
191
192 //---------------------------------------------------------------------
193 // FSM
194 //---------------------------------------------------------------------
195
196 // summit state_vector xfr_state enum xfr_enum
197
198 // present xfr_state
199 always @ (posedge clk)
200 if (!rst_l) begin
201 xfr_state <= {STATE_NUM{1'b0}};
202 xfr_state[IDLE] <= 1'b1;
203 end
204 else
205 xfr_state <= n_xfr_state;
206
207 // next xfr_state logic
208
209 always @ (xfr_state or data_done or ehb_full or
210 rcd_empty or has_payld or only_one_rd_and_can_move)
211 begin
212 n_xfr_state = {STATE_NUM{1'b0}};
213 data_start = 1'b0;
214 case (1'b1) // 0in < case -full // synopsys parallel_case
215 xfr_state[IDLE],
216 xfr_state[DEQ] :
217 casez ({rcd_empty, ehb_full, has_payld, only_one_rd_and_can_move}) // 0in < case -parallel -full
218 4'b1zzz: n_xfr_state[IDLE] = 1'b1;
219
220 4'b010z: n_xfr_state[WFH] = 1'b1;
221
222 4'b000z: n_xfr_state[DEQ] = 1'b1;
223
224 4'b0111:
225 begin
226 n_xfr_state[WFH] = 1'b1;
227 data_start = 1'b1;
228 end
229
230 4'b0011:
231 begin
232 n_xfr_state[DEQ] = 1'b1;
233 data_start = 1'b1;
234 end
235
236 4'b0z10:
237 begin
238 n_xfr_state[DATA] = 1'b1;
239 data_start = 1'b1;
240 end
241 endcase // casez({rcd_empty, ehb_full, has_payld, only_one_rd_and_can_move})
242
243 xfr_state[DATA] :
244 casez ({data_done, ehb_full})
245 2'b10: n_xfr_state[DEQ] = 1'b1;
246 2'b11: n_xfr_state[WFH] = 1'b1;
247 2'b0z: n_xfr_state[DATA] = 1'b1;
248 endcase // casez({data_done, ehb_full})
249
250 xfr_state[WFH] :
251 if (ehb_full) begin
252 n_xfr_state[WFH] = 1'b1;
253 end
254 else n_xfr_state[DEQ] = 1'b1;
255 endcase // case(1'b1)
256 end // always @ (xfr_state or data_done or ehb_full
257
258
259 //---------------------------------------------------------------------
260 // outputs
261 //---------------------------------------------------------------------
262 assign n_d2p_ehb_we = n_xfr_state[DEQ] & (!cib2eil_drain);
263 assign rcd_deq = n_xfr_state[DEQ];
264 assign y2k_rcd_deq = xfr_state[DEQ];
265 assign xfrfsm_is_wfh = xfr_state[WFH];
266
267 always @ (posedge clk)
268 if (!rst_l)
269 d2p_ehb_we <= 1'b0;
270 else
271 d2p_ehb_we <= n_d2p_ehb_we;
272
273 //---------------------------------------------------------------------
274 // idle check output
275 //---------------------------------------------------------------------
276 assign xfrfsm_is_idle = xfr_state[IDLE];
277
278 // SV 04/06/05
279 assign d2p_ehb_dpar = (d2p_ehb_dpar_0 ^ ({4{ilu_diagnos_ehi_trig_hw_read}} & ilu_diagnos_ehi_par_hw_read &
280 {4{d2p_ehb_we}}));
281 assign ilu_diagnos_ehi_trig_hw_clr = ilu_diagnos_ehi_trig_hw_read & d2p_ehb_we ;
282
283
284endmodule // dmu_ilu_eil_xfrfsm
285