Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_pmu_prcd_q.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 | module dmu_pmu_prcd_q ( | |
36 | clk, | |
37 | rst_l, | |
38 | enq, | |
39 | rcd_in, | |
40 | deq, | |
41 | typ, | |
42 | len, | |
43 | byt_cnt, | |
44 | cntxt_num, | |
45 | pkseq_num, | |
46 | addr, | |
47 | addr_err, | |
48 | dptr, | |
49 | sbd_tag, | |
50 | full, | |
51 | overflow, | |
52 | underflow, | |
53 | empty | |
54 | ); | |
55 | ||
56 | //************************************************ | |
57 | // PARAMETERS | |
58 | //************************************************ | |
59 | ||
60 | parameter DEPTH = 4; | |
61 | ||
62 | // Packet Record Field widths | |
63 | ||
64 | parameter SBDTAG_WDTH = `FIRE_DLC_IPR_SBDTAG_WDTH, // 5 | |
65 | DPTR_WDTH = `FIRE_DLC_IPR_DPTR_WDTH, // 7 | |
66 | // ADDRERR_WDTH = `FIRE_DLC_IPR_ADDRERR_WDTH, // 1 | |
67 | ADDR_WDTH = `FIRE_DLC_IPR_ADDR_WDTH, //41 | |
68 | PKSEQNUM_WDTH = `FIRE_DLC_IPR_PKSEQNUM_WDTH, // 5 | |
69 | CNTXTNUM_WDTH = `FIRE_DLC_IPR_CNTXTNUM_WDTH, // 5 | |
70 | BYTCNT_WDTH = `FIRE_DLC_IPR_BYTCNT_WDTH, //12 | |
71 | LEN_WDTH = `FIRE_DLC_IPR_LEN_WDTH, //10 | |
72 | TYP_WDTH = `FIRE_DLC_IPR_TYP_WDTH; // 7 | |
73 | ||
74 | parameter SBDTAGMSB = SBDTAG_WDTH -1, | |
75 | DPTRMSB = DPTR_WDTH -1, | |
76 | ADDRMSB = ADDR_WDTH -1, | |
77 | PKSEQNUMMSB = PKSEQNUM_WDTH -1, | |
78 | CNTXTNUMMSB = CNTXTNUM_WDTH -1, | |
79 | BYTCNTMSB = BYTCNT_WDTH -1, | |
80 | LENMSB = LEN_WDTH -1, | |
81 | TYPMSB = TYP_WDTH -1; | |
82 | ||
83 | parameter SBDTAG_LSB = 0, | |
84 | SBDTAG_MSB = `FIRE_DLC_IPR_SBDTAG_MSB, | |
85 | DPTR_LSB = `FIRE_DLC_IPR_DPTR_LSB, | |
86 | DPTR_MSB = `FIRE_DLC_IPR_DPTR_MSB, | |
87 | ADDRERR_MSB = `FIRE_DLC_IPR_ADDRERR_MSB, | |
88 | ADDR_LSB = `FIRE_DLC_IPR_ADDR_LSB, | |
89 | ADDR_MSB = `FIRE_DLC_IPR_ADDR_MSB, | |
90 | PKSEQNUM_LSB = `FIRE_DLC_IPR_PKSEQNUM_LSB, | |
91 | PKSEQNUM_MSB = `FIRE_DLC_IPR_PKSEQNUM_MSB, | |
92 | CNTXTNUM_LSB = `FIRE_DLC_IPR_CNTXTNUM_LSB, | |
93 | CNTXTNUM_MSB = `FIRE_DLC_IPR_CNTXTNUM_MSB, | |
94 | BYTCNT_LSB = `FIRE_DLC_IPR_BYTCNT_LSB, | |
95 | BYTCNT_MSB = `FIRE_DLC_IPR_BYTCNT_MSB, | |
96 | LEN_LSB = `FIRE_DLC_IPR_LEN_LSB, | |
97 | LEN_MSB = `FIRE_DLC_IPR_LEN_MSB, | |
98 | TYP_LSB = `FIRE_DLC_IPR_TYP_LSB, | |
99 | TYP_MSB = `FIRE_DLC_IPR_TYP_MSB; | |
100 | ||
101 | // parameter CM2PM_WDTH = `FIRE_DLC_IPR_REC_WDTH; //93 | |
102 | ||
103 | parameter IPRMSB = `FIRE_DLC_IPR_MSB; // CM2PM_WDTH -1; | |
104 | ||
105 | ||
106 | //************************************************ | |
107 | // PORTS | |
108 | //************************************************ | |
109 | ||
110 | input clk; // The input clock | |
111 | input rst_l; // fifo reset | |
112 | ||
113 | input [IPRMSB :0] rcd_in; // packet record in | |
114 | input enq; // enqueue to prcd_q | |
115 | input deq; // local dequeue for packet fifo | |
116 | ||
117 | output [TYPMSB : 0] typ; | |
118 | output [LENMSB : 0] len; | |
119 | output [BYTCNTMSB : 0] byt_cnt; | |
120 | output [CNTXTNUMMSB : 0] cntxt_num; | |
121 | output [PKSEQNUMMSB : 0] pkseq_num; | |
122 | output [ADDRMSB : 0] addr; | |
123 | output addr_err; | |
124 | output [DPTRMSB : 0] dptr; | |
125 | output [SBDTAGMSB : 0] sbd_tag; | |
126 | ||
127 | output full; // prcd_q is full | |
128 | output overflow; // prcd_q overflow | |
129 | output underflow; // prcd_q underflow | |
130 | output empty; // fifo empty exported | |
131 | ||
132 | //************************************************ | |
133 | // SIGNALS | |
134 | //************************************************ | |
135 | ||
136 | wire clk; | |
137 | wire rst_l; | |
138 | wire typ_full; | |
139 | ||
140 | // wire len_full, // left in comments for later use if needed | |
141 | // bytcnt_full, | |
142 | // cntxtnum_full, | |
143 | // pkseqnum_full, | |
144 | // addr_full, | |
145 | // dptr_full, | |
146 | // sbdtag_full; | |
147 | ||
148 | wire typ_empty, typ_overflow, typ_underflow; | |
149 | wire len_empty, len_overflow, len_underflow; | |
150 | wire bytcnt_empty, bytcnt_overflow, bytcnt_underflow; | |
151 | wire cntxtnum_empty, cntxtnum_overflow, cntxtnum_underflow; | |
152 | wire pkseqnum_empty, pkseqnum_overflow, pkseqnum_underflow; | |
153 | wire addr_empty, addr_overflow, addr_underflow; | |
154 | wire dptr_empty, dptr_overflow, dptr_underflow; | |
155 | wire sbdtag_empty, sbdtag_overflow, sbdtag_underflow; | |
156 | ||
157 | wire [TYPMSB : 0] rcd_typ; | |
158 | wire [LENMSB : 0] rcd_len; | |
159 | wire [BYTCNTMSB : 0] rcd_bytcnt; | |
160 | wire [CNTXTNUMMSB : 0] rcd_cntxtnum; | |
161 | wire [PKSEQNUMMSB : 0] rcd_pkseqnum; | |
162 | wire [ADDRMSB : 0] rcd_addr; | |
163 | wire rcd_addrerr; | |
164 | wire [DPTRMSB : 0] rcd_dptr; | |
165 | wire [SBDTAGMSB : 0] rcd_sbdtag; | |
166 | ||
167 | //************************************************ | |
168 | // Zero In checkers | |
169 | //************************************************ | |
170 | ||
171 | ||
172 | ||
173 | ||
174 | // Packet Record field assignments to PRM signals | |
175 | assign rcd_typ[TYPMSB : 0] = rcd_in[TYP_MSB : TYP_LSB ]; | |
176 | assign rcd_len[LENMSB : 0] = rcd_in[LEN_MSB : LEN_LSB]; | |
177 | assign rcd_bytcnt[BYTCNTMSB : 0] = rcd_in[BYTCNT_MSB : BYTCNT_LSB]; | |
178 | assign rcd_cntxtnum[CNTXTNUMMSB : 0] = rcd_in[CNTXTNUM_MSB : CNTXTNUM_LSB]; | |
179 | assign rcd_pkseqnum[PKSEQNUMMSB : 0] = rcd_in[PKSEQNUM_MSB : PKSEQNUM_LSB]; | |
180 | assign rcd_addr[ADDRMSB : 0] = rcd_in[ADDR_MSB : ADDR_LSB]; | |
181 | assign rcd_addrerr = rcd_in[ADDRERR_MSB]; | |
182 | assign rcd_dptr[DPTRMSB : 0] = rcd_in[DPTR_MSB : DPTR_LSB]; | |
183 | assign rcd_sbdtag[SBDTAGMSB : 0] = rcd_in[SBDTAG_MSB : SBDTAG_LSB]; | |
184 | ||
185 | //************************************************ | |
186 | // Modules | |
187 | //************************************************ | |
188 | ||
189 | fire_dmc_common_srfifo #(TYP_WDTH, DEPTH) typ_srfifo ( | |
190 | .clk (clk), | |
191 | .rst_l (rst_l), | |
192 | .enq (enq), | |
193 | .data_in (rcd_typ), | |
194 | .deq (deq), | |
195 | .data_out (typ), | |
196 | .full (typ_full), | |
197 | .empty (typ_empty), | |
198 | .overflow(typ_overflow), | |
199 | .underflow(typ_underflow) | |
200 | ); | |
201 | ||
202 | fire_dmc_common_srfifo #(LEN_WDTH, DEPTH) len_srfifo ( | |
203 | .clk (clk), | |
204 | .rst_l (rst_l), | |
205 | .enq (enq), | |
206 | .data_in (rcd_len), | |
207 | .deq (deq), | |
208 | .data_out (len), | |
209 | .full (), // left as null port for later use if needed | |
210 | .empty (len_empty), | |
211 | .overflow(len_overflow), | |
212 | .underflow(len_underflow) | |
213 | ); | |
214 | ||
215 | fire_dmc_common_srfifo #(BYTCNT_WDTH, DEPTH) bytcnt_srfifo ( | |
216 | .clk (clk), | |
217 | .rst_l (rst_l), | |
218 | .enq (enq), | |
219 | .data_in (rcd_bytcnt), | |
220 | .deq (deq), | |
221 | .data_out (byt_cnt), | |
222 | .full (), // left as null port for later use if needed | |
223 | .empty (bytcnt_empty), | |
224 | .overflow(bytcnt_overflow), | |
225 | .underflow(bytcnt_underflow) | |
226 | ); | |
227 | ||
228 | fire_dmc_common_srfifo #(CNTXTNUM_WDTH, DEPTH) cntxtnum_srfifo ( | |
229 | .clk (clk), | |
230 | .rst_l (rst_l), | |
231 | .enq (enq), | |
232 | .data_in (rcd_cntxtnum), | |
233 | .deq (deq), | |
234 | .data_out (cntxt_num), | |
235 | .full (), // left as null port for later use if needed | |
236 | .empty (cntxtnum_empty), | |
237 | .overflow(cntxtnum_overflow), | |
238 | .underflow(cntxtnum_underflow) | |
239 | ); | |
240 | ||
241 | fire_dmc_common_srfifo #(PKSEQNUM_WDTH, DEPTH) pkseqnum_srfifo ( | |
242 | .clk (clk), | |
243 | .rst_l (rst_l), | |
244 | .enq (enq), | |
245 | .data_in (rcd_pkseqnum), | |
246 | .deq (deq), | |
247 | .data_out (pkseq_num), | |
248 | .full (), // left as null port for later use if needed | |
249 | .empty (pkseqnum_empty), | |
250 | .overflow(pkseqnum_overflow), | |
251 | .underflow(pkseqnum_underflow) | |
252 | ); | |
253 | ||
254 | // address, address err in same fifo | |
255 | fire_dmc_common_srfifo #(ADDR_WDTH +1, DEPTH) addr_srfifo ( | |
256 | .clk (clk), | |
257 | .rst_l (rst_l), | |
258 | .enq (enq), | |
259 | .data_in ({rcd_addr, rcd_addrerr}), | |
260 | .deq (deq), | |
261 | .data_out ({addr, addr_err}), | |
262 | .full (), // left as null port for later use if needed | |
263 | .empty (addr_empty), | |
264 | .overflow(addr_overflow), | |
265 | .underflow(addr_underflow) | |
266 | ); | |
267 | ||
268 | fire_dmc_common_srfifo #(DPTR_WDTH, DEPTH) dptr_srfifo ( | |
269 | .clk (clk), | |
270 | .rst_l (rst_l), | |
271 | .enq (enq), | |
272 | .data_in (rcd_dptr), | |
273 | .deq (deq), | |
274 | .data_out (dptr), | |
275 | .full (), // left as null port for later use if needed | |
276 | .empty (dptr_empty), | |
277 | .overflow(dptr_overflow), | |
278 | .underflow(dptr_underflow) | |
279 | ); | |
280 | ||
281 | fire_dmc_common_srfifo #(SBDTAG_WDTH, DEPTH) sbdtag_srfifo ( | |
282 | .clk (clk), | |
283 | .rst_l (rst_l), | |
284 | .enq (enq), | |
285 | .data_in (rcd_sbdtag), | |
286 | .deq (deq), | |
287 | .data_out (sbd_tag), | |
288 | .full (), // left as null port for later use if needed | |
289 | .empty (sbdtag_empty), | |
290 | .overflow(sbdtag_overflow), | |
291 | .underflow(sbdtag_underflow) | |
292 | ); | |
293 | ||
294 | // commented out for later use if needed | |
295 | //assign full = (typ_full | len_full | bytcnt_full | cntxtnum_full | | |
296 | // pkseqnum_full | addr_full | dptr_full | sbdtag_full); | |
297 | ||
298 | assign full = typ_full; // since all fifos are in lock step, single registered | |
299 | // fifo full can be exported | |
300 | ||
301 | assign overflow = (typ_overflow | len_overflow | bytcnt_overflow | | |
302 | cntxtnum_overflow | pkseqnum_overflow | addr_overflow | | |
303 | dptr_overflow | sbdtag_overflow); | |
304 | ||
305 | assign underflow = (typ_underflow | len_underflow | bytcnt_underflow | | |
306 | cntxtnum_underflow | pkseqnum_underflow | addr_underflow | | |
307 | dptr_underflow | sbdtag_underflow); | |
308 | ||
309 | assign empty = (typ_empty & len_empty & bytcnt_empty & cntxtnum_empty & | |
310 | pkseqnum_empty & addr_empty & dptr_empty & sbdtag_empty); | |
311 | ||
312 | endmodule |