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