1 | |
---|
2 | /************************************************************************************* |
---|
3 | * File : caches_interfaces.h |
---|
4 | * Date : 27/06/2005 |
---|
5 | * Authors : F.Arzel |
---|
6 | * Release ; V0.0 |
---|
7 | * It is released under the GNU Public License (hopefully). |
---|
8 | * |
---|
9 | * This file defines a standard "non-blocking cache interface"; separate interfaces |
---|
10 | * are defined for non-blocking instruction cache and non-blocking data cache. |
---|
11 | *************************************************************************************/ |
---|
12 | |
---|
13 | #ifndef CACHES_INTERFACES_H |
---|
14 | #define CACHES_INTERFACES_H |
---|
15 | |
---|
16 | #include <systemc.h> |
---|
17 | |
---|
18 | /************************************************************************************* |
---|
19 | ******************************** Type ****************************** |
---|
20 | *************************************************************************************/ |
---|
21 | |
---|
22 | // ===== Type Icache ===== |
---|
23 | #define ITYPE_READ 0 // 00 |
---|
24 | #define ITYPE_LOCK 1 // 01 |
---|
25 | #define ITYPE_INVALIDATE 2 // 10 |
---|
26 | #define ITYPE_PREFETCH 3 // 11 |
---|
27 | |
---|
28 | // ===== Type Dcache ===== |
---|
29 | #define DTYPE_READ 0 // 000 |
---|
30 | #define DTYPE_LOCK 1 // 001 |
---|
31 | #define DTYPE_INVALIDATE 2 // 010 |
---|
32 | #define DTYPE_PREFETCH 3 // 011 |
---|
33 | #define DTYPE_WRITE 4 // 100 |
---|
34 | #define DTYPE_WRITE_ACK 5 // 101 |
---|
35 | #define DTYPE_FLUSH 6 // 110 |
---|
36 | // 111 |
---|
37 | |
---|
38 | // ===== Size access ===== |
---|
39 | #define ACCESS_SIZE 2 |
---|
40 | #define ACCESS_8 0 |
---|
41 | #define ACCESS_16 1 |
---|
42 | #define ACCESS_32 2 |
---|
43 | #define ACCESS_64 3 |
---|
44 | |
---|
45 | // ===== Error ===== |
---|
46 | #define ERR_NO 0 // 00 |
---|
47 | #define ERR_BUS 1 // 01 |
---|
48 | #define ERR_TLB 2 // 10 |
---|
49 | #define ERR_UNKNOW 3 // 11 |
---|
50 | |
---|
51 | // Return the number of bytes of a access |
---|
52 | unsigned int access_nb_bytes(sc_uint<ACCESS_SIZE> access) |
---|
53 | { |
---|
54 | return 1<<access; |
---|
55 | } |
---|
56 | |
---|
57 | /************************************************************************************* |
---|
58 | ******************************** ICACHE interface ****************************** |
---|
59 | *************************************************************************************/ |
---|
60 | |
---|
61 | /*** ICACHE signals ***/ |
---|
62 | |
---|
63 | template < unsigned short TRDID_SIZE, |
---|
64 | unsigned short PKTID_SIZE, |
---|
65 | unsigned short ADDR_SIZE , |
---|
66 | unsigned short INS_SIZE , |
---|
67 | unsigned short NB_ICACHE > |
---|
68 | |
---|
69 | struct ICACHE_SIGNALS |
---|
70 | { |
---|
71 | sc_signal<bool> REQ_VAL; |
---|
72 | sc_signal<bool> REQ_ACK; |
---|
73 | sc_signal<sc_uint<TRDID_SIZE> > REQ_TRDID; |
---|
74 | sc_signal<sc_uint<PKTID_SIZE> > REQ_PKTID; |
---|
75 | sc_signal<sc_uint<ADDR_SIZE> > REQ_ADDR; |
---|
76 | sc_signal<sc_uint<2> > REQ_TYPE; |
---|
77 | |
---|
78 | sc_signal<bool> RSP_VAL; |
---|
79 | sc_signal<bool> RSP_ACK; |
---|
80 | sc_signal<sc_uint<TRDID_SIZE> > RSP_TRDID; |
---|
81 | sc_signal<sc_uint<PKTID_SIZE> > RSP_PKTID; |
---|
82 | sc_signal<sc_uint<INS_SIZE> > RSP_INS [NB_ICACHE]; |
---|
83 | sc_signal<sc_uint<2> > RSP_ERR; |
---|
84 | |
---|
85 | #ifdef NONAME_RENAME |
---|
86 | void rename (char * prefixe) |
---|
87 | { |
---|
88 | char rename [100]; |
---|
89 | |
---|
90 | sprintf(rename,"%s_REQ_VAL" ,prefixe); |
---|
91 | REQ_VAL .rename(rename); |
---|
92 | sprintf(rename,"%s_REQ_ACK" ,prefixe); |
---|
93 | REQ_ACK .rename(rename); |
---|
94 | sprintf(rename,"%s_REQ_TRDID" ,prefixe); |
---|
95 | REQ_TRDID .rename(rename); |
---|
96 | sprintf(rename,"%s_REQ_PKTID" ,prefixe); |
---|
97 | REQ_PKTID .rename(rename); |
---|
98 | sprintf(rename,"%s_REQ_ADDR" ,prefixe); |
---|
99 | REQ_ADDR .rename(rename); |
---|
100 | sprintf(rename,"%s_REQ_TYPE" ,prefixe); |
---|
101 | REQ_TYPE .rename(rename); |
---|
102 | |
---|
103 | sprintf(rename,"%s_RSP_VAL" ,prefixe); |
---|
104 | RSP_VAL .rename(rename); |
---|
105 | sprintf(rename,"%s_RSP_ACK" ,prefixe); |
---|
106 | RSP_ACK .rename(rename); |
---|
107 | sprintf(rename,"%s_RSP_TRDID" ,prefixe); |
---|
108 | RSP_TRDID .rename(rename); |
---|
109 | sprintf(rename,"%s_RSP_PKTID" ,prefixe); |
---|
110 | RSP_PKTID .rename(rename); |
---|
111 | for (unsigned int it_nb_icache = 0; it_nb_icache < NB_ICACHE; it_nb_icache ++) |
---|
112 | { |
---|
113 | sprintf(rename,"%s_RSP_INS [%d]",prefixe,it_nb_icache); |
---|
114 | RSP_INS [it_nb_icache].rename(rename); |
---|
115 | }//it_nb_icache |
---|
116 | sprintf(rename,"%s_RSP_ERR" ,prefixe); |
---|
117 | RSP_ERR .rename(rename); |
---|
118 | } |
---|
119 | #endif //NONAME_RENAME |
---|
120 | }; |
---|
121 | |
---|
122 | /*** ICACHE cache ports ***/ |
---|
123 | |
---|
124 | template< unsigned short TRDID_SIZE, |
---|
125 | unsigned short PKTID_SIZE, |
---|
126 | unsigned short ADDR_SIZE , |
---|
127 | unsigned short INS_SIZE , |
---|
128 | unsigned short NB_ICACHE > |
---|
129 | |
---|
130 | struct ICACHE_CACHE_PORTS |
---|
131 | { |
---|
132 | |
---|
133 | sc_in <bool> REQ_VAL; |
---|
134 | sc_out<bool> REQ_ACK; |
---|
135 | sc_in <sc_uint<TRDID_SIZE> > REQ_TRDID; |
---|
136 | sc_in <sc_uint<PKTID_SIZE> > REQ_PKTID; |
---|
137 | sc_in <sc_uint<ADDR_SIZE> > REQ_ADDR; |
---|
138 | sc_in <sc_uint<2> > REQ_TYPE; |
---|
139 | |
---|
140 | sc_out<bool> RSP_VAL; |
---|
141 | sc_in <bool> RSP_ACK; |
---|
142 | sc_out<sc_uint<TRDID_SIZE> > RSP_TRDID; |
---|
143 | sc_out<sc_uint<PKTID_SIZE> > RSP_PKTID; |
---|
144 | sc_out<sc_uint<INS_SIZE> > RSP_INS [NB_ICACHE]; |
---|
145 | sc_out<sc_uint<2> > RSP_ERR; |
---|
146 | |
---|
147 | void operator () |
---|
148 | (ICACHE_SIGNALS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,INS_SIZE,NB_ICACHE> &signals) |
---|
149 | { |
---|
150 | REQ_VAL (signals.REQ_VAL); |
---|
151 | REQ_ACK (signals.REQ_ACK); |
---|
152 | REQ_TRDID (signals.REQ_TRDID); |
---|
153 | REQ_PKTID (signals.REQ_PKTID); |
---|
154 | REQ_ADDR (signals.REQ_ADDR); |
---|
155 | REQ_TYPE (signals.REQ_TYPE); |
---|
156 | |
---|
157 | RSP_VAL (signals.RSP_VAL); |
---|
158 | RSP_ACK (signals.RSP_ACK); |
---|
159 | RSP_TRDID (signals.RSP_TRDID); |
---|
160 | RSP_PKTID (signals.RSP_PKTID); |
---|
161 | for (unsigned int i = 0; i < NB_ICACHE; i++) |
---|
162 | RSP_INS[i] (signals.RSP_INS[i]); |
---|
163 | RSP_ERR (signals.RSP_ERR); |
---|
164 | }; |
---|
165 | |
---|
166 | void operator () |
---|
167 | (ICACHE_CACHE_PORTS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,INS_SIZE,NB_ICACHE> &ports) |
---|
168 | { |
---|
169 | |
---|
170 | REQ_VAL (ports.REQ_VAL); |
---|
171 | REQ_ACK (ports.REQ_ACK); |
---|
172 | REQ_TRDID (ports.REQ_TRDID); |
---|
173 | REQ_PKTID (ports.REQ_PKTID); |
---|
174 | REQ_ADDR (ports.REQ_ADDR); |
---|
175 | REQ_TYPE (ports.REQ_TYPE); |
---|
176 | |
---|
177 | RSP_VAL (ports.RSP_VAL); |
---|
178 | RSP_ACK (ports.RSP_ACK); |
---|
179 | RSP_TRDID (ports.RSP_TRDID); |
---|
180 | RSP_PKTID (ports.RSP_PKTID); |
---|
181 | for (unsigned int i = 0; i < NB_ICACHE; i++) |
---|
182 | RSP_INS[i] (ports.RSP_INS[i]); |
---|
183 | RSP_ERR (ports.RSP_ERR); |
---|
184 | }; |
---|
185 | |
---|
186 | #ifdef NONAME_RENAME |
---|
187 | void rename (char * prefixe) |
---|
188 | { |
---|
189 | char rename [100]; |
---|
190 | |
---|
191 | sprintf(rename,"%s_REQ_VAL" ,prefixe); |
---|
192 | REQ_VAL .rename(rename); |
---|
193 | sprintf(rename,"%s_REQ_ACK" ,prefixe); |
---|
194 | REQ_ACK .rename(rename); |
---|
195 | sprintf(rename,"%s_REQ_TRDID" ,prefixe); |
---|
196 | REQ_TRDID .rename(rename); |
---|
197 | sprintf(rename,"%s_REQ_PKTID" ,prefixe); |
---|
198 | REQ_PKTID .rename(rename); |
---|
199 | sprintf(rename,"%s_REQ_ADDR" ,prefixe); |
---|
200 | REQ_ADDR .rename(rename); |
---|
201 | sprintf(rename,"%s_REQ_TYPE" ,prefixe); |
---|
202 | REQ_TYPE .rename(rename); |
---|
203 | |
---|
204 | sprintf(rename,"%s_RSP_VAL" ,prefixe); |
---|
205 | RSP_VAL .rename(rename); |
---|
206 | sprintf(rename,"%s_RSP_ACK" ,prefixe); |
---|
207 | RSP_ACK .rename(rename); |
---|
208 | sprintf(rename,"%s_RSP_TRDID" ,prefixe); |
---|
209 | RSP_TRDID .rename(rename); |
---|
210 | sprintf(rename,"%s_RSP_PKTID" ,prefixe); |
---|
211 | RSP_PKTID .rename(rename); |
---|
212 | for (unsigned int it_nb_icache = 0; it_nb_icache < NB_ICACHE; it_nb_icache ++) |
---|
213 | { |
---|
214 | sprintf(rename,"%s_RSP_INS [%d]",prefixe,it_nb_icache); |
---|
215 | RSP_INS [it_nb_icache].rename(rename); |
---|
216 | }//it_nb_icache |
---|
217 | sprintf(rename,"%s_RSP_ERR" ,prefixe); |
---|
218 | RSP_ERR .rename(rename); |
---|
219 | } |
---|
220 | #endif //NONAME_RENAME |
---|
221 | }; |
---|
222 | |
---|
223 | /*** ICACHE processor ports ***/ |
---|
224 | |
---|
225 | template< unsigned short TRDID_SIZE, |
---|
226 | unsigned short PKTID_SIZE, |
---|
227 | unsigned short ADDR_SIZE , |
---|
228 | unsigned short INS_SIZE , |
---|
229 | unsigned short NB_ICACHE > |
---|
230 | |
---|
231 | struct ICACHE_PROCESSOR_PORTS |
---|
232 | { |
---|
233 | |
---|
234 | sc_out<bool> REQ_VAL; |
---|
235 | sc_in <bool> REQ_ACK; |
---|
236 | sc_out<sc_uint<TRDID_SIZE> > REQ_TRDID; |
---|
237 | sc_out<sc_uint<PKTID_SIZE> > REQ_PKTID; |
---|
238 | sc_out<sc_uint<ADDR_SIZE> > REQ_ADDR; |
---|
239 | sc_out<sc_uint<2> > REQ_TYPE; |
---|
240 | |
---|
241 | sc_in <bool> RSP_VAL; |
---|
242 | sc_out<bool> RSP_ACK; |
---|
243 | sc_in <sc_uint<TRDID_SIZE> > RSP_TRDID; |
---|
244 | sc_in <sc_uint<PKTID_SIZE> > RSP_PKTID; |
---|
245 | sc_in <sc_uint<INS_SIZE> > RSP_INS [NB_ICACHE]; |
---|
246 | sc_in <sc_uint<2> > RSP_ERR; |
---|
247 | |
---|
248 | void operator () |
---|
249 | (ICACHE_SIGNALS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,INS_SIZE,NB_ICACHE> &signals) |
---|
250 | { |
---|
251 | |
---|
252 | REQ_VAL (signals.REQ_VAL); |
---|
253 | REQ_ACK (signals.REQ_ACK); |
---|
254 | REQ_TRDID (signals.REQ_TRDID); |
---|
255 | REQ_PKTID (signals.REQ_PKTID); |
---|
256 | REQ_ADDR (signals.REQ_ADDR); |
---|
257 | REQ_TYPE (signals.REQ_TYPE); |
---|
258 | |
---|
259 | RSP_VAL (signals.RSP_VAL); |
---|
260 | RSP_ACK (signals.RSP_ACK); |
---|
261 | RSP_TRDID (signals.RSP_TRDID); |
---|
262 | RSP_PKTID (signals.RSP_PKTID); |
---|
263 | for (unsigned int i = 0; i < NB_ICACHE; i++) |
---|
264 | RSP_INS[i] (signals.RSP_INS[i]); |
---|
265 | RSP_ERR (signals.RSP_ERR); |
---|
266 | |
---|
267 | }; |
---|
268 | |
---|
269 | void operator () |
---|
270 | (ICACHE_PROCESSOR_PORTS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,INS_SIZE,NB_ICACHE> &ports) |
---|
271 | { |
---|
272 | |
---|
273 | REQ_VAL (ports.REQ_VAL); |
---|
274 | REQ_ACK (ports.REQ_ACK); |
---|
275 | REQ_TRDID (ports.REQ_TRDID); |
---|
276 | REQ_PKTID (ports.REQ_PKTID); |
---|
277 | REQ_ADDR (ports.REQ_ADDR); |
---|
278 | REQ_TYPE (ports.REQ_TYPE); |
---|
279 | |
---|
280 | RSP_VAL (ports.RSP_VAL); |
---|
281 | RSP_ACK (ports.RSP_ACK); |
---|
282 | RSP_TRDID (ports.RSP_TRDID); |
---|
283 | RSP_PKTID (ports.RSP_PKTID); |
---|
284 | for (unsigned int i = 0; i < NB_ICACHE; i++) |
---|
285 | RSP_INS[i] (ports.RSP_INS[i]); |
---|
286 | RSP_ERR (ports.RSP_ERR); |
---|
287 | |
---|
288 | }; |
---|
289 | #ifdef NONAME_RENAME |
---|
290 | void rename (char * prefixe) |
---|
291 | { |
---|
292 | char rename [100]; |
---|
293 | |
---|
294 | sprintf(rename,"%s_REQ_VAL" ,prefixe); |
---|
295 | REQ_VAL .rename(rename); |
---|
296 | sprintf(rename,"%s_REQ_ACK" ,prefixe); |
---|
297 | REQ_ACK .rename(rename); |
---|
298 | sprintf(rename,"%s_REQ_TRDID" ,prefixe); |
---|
299 | REQ_TRDID .rename(rename); |
---|
300 | sprintf(rename,"%s_REQ_PKTID" ,prefixe); |
---|
301 | REQ_PKTID .rename(rename); |
---|
302 | sprintf(rename,"%s_REQ_ADDR" ,prefixe); |
---|
303 | REQ_ADDR .rename(rename); |
---|
304 | sprintf(rename,"%s_REQ_TYPE" ,prefixe); |
---|
305 | REQ_TYPE .rename(rename); |
---|
306 | |
---|
307 | sprintf(rename,"%s_RSP_VAL" ,prefixe); |
---|
308 | RSP_VAL .rename(rename); |
---|
309 | sprintf(rename,"%s_RSP_ACK" ,prefixe); |
---|
310 | RSP_ACK .rename(rename); |
---|
311 | sprintf(rename,"%s_RSP_TRDID" ,prefixe); |
---|
312 | RSP_TRDID .rename(rename); |
---|
313 | sprintf(rename,"%s_RSP_PKTID" ,prefixe); |
---|
314 | RSP_PKTID .rename(rename); |
---|
315 | for (unsigned int it_nb_icache = 0; it_nb_icache < NB_ICACHE; it_nb_icache ++) |
---|
316 | { |
---|
317 | sprintf(rename,"%s_RSP_INS [%d]",prefixe,it_nb_icache); |
---|
318 | RSP_INS [it_nb_icache].rename(rename); |
---|
319 | }//it_nb_icache |
---|
320 | sprintf(rename,"%s_RSP_ERR" ,prefixe); |
---|
321 | RSP_ERR .rename(rename); |
---|
322 | } |
---|
323 | #endif //NONAME_RENAME |
---|
324 | }; |
---|
325 | |
---|
326 | /************************************************************************************* |
---|
327 | ******************************** DCACHE interface ****************************** |
---|
328 | *************************************************************************************/ |
---|
329 | |
---|
330 | /*** DCACHE signals ***/ |
---|
331 | |
---|
332 | template< unsigned short TRDID_SIZE, |
---|
333 | unsigned short PKTID_SIZE, |
---|
334 | unsigned short ADDR_SIZE , |
---|
335 | unsigned short DATA_SIZE > |
---|
336 | |
---|
337 | struct DCACHE_SIGNALS |
---|
338 | { |
---|
339 | |
---|
340 | sc_signal<bool> REQ_VAL; |
---|
341 | sc_signal<bool> REQ_ACK; |
---|
342 | sc_signal<sc_uint<TRDID_SIZE> > REQ_TRDID; |
---|
343 | sc_signal<sc_uint<PKTID_SIZE> > REQ_PKTID; |
---|
344 | sc_signal<sc_uint<ADDR_SIZE> > REQ_ADDR; |
---|
345 | sc_signal<sc_uint<3> > REQ_TYPE; |
---|
346 | sc_signal<bool> REQ_UNC; |
---|
347 | sc_signal<sc_uint<ACCESS_SIZE> > REQ_ACCESS; |
---|
348 | sc_signal<sc_uint<DATA_SIZE> > REQ_WDATA; |
---|
349 | |
---|
350 | sc_signal<bool> RSP_VAL; |
---|
351 | sc_signal<bool> RSP_ACK; |
---|
352 | sc_signal<sc_uint<TRDID_SIZE> > RSP_TRDID; |
---|
353 | sc_signal<sc_uint<PKTID_SIZE> > RSP_PKTID; |
---|
354 | sc_signal<sc_uint<DATA_SIZE> > RSP_RDATA; |
---|
355 | sc_signal<sc_uint<2> > RSP_ERR; |
---|
356 | |
---|
357 | #ifdef NONAME_RENAME |
---|
358 | void rename (char * prefixe) |
---|
359 | { |
---|
360 | char rename [100]; |
---|
361 | |
---|
362 | sprintf(rename,"%s_REQ_VAL" ,prefixe); |
---|
363 | REQ_VAL .rename(rename); |
---|
364 | sprintf(rename,"%s_REQ_ACK" ,prefixe); |
---|
365 | REQ_ACK .rename(rename); |
---|
366 | sprintf(rename,"%s_REQ_TRDID" ,prefixe); |
---|
367 | REQ_TRDID .rename(rename); |
---|
368 | sprintf(rename,"%s_REQ_PKTID" ,prefixe); |
---|
369 | REQ_PKTID .rename(rename); |
---|
370 | sprintf(rename,"%s_REQ_ADDR" ,prefixe); |
---|
371 | REQ_ADDR .rename(rename); |
---|
372 | sprintf(rename,"%s_REQ_TYPE" ,prefixe); |
---|
373 | REQ_TYPE .rename(rename); |
---|
374 | sprintf(rename,"%s_REQ_UNC" ,prefixe); |
---|
375 | REQ_UNC .rename(rename); |
---|
376 | sprintf(rename,"%s_REQ_ACCESS" ,prefixe); |
---|
377 | REQ_ACCESS .rename(rename); |
---|
378 | sprintf(rename,"%s_REQ_WDATA" ,prefixe); |
---|
379 | REQ_WDATA .rename(rename); |
---|
380 | |
---|
381 | sprintf(rename,"%s_RSP_VAL" ,prefixe); |
---|
382 | RSP_VAL .rename(rename); |
---|
383 | sprintf(rename,"%s_RSP_ACK" ,prefixe); |
---|
384 | RSP_ACK .rename(rename); |
---|
385 | sprintf(rename,"%s_RSP_TRDID" ,prefixe); |
---|
386 | RSP_TRDID .rename(rename); |
---|
387 | sprintf(rename,"%s_RSP_PKTID" ,prefixe); |
---|
388 | RSP_PKTID .rename(rename); |
---|
389 | sprintf(rename,"%s_RSP_RDATA" ,prefixe); |
---|
390 | RSP_RDATA .rename(rename); |
---|
391 | sprintf(rename,"%s_RSP_ERR" ,prefixe); |
---|
392 | RSP_ERR .rename(rename); |
---|
393 | } |
---|
394 | #endif //NONAME_RENAME |
---|
395 | }; |
---|
396 | |
---|
397 | /*** DCACHE cache ports ***/ |
---|
398 | |
---|
399 | template< unsigned short TRDID_SIZE, |
---|
400 | unsigned short PKTID_SIZE, |
---|
401 | unsigned short ADDR_SIZE, |
---|
402 | unsigned short DATA_SIZE > |
---|
403 | |
---|
404 | struct DCACHE_CACHE_PORTS |
---|
405 | { |
---|
406 | sc_in <bool> REQ_VAL; |
---|
407 | sc_out<bool> REQ_ACK; |
---|
408 | sc_in <sc_uint<TRDID_SIZE> > REQ_TRDID; |
---|
409 | sc_in <sc_uint<PKTID_SIZE> > REQ_PKTID; |
---|
410 | sc_in <sc_uint<ADDR_SIZE> > REQ_ADDR; |
---|
411 | sc_in <sc_uint<3> > REQ_TYPE; |
---|
412 | sc_in <bool> REQ_UNC; |
---|
413 | sc_in <sc_uint<ACCESS_SIZE> > REQ_ACCESS; |
---|
414 | sc_in <sc_uint<DATA_SIZE> > REQ_WDATA; |
---|
415 | |
---|
416 | sc_out<bool> RSP_VAL; |
---|
417 | sc_in <bool> RSP_ACK; |
---|
418 | sc_out<sc_uint<TRDID_SIZE> > RSP_TRDID; |
---|
419 | sc_out<sc_uint<PKTID_SIZE> > RSP_PKTID; |
---|
420 | sc_out<sc_uint<DATA_SIZE> > RSP_RDATA; |
---|
421 | sc_out<sc_uint<2> > RSP_ERR; |
---|
422 | |
---|
423 | void operator () |
---|
424 | (DCACHE_SIGNALS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,DATA_SIZE> &signals) |
---|
425 | { |
---|
426 | |
---|
427 | REQ_VAL (signals.REQ_VAL); |
---|
428 | REQ_ACK (signals.REQ_ACK); |
---|
429 | REQ_TRDID (signals.REQ_TRDID); |
---|
430 | REQ_PKTID (signals.REQ_PKTID); |
---|
431 | REQ_ADDR (signals.REQ_ADDR); |
---|
432 | REQ_TYPE (signals.REQ_TYPE); |
---|
433 | REQ_UNC (signals.REQ_UNC); |
---|
434 | REQ_ACCESS (signals.REQ_ACCESS); |
---|
435 | REQ_WDATA (signals.REQ_WDATA); |
---|
436 | |
---|
437 | RSP_VAL (signals.RSP_VAL); |
---|
438 | RSP_ACK (signals.RSP_ACK); |
---|
439 | RSP_TRDID (signals.RSP_TRDID); |
---|
440 | RSP_PKTID (signals.RSP_PKTID); |
---|
441 | RSP_RDATA (signals.RSP_RDATA); |
---|
442 | RSP_ERR (signals.RSP_ERR); |
---|
443 | |
---|
444 | }; |
---|
445 | |
---|
446 | void operator () |
---|
447 | (DCACHE_CACHE_PORTS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,DATA_SIZE> &ports) |
---|
448 | { |
---|
449 | |
---|
450 | REQ_VAL (ports.REQ_VAL); |
---|
451 | REQ_ACK (ports.REQ_ACK); |
---|
452 | REQ_TRDID (ports.REQ_TRDID); |
---|
453 | REQ_PKTID (ports.REQ_PKTID); |
---|
454 | REQ_ADDR (ports.REQ_ADDR); |
---|
455 | REQ_TYPE (ports.REQ_TYPE); |
---|
456 | REQ_UNC (ports.REQ_UNC); |
---|
457 | REQ_ACCESS (ports.REQ_ACCESS); |
---|
458 | REQ_WDATA (ports.REQ_WDATA); |
---|
459 | |
---|
460 | RSP_VAL (ports.RSP_VAL); |
---|
461 | RSP_ACK (ports.RSP_ACK); |
---|
462 | RSP_TRDID (ports.RSP_TRDID); |
---|
463 | RSP_PKTID (ports.RSP_PKTID); |
---|
464 | RSP_RDATA (ports.RSP_RDATA); |
---|
465 | RSP_ERR (ports.RSP_ERR); |
---|
466 | |
---|
467 | }; |
---|
468 | |
---|
469 | #ifdef NONAME_RENAME |
---|
470 | void rename (char * prefixe) |
---|
471 | { |
---|
472 | char rename [100]; |
---|
473 | |
---|
474 | sprintf(rename,"%s_REQ_VAL" ,prefixe); |
---|
475 | REQ_VAL .rename(rename); |
---|
476 | sprintf(rename,"%s_REQ_ACK" ,prefixe); |
---|
477 | REQ_ACK .rename(rename); |
---|
478 | sprintf(rename,"%s_REQ_TRDID" ,prefixe); |
---|
479 | REQ_TRDID .rename(rename); |
---|
480 | sprintf(rename,"%s_REQ_PKTID" ,prefixe); |
---|
481 | REQ_PKTID .rename(rename); |
---|
482 | sprintf(rename,"%s_REQ_ADDR" ,prefixe); |
---|
483 | REQ_ADDR .rename(rename); |
---|
484 | sprintf(rename,"%s_REQ_TYPE" ,prefixe); |
---|
485 | REQ_TYPE .rename(rename); |
---|
486 | sprintf(rename,"%s_REQ_UNC" ,prefixe); |
---|
487 | REQ_UNC .rename(rename); |
---|
488 | sprintf(rename,"%s_REQ_ACCESS" ,prefixe); |
---|
489 | REQ_ACCESS .rename(rename); |
---|
490 | sprintf(rename,"%s_REQ_WDATA" ,prefixe); |
---|
491 | REQ_WDATA .rename(rename); |
---|
492 | |
---|
493 | sprintf(rename,"%s_RSP_VAL" ,prefixe); |
---|
494 | RSP_VAL .rename(rename); |
---|
495 | sprintf(rename,"%s_RSP_ACK" ,prefixe); |
---|
496 | RSP_ACK .rename(rename); |
---|
497 | sprintf(rename,"%s_RSP_TRDID" ,prefixe); |
---|
498 | RSP_TRDID .rename(rename); |
---|
499 | sprintf(rename,"%s_RSP_PKTID" ,prefixe); |
---|
500 | RSP_PKTID .rename(rename); |
---|
501 | sprintf(rename,"%s_RSP_RDATA" ,prefixe); |
---|
502 | RSP_RDATA .rename(rename); |
---|
503 | sprintf(rename,"%s_RSP_ERR" ,prefixe); |
---|
504 | RSP_ERR .rename(rename); |
---|
505 | } |
---|
506 | #endif //NONAME_RENAME |
---|
507 | }; |
---|
508 | |
---|
509 | /*** DCACHE processor ports ***/ |
---|
510 | |
---|
511 | template< unsigned short TRDID_SIZE, |
---|
512 | unsigned short PKTID_SIZE, |
---|
513 | unsigned short ADDR_SIZE , |
---|
514 | unsigned short DATA_SIZE > |
---|
515 | |
---|
516 | struct DCACHE_PROCESSOR_PORTS |
---|
517 | { |
---|
518 | |
---|
519 | sc_out<bool> REQ_VAL; |
---|
520 | sc_in <bool> REQ_ACK; |
---|
521 | sc_out<sc_uint<TRDID_SIZE> > REQ_TRDID; |
---|
522 | sc_out<sc_uint<PKTID_SIZE> > REQ_PKTID; |
---|
523 | sc_out<sc_uint<ADDR_SIZE> > REQ_ADDR; |
---|
524 | sc_out<sc_uint<3> > REQ_TYPE; |
---|
525 | sc_out<bool> REQ_UNC; |
---|
526 | sc_out<sc_uint<ACCESS_SIZE> > REQ_ACCESS; |
---|
527 | sc_out<sc_uint<DATA_SIZE> > REQ_WDATA; |
---|
528 | |
---|
529 | sc_in <bool> RSP_VAL; |
---|
530 | sc_out<bool> RSP_ACK; |
---|
531 | sc_in <sc_uint<TRDID_SIZE> > RSP_TRDID; |
---|
532 | sc_in <sc_uint<PKTID_SIZE> > RSP_PKTID; |
---|
533 | sc_in <sc_uint<DATA_SIZE> > RSP_RDATA; |
---|
534 | sc_in <sc_uint<2> > RSP_ERR; |
---|
535 | |
---|
536 | void operator () |
---|
537 | (DCACHE_SIGNALS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,DATA_SIZE> &signals) |
---|
538 | { |
---|
539 | |
---|
540 | REQ_VAL (signals.REQ_VAL); |
---|
541 | REQ_ACK (signals.REQ_ACK); |
---|
542 | REQ_TRDID (signals.REQ_TRDID); |
---|
543 | REQ_PKTID (signals.REQ_PKTID); |
---|
544 | REQ_ADDR (signals.REQ_ADDR); |
---|
545 | REQ_TYPE (signals.REQ_TYPE); |
---|
546 | REQ_UNC (signals.REQ_UNC); |
---|
547 | REQ_ACCESS (signals.REQ_ACCESS); |
---|
548 | REQ_WDATA (signals.REQ_WDATA); |
---|
549 | |
---|
550 | RSP_VAL (signals.RSP_VAL); |
---|
551 | RSP_ACK (signals.RSP_ACK); |
---|
552 | RSP_TRDID (signals.RSP_TRDID); |
---|
553 | RSP_PKTID (signals.RSP_PKTID); |
---|
554 | RSP_RDATA (signals.RSP_RDATA); |
---|
555 | RSP_ERR (signals.RSP_ERR); |
---|
556 | |
---|
557 | }; |
---|
558 | |
---|
559 | void operator () |
---|
560 | (DCACHE_PROCESSOR_PORTS<TRDID_SIZE,PKTID_SIZE,ADDR_SIZE,DATA_SIZE> &ports) |
---|
561 | { |
---|
562 | |
---|
563 | REQ_VAL (ports.REQ_VAL); |
---|
564 | REQ_ACK (ports.REQ_ACK); |
---|
565 | REQ_TRDID (ports.REQ_TRDID); |
---|
566 | REQ_PKTID (ports.REQ_PKTID); |
---|
567 | REQ_ADDR (ports.REQ_ADDR); |
---|
568 | REQ_TYPE (ports.REQ_TYPE); |
---|
569 | REQ_UNC (ports.REQ_UNC); |
---|
570 | REQ_ACCESS (ports.REQ_ACCESS); |
---|
571 | REQ_WDATA (ports.REQ_WDATA); |
---|
572 | |
---|
573 | RSP_VAL (ports.RSP_VAL); |
---|
574 | RSP_ACK (ports.RSP_ACK); |
---|
575 | RSP_TRDID (ports.RSP_TRDID); |
---|
576 | RSP_PKTID (ports.RSP_PKTID); |
---|
577 | RSP_RDATA (ports.RSP_RDATA); |
---|
578 | RSP_ERR (ports.RSP_ERR); |
---|
579 | |
---|
580 | }; |
---|
581 | |
---|
582 | #ifdef NONAME_RENAME |
---|
583 | void rename (char * prefixe) |
---|
584 | { |
---|
585 | char rename [100]; |
---|
586 | |
---|
587 | sprintf(rename,"%s_REQ_VAL" ,prefixe); |
---|
588 | REQ_VAL .rename(rename); |
---|
589 | sprintf(rename,"%s_REQ_ACK" ,prefixe); |
---|
590 | REQ_ACK .rename(rename); |
---|
591 | sprintf(rename,"%s_REQ_TRDID" ,prefixe); |
---|
592 | REQ_TRDID .rename(rename); |
---|
593 | sprintf(rename,"%s_REQ_PKTID" ,prefixe); |
---|
594 | REQ_PKTID .rename(rename); |
---|
595 | sprintf(rename,"%s_REQ_ADDR" ,prefixe); |
---|
596 | REQ_ADDR .rename(rename); |
---|
597 | sprintf(rename,"%s_REQ_TYPE" ,prefixe); |
---|
598 | REQ_TYPE .rename(rename); |
---|
599 | sprintf(rename,"%s_REQ_UNC" ,prefixe); |
---|
600 | REQ_UNC .rename(rename); |
---|
601 | sprintf(rename,"%s_REQ_ACCESS" ,prefixe); |
---|
602 | REQ_ACCESS .rename(rename); |
---|
603 | sprintf(rename,"%s_REQ_WDATA" ,prefixe); |
---|
604 | REQ_WDATA .rename(rename); |
---|
605 | |
---|
606 | sprintf(rename,"%s_RSP_VAL" ,prefixe); |
---|
607 | RSP_VAL .rename(rename); |
---|
608 | sprintf(rename,"%s_RSP_ACK" ,prefixe); |
---|
609 | RSP_ACK .rename(rename); |
---|
610 | sprintf(rename,"%s_RSP_TRDID" ,prefixe); |
---|
611 | RSP_TRDID .rename(rename); |
---|
612 | sprintf(rename,"%s_RSP_PKTID" ,prefixe); |
---|
613 | RSP_PKTID .rename(rename); |
---|
614 | sprintf(rename,"%s_RSP_RDATA" ,prefixe); |
---|
615 | RSP_RDATA .rename(rename); |
---|
616 | sprintf(rename,"%s_RSP_ERR" ,prefixe); |
---|
617 | RSP_ERR .rename(rename); |
---|
618 | } |
---|
619 | #endif //NONAME_RENAME |
---|
620 | }; |
---|
621 | |
---|
622 | #endif |
---|