Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / design / sys / iop / dmu / rtl / dmu_cmu_tcm_pkrcd_q.v
CommitLineData
86530b38
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: dmu_cmu_tcm_pkrcd_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 ============================================
35module dmu_cmu_tcm_pkrcd_q (
36 clk,
37 rst_l,
38 enq,
39 rcd_in,
40 deq,
41 typ,
42 len,
43 dwbe,
44 addr,
45 sbd_tag,
46 dptr,
47 cntxt_num,
48 pkseq_num,
49 full,
50 empty,
51 overflow,
52 underflow
53 );
54
55//************************************************
56// PARAMETERS
57//************************************************
58
59 parameter DEPTH = 4;
60
61// Packet Record Field widths
62 parameter PRTYP_WDTH = `FIRE_DLC_EPR_TYP_WDTH, // 7
63 PRLEN_WDTH = `FIRE_DLC_EPR_LEN_WDTH, //10
64 PRDWBE_WDTH = `FIRE_DLC_EPR_DWBE_WDTH, // 8
65 PRADDR_WDTH = `FIRE_DLC_EPR_ADDR_WDTH, //34
66 PRSBDTAG_WDTH = `FIRE_DLC_EPR_SBDTAG_WDTH, // 5
67 PRDPTR_WDTH = `FIRE_DLC_EPR_DPTR_WDTH, // 6
68 PRSEQNUM_WDTH = `FIRE_DLC_EPR_PKSEQNUM_WDTH, // 5
69 PRCNTXTNUM_WDTH = `FIRE_DLC_EPR_CNTXTNUM_WDTH; // 5
70
71 parameter PRCNTXTNUMLSB = `FIRE_DLC_EPR_CNTXTNUM_LSB,
72 PRCNTXTNUMMSB = `FIRE_DLC_EPR_CNTXTNUM_MSB,
73 PRSEQNUMLSB = `FIRE_DLC_EPR_PKSEQNUM_LSB,
74 PRSEQNUMMSB = `FIRE_DLC_EPR_PKSEQNUM_MSB,
75 PRDPTRLSB = `FIRE_DLC_EPR_DPTR_LSB,
76 PRDPTRMSB = `FIRE_DLC_EPR_DPTR_MSB,
77 PRSBDTAGLSB = `FIRE_DLC_EPR_SBDTAG_LSB,
78 PRSBDTAGMSB = `FIRE_DLC_EPR_SBDTAG_MSB,
79 PRADDRLSB = `FIRE_DLC_EPR_ADDR_LSB,
80 PRADDRMSB = `FIRE_DLC_EPR_ADDR_MSB,
81 PRDWBELSB = `FIRE_DLC_EPR_DWBE_LSB,
82 PRDWBEMSB = `FIRE_DLC_EPR_DWBE_MSB,
83 PRLENLSB = `FIRE_DLC_EPR_LEN_LSB,
84 PRLENMSB = `FIRE_DLC_EPR_LEN_MSB,
85 PRTYPLSB = `FIRE_DLC_EPR_TYP_LSB,
86 PRTYPMSB = `FIRE_DLC_EPR_TYP_MSB;
87
88
89// parameter CL2CM_WDTH = `FIRE_DLC_EPR_REC_WDTH; //80
90
91 parameter EPRMSB = `FIRE_DLC_EPR_MSB; // CL2CM_WDTH -1;
92
93
94//************************************************
95// PORTS
96//************************************************
97
98 input clk; // The input clock
99 input rst_l; // The fifo rst_l
100
101 input [EPRMSB :0] rcd_in; // Egress packet record in
102 input enq; // enqueue to prcd_q
103 input deq; // local dequeue for packet fifo
104
105 output [PRTYP_WDTH -1 : 0] typ;
106 output [PRLEN_WDTH -1 : 0] len;
107 output [PRDWBE_WDTH -1 : 0] dwbe;
108 output [PRADDR_WDTH -1 : 0] addr;
109 output [PRSBDTAG_WDTH -1 : 0] sbd_tag;
110 output [PRDPTR_WDTH -1 : 0] dptr;
111 output [PRCNTXTNUM_WDTH -1 : 0] cntxt_num;
112 output [PRSEQNUM_WDTH -1 : 0] pkseq_num;
113
114 output full; // prcd_q is full
115 output overflow; // prcd_q overflow
116 output underflow; // prcd_q underflow
117 output empty; // fifo empty exported
118
119//************************************************
120// SIGNALS
121//************************************************
122
123 wire clk;
124 wire rst_l;
125
126 wire typ_full, typ_empty, typ_overflow, typ_underflow;
127 wire len_empty, len_overflow, len_underflow;
128 wire dwbe_empty, dwbe_overflow, dwbe_underflow;
129 wire addr_empty, addr_overflow, addr_underflow;
130 wire sbdtag_empty, sbdtag_overflow, sbdtag_underflow;
131 wire dptr_empty, dptr_overflow, dptr_underflow;
132 wire pkseqnum_empty, pkseqnum_overflow, pkseqnum_underflow;
133 wire cntxtnum_empty, cntxtnum_overflow, cntxtnum_underflow;
134
135 wire [PRTYP_WDTH -1 : 0] rcd_typ;
136 wire [PRLEN_WDTH -1 : 0] rcd_len;
137 wire [PRDWBE_WDTH -1 : 0] rcd_dwbe;
138 wire [PRADDR_WDTH -1 : 0] rcd_addr;
139 wire [PRSBDTAG_WDTH -1 : 0] rcd_sbdtag;
140 wire [PRDPTR_WDTH -1 : 0] rcd_dptr;
141 wire [PRSEQNUM_WDTH -1 : 0] rcd_pkseqnum;
142 wire [PRCNTXTNUM_WDTH -1 : 0] rcd_cntxtnum;
143
144
145
146// Packet Record field assignments to PRM signals
147 assign rcd_typ[PRTYP_WDTH -1 : 0] = rcd_in[PRTYPMSB : PRTYPLSB ];
148 assign rcd_len[PRLEN_WDTH -1 : 0] = rcd_in[PRLENMSB : PRLENLSB];
149 assign rcd_dwbe[PRDWBE_WDTH -1 : 0] = rcd_in[PRDWBEMSB : PRDWBELSB];
150 assign rcd_addr[PRADDR_WDTH -1 : 0] = rcd_in[PRADDRMSB : PRADDRLSB];
151 assign rcd_sbdtag[PRSBDTAG_WDTH -1 : 0] = rcd_in[PRSBDTAGMSB : PRSBDTAGLSB];
152 assign rcd_dptr[PRDPTR_WDTH -1 : 0] = rcd_in[PRDPTRMSB : PRDPTRLSB];
153 assign rcd_pkseqnum[PRSEQNUM_WDTH -1 : 0] = rcd_in[PRSEQNUMMSB : PRSEQNUMLSB];
154 assign rcd_cntxtnum[PRCNTXTNUM_WDTH -1 : 0] = rcd_in[PRCNTXTNUMMSB : PRCNTXTNUMLSB];
155
156//************************************************
157// Modules
158//************************************************
159
160fire_dmc_common_srfifo #(PRTYP_WDTH, DEPTH) typ_srfifo (
161 .clk (clk),
162 .rst_l (rst_l),
163 .enq (enq),
164 .data_in (rcd_typ),
165 .deq (deq),
166 .data_out (typ),
167 .full (typ_full),
168 .empty (typ_empty),
169 .overflow(typ_overflow),
170 .underflow(typ_underflow)
171 );
172
173fire_dmc_common_srfifo #(PRLEN_WDTH, DEPTH) len_srfifo (
174 .clk (clk),
175 .rst_l (rst_l),
176 .enq (enq),
177 .data_in (rcd_len),
178 .deq (deq),
179 .data_out (len),
180 .full (),
181 .empty (len_empty),
182 .overflow(len_overflow),
183 .underflow(len_underflow)
184 );
185
186fire_dmc_common_srfifo #(PRDWBE_WDTH, DEPTH) dwbe_srfifo (
187 .clk (clk),
188 .rst_l (rst_l),
189 .enq (enq),
190 .data_in (rcd_dwbe),
191 .deq (deq),
192 .data_out (dwbe),
193 .full (),
194 .empty (dwbe_empty),
195 .overflow(dwbe_overflow),
196 .underflow(dwbe_underflow)
197 );
198
199fire_dmc_common_srfifo #(PRADDR_WDTH, DEPTH) addr_srfifo (
200 .clk (clk),
201 .rst_l (rst_l),
202 .enq (enq),
203 .data_in (rcd_addr),
204 .deq (deq),
205 .data_out (addr),
206 .full (),
207 .empty (addr_empty),
208 .overflow(addr_overflow),
209 .underflow(addr_underflow)
210 );
211
212fire_dmc_common_srfifo #(PRSBDTAG_WDTH, DEPTH) sbdtag_srfifo (
213 .clk (clk),
214 .rst_l (rst_l),
215 .enq (enq),
216 .data_in (rcd_sbdtag),
217 .deq (deq),
218 .data_out (sbd_tag),
219 .full (),
220 .empty (sbdtag_empty),
221 .overflow(sbdtag_overflow),
222 .underflow(sbdtag_underflow)
223 );
224
225fire_dmc_common_srfifo #(PRDPTR_WDTH, DEPTH) dptr_srfifo (
226 .clk (clk),
227 .rst_l (rst_l),
228 .enq (enq),
229 .data_in (rcd_dptr),
230 .deq (deq),
231 .data_out (dptr),
232 .full (),
233 .empty (dptr_empty),
234 .overflow(dptr_overflow),
235 .underflow(dptr_underflow)
236 );
237
238fire_dmc_common_srfifo #(PRSEQNUM_WDTH, DEPTH) pkseqnum_srfifo (
239 .clk (clk),
240 .rst_l (rst_l),
241 .enq (enq),
242 .data_in (rcd_pkseqnum),
243 .deq (deq),
244 .data_out (pkseq_num),
245 .full (),
246 .empty (pkseqnum_empty),
247 .overflow(pkseqnum_overflow),
248 .underflow(pkseqnum_underflow)
249 );
250
251fire_dmc_common_srfifo #(PRCNTXTNUM_WDTH, DEPTH) cntxtnum_srfifo (
252 .clk (clk),
253 .rst_l (rst_l),
254 .enq (enq),
255 .data_in (rcd_cntxtnum),
256 .deq (deq),
257 .data_out (cntxt_num),
258 .full (),
259 .empty (cntxtnum_empty),
260 .overflow(cntxtnum_overflow),
261 .underflow(cntxtnum_underflow)
262 );
263
264//assign full = (typ_full | len_full | dwbe_full | cntxtnum_full |
265// pkseqnum_full | addr_full | dptr_full | sbdtag_full);
266
267assign full = typ_full; // since all fifos are in lock step, single fifo full
268 // can be exported
269
270assign overflow = (typ_overflow | len_overflow | dwbe_overflow |
271 cntxtnum_overflow | pkseqnum_overflow | addr_overflow |
272 dptr_overflow | sbdtag_overflow);
273
274assign underflow = (typ_underflow | len_underflow | dwbe_underflow |
275 cntxtnum_underflow | pkseqnum_underflow | addr_underflow |
276 dptr_underflow | sbdtag_underflow);
277
278assign empty = (typ_empty & len_empty & dwbe_empty & cntxtnum_empty &
279 pkseqnum_empty & addr_empty & dptr_empty & sbdtag_empty);
280
281endmodule
282