1 | #ifndef morpheo_behavioural_Allocation_h |
---|
2 | #define morpheo_behavioural_Allocation_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Allocation.h 112 2009-03-18 22:36:26Z rosiere $ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #include "Common/include/Debug.h" |
---|
12 | |
---|
13 | // ====================================================================== |
---|
14 | // =====[ ALLOCATION / DELETE of ARRAY ]================================= |
---|
15 | // ====================================================================== |
---|
16 | #define ALLOC0(var,type) \ |
---|
17 | var = new type |
---|
18 | |
---|
19 | #define ALLOC1(var,type,s1) \ |
---|
20 | var = new type [s1] |
---|
21 | |
---|
22 | #define ALLOC2(var,type,s1,s2) \ |
---|
23 | var = new type * [s1]; \ |
---|
24 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
25 | { \ |
---|
26 | var [it1] = new type [s2]; \ |
---|
27 | } |
---|
28 | |
---|
29 | #define ALLOC3(var,type,s1,s2,s3) \ |
---|
30 | var = new type ** [s1]; \ |
---|
31 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
32 | { \ |
---|
33 | var [it1] = new type * [s2]; \ |
---|
34 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
35 | { \ |
---|
36 | var [it1][it2] = new type [s3]; \ |
---|
37 | } \ |
---|
38 | } |
---|
39 | |
---|
40 | #define ALLOC4(var,type,s1,s2,s3,s4) \ |
---|
41 | var = new type *** [s1]; \ |
---|
42 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
43 | { \ |
---|
44 | var [it1] = new type ** [s2]; \ |
---|
45 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
46 | { \ |
---|
47 | var [it1][it2] = new type * [s3]; \ |
---|
48 | for (uint32_t it3=0; it3<s3; ++it3) \ |
---|
49 | { \ |
---|
50 | var [it1][it2][it3] = new type [s4]; \ |
---|
51 | } \ |
---|
52 | } \ |
---|
53 | } |
---|
54 | |
---|
55 | #define DELETE0(var) \ |
---|
56 | delete var; |
---|
57 | |
---|
58 | #define DELETE1(var,s1) \ |
---|
59 | delete [] var; |
---|
60 | |
---|
61 | #define DELETE2(var,s1,s2) \ |
---|
62 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
63 | { \ |
---|
64 | delete [] var [it1]; \ |
---|
65 | } \ |
---|
66 | delete [] var; |
---|
67 | |
---|
68 | #define DELETE3(var,s1,s2,s3) \ |
---|
69 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
70 | { \ |
---|
71 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
72 | { \ |
---|
73 | delete [] var [it1][it2]; \ |
---|
74 | } \ |
---|
75 | delete [] var [it1]; \ |
---|
76 | } \ |
---|
77 | delete [] var; |
---|
78 | |
---|
79 | #define DELETE4(var,s1,s2,s3,s4) \ |
---|
80 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
81 | { \ |
---|
82 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
83 | { \ |
---|
84 | for (uint32_t it3=0; it3<s3; ++it3) \ |
---|
85 | { \ |
---|
86 | delete [] var [it1][it2][it3]; \ |
---|
87 | } \ |
---|
88 | delete [] var [it1][it2]; \ |
---|
89 | } \ |
---|
90 | delete [] var [it1]; \ |
---|
91 | } \ |
---|
92 | delete [] var; |
---|
93 | |
---|
94 | // ====================================================================== |
---|
95 | // =====[ ALLOCATION / DELETE of SIGNAL]================================= |
---|
96 | // ====================================================================== |
---|
97 | |
---|
98 | // Help to allocate interface |
---|
99 | #define INTERFACE_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : Interface's creation : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__); |
---|
100 | #define PRINT_SIGNAL_ADDRESS(name,address) log_printf(TRACE,Allocation,FUNCTION,"Signal : %s 0x%.8x(%s, %d)",name,(uint32_t)((uint64_t)(address)),__FILE__,__LINE__); |
---|
101 | #define PRINT_SIZE_NUL(component,interface,signal) log_printf(TRACE,Allocation,FUNCTION,_("<%s> %s.%s.%s : size is nul."),_name.c_str(),component->get_name().c_str(),interface->get_name().c_str(),signal); |
---|
102 | #define TEST_SIGNAL(name,address) PRINT_SIGNAL_ADDRESS(name,address); TEST_PTR(address) |
---|
103 | |
---|
104 | // ---------------------------------------------------------------------- |
---|
105 | // -----[ NO ITERATION ]------------------------------------------------- |
---|
106 | // ---------------------------------------------------------------------- |
---|
107 | |
---|
108 | |
---|
109 | #define __ALLOC0_SIGNAL(sig, name, type) \ |
---|
110 | { \ |
---|
111 | sig = new type (name); \ |
---|
112 | } |
---|
113 | |
---|
114 | #ifdef POSITION |
---|
115 | #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) \ |
---|
116 | INTERFACE_PRINT(name); \ |
---|
117 | morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str); |
---|
118 | #else |
---|
119 | #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) \ |
---|
120 | INTERFACE_PRINT(name); \ |
---|
121 | morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name); |
---|
122 | #endif |
---|
123 | |
---|
124 | #define ALLOC0_INTERFACE_END() |
---|
125 | |
---|
126 | #define ALLOC0_VAL_ACK_IN( sig, name, type) \ |
---|
127 | { \ |
---|
128 | sig = interface->set_signal_valack_in (name, type); \ |
---|
129 | } |
---|
130 | #define ALLOC0_VAL_ACK_OUT( sig, name, type) \ |
---|
131 | { \ |
---|
132 | sig = interface->set_signal_valack_out(name, type); \ |
---|
133 | } |
---|
134 | #define ALLOC0_VALACK_IN( sig, type) \ |
---|
135 | { \ |
---|
136 | sig = interface->set_signal_valack_in (type); \ |
---|
137 | } |
---|
138 | #define ALLOC0_VALACK_OUT( sig, type) \ |
---|
139 | { \ |
---|
140 | sig = interface->set_signal_valack_out(type); \ |
---|
141 | } |
---|
142 | #define ALLOC0_SIGNAL_IN( sig, name, type, size) \ |
---|
143 | if (size > 0) \ |
---|
144 | { \ |
---|
145 | sig = interface->set_signal_in <type> (name, size); \ |
---|
146 | } \ |
---|
147 | else \ |
---|
148 | { \ |
---|
149 | PRINT_SIZE_NUL(_component,interface,name); \ |
---|
150 | } |
---|
151 | |
---|
152 | #define ALLOC0_SIGNAL_OUT( sig, name, type, size) \ |
---|
153 | if (size > 0) \ |
---|
154 | { \ |
---|
155 | sig = interface->set_signal_out<type> (name, size); \ |
---|
156 | } \ |
---|
157 | else \ |
---|
158 | { \ |
---|
159 | PRINT_SIZE_NUL(_component,interface,name); \ |
---|
160 | } |
---|
161 | |
---|
162 | #define DELETE0_SIGNAL( sig, size) \ |
---|
163 | if (size > 0) \ |
---|
164 | { \ |
---|
165 | delete sig; \ |
---|
166 | } |
---|
167 | |
---|
168 | #define ALLOC0_SC_SIGNAL( sig, name, type) \ |
---|
169 | sc_signal<type> * sig = new sc_signal<type> (name); \ |
---|
170 | PRINT_SIGNAL_ADDRESS(name,sig); |
---|
171 | |
---|
172 | #define INSTANCE0_SC_SIGNAL(component, sig) \ |
---|
173 | { \ |
---|
174 | TEST_SIGNAL(component->sig->name(),component->sig); \ |
---|
175 | TEST_SIGNAL(sig ->name(),sig); \ |
---|
176 | (*(component->sig)) (*(sig)); \ |
---|
177 | } |
---|
178 | |
---|
179 | #define _INSTANCE0_SC_SIGNAL(component, sig1,sig2) \ |
---|
180 | { \ |
---|
181 | TEST_SIGNAL(component->sig1->name(),component->sig1); \ |
---|
182 | TEST_SIGNAL(sig2 ->name(),sig2); \ |
---|
183 | (*(component->sig1)) (*(sig2)); \ |
---|
184 | } |
---|
185 | |
---|
186 | #define DELETE0_SC_SIGNAL( sig) \ |
---|
187 | { \ |
---|
188 | delete sig; \ |
---|
189 | } |
---|
190 | |
---|
191 | // ---------------------------------------------------------------------- |
---|
192 | // -----[ ITERATION 1 ]-------------------------------------------------- |
---|
193 | // ---------------------------------------------------------------------- |
---|
194 | |
---|
195 | #define __ALLOC1_INTERFACE_BEGIN(name, x1) \ |
---|
196 | INTERFACE_PRINT(name); \ |
---|
197 | const std::string interface_name = name; \ |
---|
198 | const uint32_t iterator_1 = x1; |
---|
199 | |
---|
200 | #define __ALLOC1_INTERFACE_END(x1) |
---|
201 | |
---|
202 | #define __ALLOC1_SIGNAL_IN( sig, name, type) \ |
---|
203 | { \ |
---|
204 | sig = new SC_IN(type) * [iterator_1]; \ |
---|
205 | std::string separator="_"; \ |
---|
206 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
207 | { \ |
---|
208 | std::string str = "in_"+interface_name+separator+toString(it1)+separator+name; \ |
---|
209 | sig [it1] = new SC_IN(type) (str.c_str()); \ |
---|
210 | } \ |
---|
211 | } |
---|
212 | |
---|
213 | #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ |
---|
214 | { \ |
---|
215 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
216 | std::string separator="_"; \ |
---|
217 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
218 | { \ |
---|
219 | std::string str = "out_"+interface_name+separator+toString(it1)+separator+name; \ |
---|
220 | sig [it1] = new SC_OUT(type) (str.c_str()); \ |
---|
221 | } \ |
---|
222 | } |
---|
223 | |
---|
224 | #ifdef POSITION |
---|
225 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
226 | INTERFACE_PRINT(name); \ |
---|
227 | const uint32_t iterator_1 = x1; \ |
---|
228 | morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ |
---|
229 | { \ |
---|
230 | std::string separator="_"; \ |
---|
231 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
232 | { \ |
---|
233 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1), direction, localisation, str); \ |
---|
234 | } \ |
---|
235 | } |
---|
236 | #else |
---|
237 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
238 | INTERFACE_PRINT(name); \ |
---|
239 | const uint32_t iterator_1 = x1; \ |
---|
240 | morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ |
---|
241 | { \ |
---|
242 | std::string separator="_"; \ |
---|
243 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
244 | { \ |
---|
245 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1)); \ |
---|
246 | } \ |
---|
247 | } |
---|
248 | #endif |
---|
249 | |
---|
250 | #define ALLOC1_INTERFACE_END(x1) |
---|
251 | |
---|
252 | #define ALLOC1_VAL_ACK_IN( sig, name, type) \ |
---|
253 | { \ |
---|
254 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
255 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
256 | { \ |
---|
257 | sig [it1] = interface[it1]->set_signal_valack_in (name, type); \ |
---|
258 | } \ |
---|
259 | } |
---|
260 | #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ |
---|
261 | { \ |
---|
262 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
263 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
264 | { \ |
---|
265 | sig [it1] = interface[it1]->set_signal_valack_out(name, type); \ |
---|
266 | } \ |
---|
267 | } |
---|
268 | #define ALLOC1_VALACK_IN( sig, type) \ |
---|
269 | { \ |
---|
270 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
271 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
272 | { \ |
---|
273 | sig [it1] = interface[it1]->set_signal_valack_in (type); \ |
---|
274 | } \ |
---|
275 | } |
---|
276 | #define ALLOC1_VALACK_OUT( sig, type) \ |
---|
277 | { \ |
---|
278 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
279 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
280 | { \ |
---|
281 | sig [it1] = interface[it1]->set_signal_valack_out(type); \ |
---|
282 | } \ |
---|
283 | } |
---|
284 | #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ |
---|
285 | { \ |
---|
286 | sig = new SC_IN (type) * [iterator_1]; \ |
---|
287 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
288 | { \ |
---|
289 | if (size > 0) \ |
---|
290 | { \ |
---|
291 | sig [it1] = interface[it1]->set_signal_in <type> (name, size); \ |
---|
292 | } \ |
---|
293 | else \ |
---|
294 | { \ |
---|
295 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
296 | } \ |
---|
297 | } \ |
---|
298 | } |
---|
299 | |
---|
300 | #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ |
---|
301 | { \ |
---|
302 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
303 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
304 | { \ |
---|
305 | if (size > 0) \ |
---|
306 | { \ |
---|
307 | sig [it1] = interface[it1]->set_signal_out<type> (name, size); \ |
---|
308 | } \ |
---|
309 | else \ |
---|
310 | { \ |
---|
311 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
312 | } \ |
---|
313 | } \ |
---|
314 | } |
---|
315 | |
---|
316 | #define DELETE1_SIGNAL(sig, x1, size) \ |
---|
317 | { \ |
---|
318 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
319 | { \ |
---|
320 | if (size > 0) \ |
---|
321 | { \ |
---|
322 | delete sig[it1]; \ |
---|
323 | } \ |
---|
324 | } \ |
---|
325 | delete [] sig; \ |
---|
326 | } |
---|
327 | |
---|
328 | #define ALLOC1_SC_SIGNAL( sig, name, type, x1) \ |
---|
329 | sc_signal<type> ** sig = new sc_signal<type> * [x1]; \ |
---|
330 | { \ |
---|
331 | std::string separator="_"; \ |
---|
332 | std::string str; \ |
---|
333 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
334 | { \ |
---|
335 | str = name+separator+toString(it1); \ |
---|
336 | sig [it1] = new sc_signal<type> (str.c_str()); \ |
---|
337 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1]); \ |
---|
338 | } \ |
---|
339 | } |
---|
340 | |
---|
341 | #define INSTANCE1_SC_SIGNAL(component, sig, x1) \ |
---|
342 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
343 | { \ |
---|
344 | TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \ |
---|
345 | TEST_SIGNAL(sig [it1]->name(),sig [it1]); \ |
---|
346 | (*(component->sig[it1])) (*(sig[it1])); \ |
---|
347 | } |
---|
348 | |
---|
349 | #define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1) \ |
---|
350 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
351 | { \ |
---|
352 | TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \ |
---|
353 | TEST_SIGNAL(sig2 [it1]->name(),sig2 [it1]); \ |
---|
354 | (*(component->sig1[it1])) (*(sig2[it1])); \ |
---|
355 | } |
---|
356 | |
---|
357 | #define DELETE1_SC_SIGNAL(sig, x1) \ |
---|
358 | { \ |
---|
359 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
360 | { \ |
---|
361 | delete sig[it1]; \ |
---|
362 | } \ |
---|
363 | delete [] sig; \ |
---|
364 | } |
---|
365 | |
---|
366 | // ---------------------------------------------------------------------- |
---|
367 | // -----[ ITERATION 2 ]-------------------------------------------------- |
---|
368 | // ---------------------------------------------------------------------- |
---|
369 | |
---|
370 | #ifdef POSITION |
---|
371 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
372 | INTERFACE_PRINT(name); \ |
---|
373 | uint32_t iterator_1 = 0; \ |
---|
374 | uint32_t iterator_2 = 0; \ |
---|
375 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
376 | { \ |
---|
377 | std::string separator="_"; \ |
---|
378 | iterator_1 = x1; \ |
---|
379 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
380 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
381 | { \ |
---|
382 | iterator_2 = x2; \ |
---|
383 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
384 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
385 | { \ |
---|
386 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2), direction, localisation, str); \ |
---|
387 | } \ |
---|
388 | } \ |
---|
389 | } |
---|
390 | #else |
---|
391 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
392 | INTERFACE_PRINT(name); \ |
---|
393 | uint32_t iterator_1 = 0; \ |
---|
394 | uint32_t iterator_2 = 0; \ |
---|
395 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
396 | { \ |
---|
397 | std::string separator="_"; \ |
---|
398 | iterator_1 = x1; \ |
---|
399 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
400 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
401 | { \ |
---|
402 | iterator_2 = x2; \ |
---|
403 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
404 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
405 | { \ |
---|
406 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)); \ |
---|
407 | } \ |
---|
408 | } \ |
---|
409 | } |
---|
410 | #endif |
---|
411 | |
---|
412 | #define ALLOC2_INTERFACE_END(x1, x2) \ |
---|
413 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
414 | delete interface [it1]; \ |
---|
415 | delete [] interface; |
---|
416 | |
---|
417 | #define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2) \ |
---|
418 | { \ |
---|
419 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
420 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
421 | { \ |
---|
422 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
423 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
424 | { \ |
---|
425 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (name, type); \ |
---|
426 | } \ |
---|
427 | } \ |
---|
428 | } |
---|
429 | |
---|
430 | #define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2) \ |
---|
431 | { \ |
---|
432 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
433 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
434 | { \ |
---|
435 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
436 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
437 | { \ |
---|
438 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (name, type); \ |
---|
439 | } \ |
---|
440 | } \ |
---|
441 | } |
---|
442 | |
---|
443 | #define _ALLOC2_VALACK_IN( sig,type, x1, x2) \ |
---|
444 | { \ |
---|
445 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
446 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
447 | { \ |
---|
448 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
449 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
450 | { \ |
---|
451 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (type); \ |
---|
452 | } \ |
---|
453 | } \ |
---|
454 | } |
---|
455 | |
---|
456 | #define _ALLOC2_VALACK_OUT( sig,type, x1, x2) \ |
---|
457 | { \ |
---|
458 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
459 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
460 | { \ |
---|
461 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
462 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
463 | { \ |
---|
464 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (type); \ |
---|
465 | } \ |
---|
466 | } \ |
---|
467 | } |
---|
468 | |
---|
469 | #define _ALLOC2_SIGNAL_IN( sig, name, type, size, x1, x2) \ |
---|
470 | { \ |
---|
471 | sig = new SC_IN (type) ** [x1]; \ |
---|
472 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
473 | { \ |
---|
474 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
475 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
476 | { \ |
---|
477 | if (size > 0) \ |
---|
478 | { \ |
---|
479 | sig [it1][it2] = interface[it1][it2]->set_signal_in <type> (name, size); \ |
---|
480 | } \ |
---|
481 | else \ |
---|
482 | { \ |
---|
483 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
484 | } \ |
---|
485 | } \ |
---|
486 | } \ |
---|
487 | } |
---|
488 | |
---|
489 | #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, x1, x2) \ |
---|
490 | { \ |
---|
491 | sig = new SC_OUT (type) ** [x1]; \ |
---|
492 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
493 | { \ |
---|
494 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
495 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
496 | { \ |
---|
497 | if (size > 0) \ |
---|
498 | { \ |
---|
499 | sig [it1][it2] = interface[it1][it2]->set_signal_out <type> (name, size); \ |
---|
500 | } \ |
---|
501 | else \ |
---|
502 | { \ |
---|
503 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
504 | } \ |
---|
505 | } \ |
---|
506 | } \ |
---|
507 | } |
---|
508 | |
---|
509 | #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) |
---|
510 | #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) |
---|
511 | #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) |
---|
512 | #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) |
---|
513 | #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) |
---|
514 | #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) |
---|
515 | |
---|
516 | #define DELETE2_SIGNAL(sig, x1,x2, size) \ |
---|
517 | { \ |
---|
518 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
519 | { \ |
---|
520 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
521 | { \ |
---|
522 | if (size > 0) \ |
---|
523 | { \ |
---|
524 | delete sig[it1][it2]; \ |
---|
525 | } \ |
---|
526 | } \ |
---|
527 | delete [] sig[it1]; \ |
---|
528 | } \ |
---|
529 | delete [] sig; \ |
---|
530 | } |
---|
531 | |
---|
532 | #define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2) \ |
---|
533 | sc_signal<type> *** sig = new sc_signal<type> ** [x1]; \ |
---|
534 | { \ |
---|
535 | std::string separator="_"; \ |
---|
536 | std::string str; \ |
---|
537 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
538 | { \ |
---|
539 | sig [it1] = new sc_signal<type> * [x2]; \ |
---|
540 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
541 | { \ |
---|
542 | str = name+separator+toString(it1)+separator+toString(it2); \ |
---|
543 | sig [it1][it2] = new sc_signal<type> (str.c_str()); \ |
---|
544 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2]); \ |
---|
545 | } \ |
---|
546 | } \ |
---|
547 | } |
---|
548 | |
---|
549 | #define INSTANCE2_SC_SIGNAL(component, sig, x1, x2) \ |
---|
550 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
551 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
552 | { \ |
---|
553 | TEST_SIGNAL(component->sig [it1][it2]->name(),component->sig [it1][it2]); \ |
---|
554 | TEST_SIGNAL(sig [it1][it2]->name(),sig [it1][it2]); \ |
---|
555 | (*(component->sig[it1][it2])) (*(sig[it1][it2])); \ |
---|
556 | } |
---|
557 | |
---|
558 | #define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2) \ |
---|
559 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
560 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
561 | { \ |
---|
562 | TEST_SIGNAL(component->sig1 [it1][it2]->name(),component->sig1 [it1][it2]); \ |
---|
563 | TEST_SIGNAL(sig2 [it1][it2]->name(),sig2 [it1][it2]); \ |
---|
564 | (*(component->sig1[it1][it2])) (*(sig2[it1][it2])); \ |
---|
565 | } |
---|
566 | |
---|
567 | #define DELETE2_SC_SIGNAL(sig,x1,x2) \ |
---|
568 | { \ |
---|
569 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
570 | { \ |
---|
571 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
572 | { \ |
---|
573 | delete sig[it1][it2]; \ |
---|
574 | } \ |
---|
575 | delete [] sig[it1]; \ |
---|
576 | } \ |
---|
577 | delete [] sig; \ |
---|
578 | } |
---|
579 | |
---|
580 | // ---------------------------------------------------------------------- |
---|
581 | // -----[ ITERATION 3 ]-------------------------------------------------- |
---|
582 | // ---------------------------------------------------------------------- |
---|
583 | |
---|
584 | #ifdef POSITION |
---|
585 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
586 | INTERFACE_PRINT(name); \ |
---|
587 | uint32_t iterator_1 = 0; \ |
---|
588 | uint32_t iterator_2 = 0; \ |
---|
589 | uint32_t iterator_3 = 0; \ |
---|
590 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
591 | { \ |
---|
592 | std::string separator="_"; \ |
---|
593 | iterator_1 = x1; \ |
---|
594 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
595 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
596 | { \ |
---|
597 | iterator_2 = x2; \ |
---|
598 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
599 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
600 | { \ |
---|
601 | iterator_3 = x3; \ |
---|
602 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
603 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
604 | { \ |
---|
605 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \ |
---|
606 | } \ |
---|
607 | } \ |
---|
608 | } \ |
---|
609 | } |
---|
610 | #else |
---|
611 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
612 | INTERFACE_PRINT(name); \ |
---|
613 | uint32_t iterator_1 = 0; \ |
---|
614 | uint32_t iterator_2 = 0; \ |
---|
615 | uint32_t iterator_3 = 0; \ |
---|
616 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
617 | { \ |
---|
618 | std::string separator="_"; \ |
---|
619 | iterator_1 = x1; \ |
---|
620 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
621 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
622 | { \ |
---|
623 | iterator_2 = x2; \ |
---|
624 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
625 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
626 | { \ |
---|
627 | iterator_3 = x3; \ |
---|
628 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
629 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
630 | { \ |
---|
631 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3)); \ |
---|
632 | } \ |
---|
633 | } \ |
---|
634 | } \ |
---|
635 | } |
---|
636 | #endif |
---|
637 | |
---|
638 | #define ALLOC3_INTERFACE_END(x1, x2, x3) \ |
---|
639 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
640 | { \ |
---|
641 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
642 | delete interface [it1][it2]; \ |
---|
643 | delete [] interface [it1]; \ |
---|
644 | } \ |
---|
645 | delete [] interface; |
---|
646 | |
---|
647 | // #define _ALLOC3_VAL_ACK_IN( sig, name, type, x1, x2, x3) |
---|
648 | // #define _ALLOC3_VAL_ACK_OUT( sig, name, type, x1, x2, x3) |
---|
649 | |
---|
650 | #define _ALLOC3_VALACK_IN( sig,type, x1, x2, x3) \ |
---|
651 | { \ |
---|
652 | sig = new SC_IN (Tcontrol_t) *** [x1]; \ |
---|
653 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
654 | { \ |
---|
655 | sig [it1] = new SC_IN (Tcontrol_t) ** [x2]; \ |
---|
656 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
657 | { \ |
---|
658 | sig [it1][it2] = new SC_IN (Tcontrol_t) * [x3]; \ |
---|
659 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
660 | { \ |
---|
661 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_in (type); \ |
---|
662 | } \ |
---|
663 | } \ |
---|
664 | } \ |
---|
665 | } |
---|
666 | |
---|
667 | #define _ALLOC3_VALACK_OUT( sig,type, x1, x2, x3) \ |
---|
668 | { \ |
---|
669 | sig = new SC_OUT (Tcontrol_t) *** [x1]; \ |
---|
670 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
671 | { \ |
---|
672 | sig [it1] = new SC_OUT (Tcontrol_t) ** [x2]; \ |
---|
673 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
674 | { \ |
---|
675 | sig [it1][it2] = new SC_OUT (Tcontrol_t) * [x3]; \ |
---|
676 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
677 | { \ |
---|
678 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_out (type); \ |
---|
679 | } \ |
---|
680 | } \ |
---|
681 | } \ |
---|
682 | } |
---|
683 | |
---|
684 | |
---|
685 | #define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3) \ |
---|
686 | { \ |
---|
687 | sig = new SC_IN (type) *** [x1]; \ |
---|
688 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
689 | { \ |
---|
690 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
691 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
692 | { \ |
---|
693 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
694 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
695 | { \ |
---|
696 | if (size > 0) \ |
---|
697 | { \ |
---|
698 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_in <type> (name, size); \ |
---|
699 | } \ |
---|
700 | else \ |
---|
701 | { \ |
---|
702 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
703 | } \ |
---|
704 | } \ |
---|
705 | } \ |
---|
706 | } \ |
---|
707 | } |
---|
708 | |
---|
709 | #define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3) \ |
---|
710 | { \ |
---|
711 | sig = new SC_OUT (type) *** [x1]; \ |
---|
712 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
713 | { \ |
---|
714 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
715 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
716 | { \ |
---|
717 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
718 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
719 | { \ |
---|
720 | if (size > 0) \ |
---|
721 | { \ |
---|
722 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_out <type> (name, size); \ |
---|
723 | } \ |
---|
724 | else \ |
---|
725 | { \ |
---|
726 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
727 | } \ |
---|
728 | } \ |
---|
729 | } \ |
---|
730 | } \ |
---|
731 | } |
---|
732 | |
---|
733 | // #define ALLOC3_VAL_ACK_IN( sig, name, type ) _ALLOC3_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
734 | // #define ALLOC3_VAL_ACK_OUT(sig, name, type ) _ALLOC3_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
735 | #define ALLOC3_VALACK_IN( sig, type ) _ALLOC3_VALACK_IN( sig, type , iterator_1, iterator_2, iterator_3) |
---|
736 | #define ALLOC3_VALACK_OUT( sig, type ) _ALLOC3_VALACK_OUT( sig, type , iterator_1, iterator_2, iterator_3) |
---|
737 | #define ALLOC3_SIGNAL_IN( sig, name, type, size) _ALLOC3_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
738 | #define ALLOC3_SIGNAL_OUT( sig, name, type, size) _ALLOC3_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
739 | |
---|
740 | #define DELETE3_SIGNAL(sig, x1, x2, x3, size) \ |
---|
741 | { \ |
---|
742 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
743 | { \ |
---|
744 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
745 | { \ |
---|
746 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
747 | { \ |
---|
748 | if (size > 0) \ |
---|
749 | { \ |
---|
750 | delete sig[it1][it2][it3]; \ |
---|
751 | } \ |
---|
752 | } \ |
---|
753 | delete [] sig[it1][it2]; \ |
---|
754 | } \ |
---|
755 | delete [] sig[it1]; \ |
---|
756 | } \ |
---|
757 | delete [] sig; \ |
---|
758 | } |
---|
759 | |
---|
760 | #define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3) \ |
---|
761 | sc_signal<type> **** sig = new sc_signal<type> *** [x1]; \ |
---|
762 | { \ |
---|
763 | std::string separator="_"; \ |
---|
764 | std::string str; \ |
---|
765 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
766 | { \ |
---|
767 | sig [it1] = new sc_signal<type> ** [x2]; \ |
---|
768 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
769 | { \ |
---|
770 | sig [it1][it2] = new sc_signal<type> * [x3]; \ |
---|
771 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
772 | { \ |
---|
773 | str = name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3); \ |
---|
774 | sig [it1][it2][it3] = new sc_signal<type> (str.c_str()); \ |
---|
775 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2][it3]); \ |
---|
776 | } \ |
---|
777 | } \ |
---|
778 | } \ |
---|
779 | } |
---|
780 | |
---|
781 | #define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3) \ |
---|
782 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
783 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
784 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
785 | { \ |
---|
786 | TEST_SIGNAL(component->sig [it1][it2][it3]->name(),component->sig [it1][it2][it3]); \ |
---|
787 | TEST_SIGNAL(sig [it1][it2][it3]->name(),sig [it1][it2][it3]); \ |
---|
788 | (*(component->sig[it1][it2][it3])) (*(sig[it1][it2][it3])); \ |
---|
789 | } |
---|
790 | |
---|
791 | #define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3) \ |
---|
792 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
793 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
794 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
795 | { \ |
---|
796 | TEST_SIGNAL(component->sig1 [it1][it2][it3]->name(),component->sig1 [it1][it2][it3]); \ |
---|
797 | TEST_SIGNAL(sig2 [it1][it2][it3]->name(),sig2 [it1][it2][it3]); \ |
---|
798 | (*(component->sig1[it1][it2][it3])) (*(sig2[it1][it2][it3])); \ |
---|
799 | } |
---|
800 | |
---|
801 | #define DELETE3_SC_SIGNAL(sig,x1,x2,x3) \ |
---|
802 | { \ |
---|
803 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
804 | { \ |
---|
805 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
806 | { \ |
---|
807 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
808 | { \ |
---|
809 | delete sig[it1][it2][it3]; \ |
---|
810 | } \ |
---|
811 | delete [] sig[it1][it2]; \ |
---|
812 | } \ |
---|
813 | delete [] sig[it1]; \ |
---|
814 | } \ |
---|
815 | delete [] sig; \ |
---|
816 | } |
---|
817 | |
---|
818 | #endif |
---|