Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | // ========== Copyright Header Begin ========================================== |
2 | // | |
3 | // OpenSPARC T2 Processor File: dmu_psb_pdl.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_psb_pdl | |
36 | ( | |
37 | ||
38 | // Control Signals | |
39 | clk, | |
40 | rst_l, | |
41 | ||
42 | // Input from PIC Controller to PDL | |
43 | pic2pdl_dma_wr_in, | |
44 | pic2pdl_pktag_in, | |
45 | pic2pdl_type_in, | |
46 | pic2pdl_dma_wr_data_in, | |
47 | pic2pdl_req_in, | |
48 | ||
49 | // Output from PDL to PIC Controller | |
50 | pdl2pic_pio_rd_data_out, | |
51 | ||
52 | // Input from PCE Controller to PDL | |
53 | pce2pdl_pio_wr_in, | |
54 | ||
55 | pce2pdl_pktag_in, | |
56 | pce2pdl_type_in, | |
57 | pce2pdl_pio_wr_data_in, | |
58 | pce2pdl_req_in, | |
59 | ||
60 | // Output from PDL to PCE Controller | |
61 | pdl2pce_dma_rd_data_out, | |
62 | ||
63 | // CSR interface | |
64 | ext_addr, | |
65 | psb_dma_ext_done, | |
66 | psb_pio_ext_done, | |
67 | psb_dma_ext_select, | |
68 | psb_dma_ext_rd_data, | |
69 | psb_pio_ext_select, | |
70 | psb_pio_ext_rd_data, | |
71 | ||
72 | // Debug Ports | |
73 | pdl2dbg_dbg_a, | |
74 | pdl2dbg_dbg_b, | |
75 | dbg2pdl_dbg_sel_a, | |
76 | dbg2pdl_dbg_sel_b | |
77 | ||
78 | ); | |
79 | ||
80 | // synopsys sync_set_reset "rst_l" | |
81 | ||
82 | ////////////////////////////////////////////////////////////////////// | |
83 | //************************* Parameters ************************* | |
84 | ////////////////////////////////////////////////////////////////////// | |
85 | ||
86 | parameter DMA_DEPTH = 32; // 32 | |
87 | parameter PIO_DEPTH = 16; // 16 | |
88 | ||
89 | ////////////////////////////////////////////////////////////////////// | |
90 | //************************* Port Declarations ******************* | |
91 | ////////////////////////////////////////////////////////////////////// | |
92 | ||
93 | // Control signals | |
94 | ||
95 | input clk; | |
96 | input rst_l; | |
97 | ||
98 | // PIC to PDL Interface | |
99 | input pic2pdl_dma_wr_in; | |
100 | input [`FIRE_DLC_PSR_TRN_WDTH-1:0] pic2pdl_pktag_in; | |
101 | input pic2pdl_type_in; | |
102 | input [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] pic2pdl_dma_wr_data_in; | |
103 | input pic2pdl_req_in; | |
104 | ||
105 | // PDL to PIC Interface | |
106 | output [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] pdl2pic_pio_rd_data_out; | |
107 | ||
108 | // PCE to PDL Interface | |
109 | input pce2pdl_pio_wr_in; | |
110 | input [`FIRE_DLC_PSR_TRN_WDTH-1:0] pce2pdl_pktag_in; | |
111 | input pce2pdl_type_in; | |
112 | input [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] pce2pdl_pio_wr_data_in; | |
113 | input pce2pdl_req_in; | |
114 | ||
115 | // PDL to PCE Interface | |
116 | output [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] pdl2pce_dma_rd_data_out; | |
117 | ||
118 | // CSR Interface | |
119 | input [`FIRE_DLC_PSR_TRN_WDTH-1:0] ext_addr; | |
120 | input psb_dma_ext_select; | |
121 | input psb_pio_ext_select; | |
122 | ||
123 | output psb_dma_ext_done; | |
124 | output psb_pio_ext_done; | |
125 | output [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] psb_dma_ext_rd_data; // SAME AS pdl2pce_rd_data_out | |
126 | output [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] psb_pio_ext_rd_data; // SAME AS pdl2pic_rd_data_out | |
127 | ||
128 | // Debug Ports | |
129 | ||
130 | output [`FIRE_DBG_DATA_BITS] pdl2dbg_dbg_a; | |
131 | output [`FIRE_DBG_DATA_BITS] pdl2dbg_dbg_b; | |
132 | ||
133 | input [2:0] dbg2pdl_dbg_sel_a; | |
134 | input [2:0] dbg2pdl_dbg_sel_b; | |
135 | ||
136 | ||
137 | ////////////////////////////////////////////////////////////////////// | |
138 | //*********************** Wires and Regs ************************ | |
139 | ////////////////////////////////////////////////////////////////////// | |
140 | ||
141 | wire pic2pdl_dma_wr_in; | |
142 | wire [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] pic2pdl_dma_wr_data_in; | |
143 | wire [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] pdl2pic_pio_rd_data_out; | |
144 | ||
145 | ||
146 | wire pce2pdl_pio_wr_in; | |
147 | wire [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] pce2pdl_pio_wr_data_in; | |
148 | wire [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] pdl2pce_dma_rd_data_out; | |
149 | ||
150 | wire req_in; | |
151 | reg [DMA_DEPTH-1:0] pktag1_dcd; // decoded pktag1 5 bit to 32 bit | |
152 | reg [PIO_DEPTH-1:0] pktag2_dcd; // decoded pktag2 4 bit to 16 bit | |
153 | ||
154 | wire [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] psb_pio_ext_rd_data; | |
155 | wire [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] psb_dma_ext_rd_data; | |
156 | ||
157 | reg psb_dma_ext_done; | |
158 | reg psb_pio_ext_done; | |
159 | ||
160 | reg [`FIRE_DLC_PSR_TRN_WDTH-2:0] pio_addr; | |
161 | reg [`FIRE_DLC_PSR_TRN_WDTH-1:0] dma_addr; | |
162 | ||
163 | ||
164 | wire [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] dma_wr_data_in; | |
165 | wire [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] pio_wr_data_in; | |
166 | ||
167 | ||
168 | wire [DMA_DEPTH-1:0] pic_dma_wr_data_ld; | |
169 | wire [PIO_DEPTH-1:0] pce_pio_wr_data_ld; | |
170 | integer i, j, k, m; | |
171 | ||
172 | //----------------- FLOPS ----------------------------- | |
173 | ||
174 | // memory array's | |
175 | // memory with 32 - 46 bit entries | |
176 | reg [`FIRE_DLC_PSR_DMA_DATA_WDTH-1:0] dma_data[0:DMA_DEPTH-1]; | |
177 | ||
178 | // memory with 16 - 6 bit entries | |
179 | reg [`FIRE_DLC_PSR_PIO_DATA_WDTH-1:0] pio_data[0:PIO_DEPTH-1]; | |
180 | ||
181 | // debug | |
182 | reg [2:0] dbg_sel [0:1]; | |
183 | reg [`FIRE_DBG_DATA_BITS] dbg_bus [0:1]; | |
184 | reg [`FIRE_DBG_DATA_BITS] nxt_dbg_bus [0:1]; | |
185 | ||
186 | // debug wires | |
187 | wire [`FIRE_DBG_DATA_BITS] pdl2dbg_dbg_a; // PDL debug output a | |
188 | wire [`FIRE_DBG_DATA_BITS] pdl2dbg_dbg_b; // PDL debug output b | |
189 | wire [2:0] dbg2pdl_dbg_sel_a; // PDL debug select a | |
190 | wire [2:0] dbg2pdl_dbg_sel_b; // PDL debug select b | |
191 | ||
192 | ////////////////////////////////////////////////////////////////////// | |
193 | // ******** Zero-in checkers************************************ | |
194 | ////////////////////////////////////////////////////////////////////// | |
195 | ||
196 | ||
197 | // 0in decoder -in pic2pdl_pktag_in -out pktag1_dcd | |
198 | // 0in decoder -in pce2pdl_pktag_in[3:0] -out pktag2_dcd | |
199 | ||
200 | // 0in bits_on -var pic_dma_wr_data_ld -max 1 | |
201 | // 0in bits_on -var pce_pio_wr_data_ld -max 1 | |
202 | ||
203 | ||
204 | ////////////////////////////////////////////////////////////////////// | |
205 | // ******** Combinational Logic ************************************ | |
206 | ////////////////////////////////////////////////////////////////////// | |
207 | ||
208 | // debug | |
209 | ||
210 | always @ (dbg2pdl_dbg_sel_a or dbg2pdl_dbg_sel_b) | |
211 | begin | |
212 | dbg_sel[0] = dbg2pdl_dbg_sel_a; | |
213 | dbg_sel[1] = dbg2pdl_dbg_sel_b; | |
214 | end | |
215 | ||
216 | always @ (dbg_sel[0] or dbg_sel[1] or pic2pdl_req_in or pic2pdl_type_in or pic2pdl_dma_wr_in or pic2pdl_pktag_in | |
217 | or pce2pdl_req_in or pce2pdl_type_in or pce2pdl_pktag_in or pce2pdl_pio_wr_in | |
218 | or psb_dma_ext_select or psb_pio_ext_select or ext_addr or psb_dma_ext_done or psb_pio_ext_done) | |
219 | begin | |
220 | for (i = 0; i < 2; i = i + 1) | |
221 | begin | |
222 | case (dbg_sel[i]) // synopsys parallel_case infer_mux | |
223 | 3'b000: nxt_dbg_bus[i] = {pic2pdl_dma_wr_in, pic2pdl_req_in, pic2pdl_type_in, pic2pdl_pktag_in}; | |
224 | 3'b001: nxt_dbg_bus[i] = {pce2pdl_pio_wr_in, pce2pdl_req_in, pce2pdl_type_in, pce2pdl_pktag_in}; | |
225 | 3'b010: nxt_dbg_bus[i] = {1'b0, psb_dma_ext_select, psb_dma_ext_done, ext_addr}; | |
226 | 3'b011: nxt_dbg_bus[i] = {1'b0, psb_pio_ext_select, psb_pio_ext_done, ext_addr}; | |
227 | 3'b100: nxt_dbg_bus[i] = 8'b0; | |
228 | 3'b101: nxt_dbg_bus[i] = 8'b0; | |
229 | 3'b110: nxt_dbg_bus[i] = 8'b0; | |
230 | 3'b111: nxt_dbg_bus[i] = 8'b0; | |
231 | endcase | |
232 | end | |
233 | end | |
234 | ||
235 | assign pdl2dbg_dbg_a = dbg_bus[0]; | |
236 | assign pdl2dbg_dbg_b = dbg_bus[1]; | |
237 | ||
238 | // end debug | |
239 | ||
240 | //-------------------------------------------------------------------- | |
241 | // pktag1 and pktag2 decode | |
242 | //-------------------------------------------------------------------- | |
243 | ||
244 | // returns a binary 32 bit vector with 1 bit set | |
245 | // decode pktag from PIC controller (type_in pio = 1 , dma = 0) | |
246 | ||
247 | always @(pic2pdl_pktag_in) | |
248 | begin | |
249 | pktag1_dcd = {DMA_DEPTH{1'b0}}; | |
250 | pktag1_dcd[pic2pdl_pktag_in] = 1'b1; | |
251 | end | |
252 | ||
253 | // returns a binary 16 bit vector with 1 bit set | |
254 | // decode pktag from PCE controller (type_in pio = 1 , dma = 0) | |
255 | ||
256 | always @(pce2pdl_pktag_in) | |
257 | begin | |
258 | pktag2_dcd = {PIO_DEPTH{1'b0}}; | |
259 | pktag2_dcd[pce2pdl_pktag_in[3:0]] = 1'b1; | |
260 | end | |
261 | ||
262 | //-------------------------------------------------------------------- | |
263 | // Scoreboard Controller read from pdl | |
264 | //-------------------------------------------------------------------- | |
265 | ||
266 | assign pdl2pic_pio_rd_data_out = pio_data[pio_addr]; | |
267 | assign pdl2pce_dma_rd_data_out = dma_data[dma_addr]; | |
268 | ||
269 | ||
270 | assign psb_pio_ext_rd_data = pdl2pic_pio_rd_data_out; | |
271 | assign psb_dma_ext_rd_data = pdl2pce_dma_rd_data_out; | |
272 | ||
273 | assign req_in = pic2pdl_req_in | pce2pdl_req_in; | |
274 | // dcm read from pdl | |
275 | ||
276 | always @ (req_in or psb_pio_ext_select or ext_addr or pic2pdl_pktag_in or psb_dma_ext_select or pce2pdl_pktag_in ) | |
277 | if (!req_in && psb_pio_ext_select) | |
278 | begin | |
279 | pio_addr = ext_addr[3:0]; | |
280 | dma_addr = pce2pdl_pktag_in; | |
281 | psb_pio_ext_done = 1'b1; | |
282 | psb_dma_ext_done = 1'b0; | |
283 | end | |
284 | else if (!req_in && psb_dma_ext_select) | |
285 | begin | |
286 | dma_addr = ext_addr; | |
287 | pio_addr = pic2pdl_pktag_in[3:0]; | |
288 | psb_dma_ext_done = 1'b1; | |
289 | psb_pio_ext_done = 1'b0; | |
290 | end | |
291 | else | |
292 | begin | |
293 | dma_addr = pce2pdl_pktag_in; | |
294 | pio_addr = pic2pdl_pktag_in[3:0]; | |
295 | psb_pio_ext_done = 1'b0; | |
296 | psb_dma_ext_done = 1'b0; | |
297 | end | |
298 | ||
299 | // Register array load is determined by the wr_data_load for the individual | |
300 | // address row. This value is generated from a decode of the packet tag | |
301 | // input and the wr_data input for each agent wanting to perform a write. | |
302 | ||
303 | // load logic to determine which row will get written to | |
304 | assign pic_dma_wr_data_ld = pktag1_dcd & {DMA_DEPTH{pic2pdl_dma_wr_in}}; | |
305 | assign pce_pio_wr_data_ld = pktag2_dcd & {PIO_DEPTH{pce2pdl_pio_wr_in}}; | |
306 | ||
307 | //-------------------------------------------------------------------- | |
308 | // write from scoreboard controllers | |
309 | //-------------------------------------------------------------------- | |
310 | assign dma_wr_data_in = pic2pdl_dma_wr_data_in; | |
311 | assign pio_wr_data_in = pce2pdl_pio_wr_data_in; | |
312 | ||
313 | ////////////////////////////////////////////////////////////////////// | |
314 | // *********** Sequential Logic ************************************ | |
315 | ////////////////////////////////////////////////////////////////////// | |
316 | ||
317 | always @(posedge clk) | |
318 | begin | |
319 | if (~rst_l) | |
320 | for(j=0; j < DMA_DEPTH; j=j+1) | |
321 | dma_data[j] <= {`FIRE_DLC_PSR_DMA_DATA_WDTH{1'b0}}; | |
322 | else | |
323 | for(j=0; j < DMA_DEPTH; j=j+1) | |
324 | if (pic_dma_wr_data_ld[j]) | |
325 | dma_data[j] <= dma_wr_data_in; | |
326 | end | |
327 | ||
328 | always @(posedge clk) | |
329 | begin | |
330 | if (~rst_l) | |
331 | for(k=0; k < PIO_DEPTH; k=k+1) | |
332 | pio_data[k] <= {`FIRE_DLC_PSR_PIO_DATA_WDTH{1'b0}}; | |
333 | else | |
334 | for(k=0; k < PIO_DEPTH; k=k+1) | |
335 | if (pce_pio_wr_data_ld[k]) | |
336 | pio_data[k] <= pio_wr_data_in; | |
337 | end | |
338 | ||
339 | ||
340 | // Debug port outputs | |
341 | always @ (posedge clk) | |
342 | begin | |
343 | if(~rst_l) | |
344 | for (m = 0; m < 2; m = m + 1) | |
345 | dbg_bus[m] <= 8'h00; | |
346 | else | |
347 | for (m = 0; m < 2; m = m + 1) | |
348 | dbg_bus[m] <= nxt_dbg_bus[m]; | |
349 | end // always @ (posedge clk) | |
350 | ||
351 | endmodule // dmu_psb_pdl | |
352 |