1 | #ifndef morpheo_behavioural_Allocation_h |
---|
2 | #define morpheo_behavioural_Allocation_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id: Allocation.h 113 2009-04-14 18:39:12Z 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 | #define INSTANCE_FOREIGN_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__); |
---|
104 | |
---|
105 | // ---------------------------------------------------------------------- |
---|
106 | // -----[ NO ITERATION ]------------------------------------------------- |
---|
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_FOREIGN_SIGNAL_IN( sig, interface, name, type, size) \ |
---|
169 | if (size > 0) \ |
---|
170 | { \ |
---|
171 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \ |
---|
172 | sig = new SC_IN (type) (str.c_str()); \ |
---|
173 | } |
---|
174 | |
---|
175 | #define ALLOC0_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size) \ |
---|
176 | if (size > 0) \ |
---|
177 | { \ |
---|
178 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \ |
---|
179 | sig = new SC_OUT (type) (str.c_str()); \ |
---|
180 | } |
---|
181 | |
---|
182 | #define DELETE0_FOREIGN_SIGNAL( sig, size) \ |
---|
183 | { \ |
---|
184 | DELETE0_SIGNAL(sig,size); \ |
---|
185 | } |
---|
186 | |
---|
187 | #define INSTANCE0_FOREIGN_SIGNAL(component, sig, type, name, size) \ |
---|
188 | if (size > 0) \ |
---|
189 | { \ |
---|
190 | INSTANCE_FOREIGN_PRINT(name); \ |
---|
191 | _component->set_sc_signal<type>(_name,name,static_cast<void*>(component->sig)); \ |
---|
192 | } |
---|
193 | |
---|
194 | #define ALLOC0_SC_SIGNAL( sig, name, type) \ |
---|
195 | sig = new sc_signal<type> (name); \ |
---|
196 | PRINT_SIGNAL_ADDRESS(name,sig); |
---|
197 | |
---|
198 | #define INSTANCE0_SC_SIGNAL(component, sig) \ |
---|
199 | { \ |
---|
200 | TEST_SIGNAL(component->sig->name(),component->sig); \ |
---|
201 | TEST_SIGNAL(sig ->name(),sig); \ |
---|
202 | (*(component->sig)) (*(sig)); \ |
---|
203 | } |
---|
204 | |
---|
205 | #define _INSTANCE0_SC_SIGNAL(component, sig1,sig2) \ |
---|
206 | { \ |
---|
207 | TEST_SIGNAL(component->sig1->name(),component->sig1); \ |
---|
208 | TEST_SIGNAL(sig2 ->name(),sig2); \ |
---|
209 | (*(component->sig1)) (*(sig2)); \ |
---|
210 | } |
---|
211 | |
---|
212 | #define DELETE0_SC_SIGNAL( sig) \ |
---|
213 | { \ |
---|
214 | PRINT_SIGNAL_ADDRESS("",sig); \ |
---|
215 | delete sig; \ |
---|
216 | } |
---|
217 | |
---|
218 | // ---------------------------------------------------------------------- |
---|
219 | // -----[ ITERATION 1 ]-------------------------------------------------- |
---|
220 | // ---------------------------------------------------------------------- |
---|
221 | |
---|
222 | #define __ALLOC1_INTERFACE_BEGIN(name, x1) \ |
---|
223 | INTERFACE_PRINT(name); \ |
---|
224 | const std::string interface_name = name; \ |
---|
225 | const uint32_t iterator_1 = x1; |
---|
226 | |
---|
227 | #define __ALLOC1_INTERFACE_END(x1) |
---|
228 | |
---|
229 | #define __ALLOC1_SIGNAL_IN( sig, name, type) \ |
---|
230 | { \ |
---|
231 | sig = new SC_IN(type) * [iterator_1]; \ |
---|
232 | std::string separator="_"; \ |
---|
233 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
234 | { \ |
---|
235 | std::string str = "in_"+interface_name+separator+toString(it1)+separator+name; \ |
---|
236 | sig [it1] = new SC_IN(type) (str.c_str()); \ |
---|
237 | } \ |
---|
238 | } |
---|
239 | |
---|
240 | #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ |
---|
241 | { \ |
---|
242 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
243 | std::string separator="_"; \ |
---|
244 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
245 | { \ |
---|
246 | std::string str = "out_"+interface_name+separator+toString(it1)+separator+name; \ |
---|
247 | sig [it1] = new SC_OUT(type) (str.c_str()); \ |
---|
248 | } \ |
---|
249 | } |
---|
250 | |
---|
251 | #ifdef POSITION |
---|
252 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
253 | INTERFACE_PRINT(name); \ |
---|
254 | const uint32_t iterator_1 = x1; \ |
---|
255 | morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ |
---|
256 | { \ |
---|
257 | std::string separator="_"; \ |
---|
258 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
259 | { \ |
---|
260 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1), direction, localisation, str); \ |
---|
261 | } \ |
---|
262 | } |
---|
263 | #else |
---|
264 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
265 | INTERFACE_PRINT(name); \ |
---|
266 | const uint32_t iterator_1 = x1; \ |
---|
267 | morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ |
---|
268 | { \ |
---|
269 | std::string separator="_"; \ |
---|
270 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
271 | { \ |
---|
272 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1)); \ |
---|
273 | } \ |
---|
274 | } |
---|
275 | #endif |
---|
276 | |
---|
277 | #define ALLOC1_INTERFACE_END(x1) |
---|
278 | |
---|
279 | #define ALLOC1_VAL_ACK_IN( sig, name, type) \ |
---|
280 | { \ |
---|
281 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
282 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
283 | { \ |
---|
284 | sig [it1] = interface[it1]->set_signal_valack_in (name, type); \ |
---|
285 | } \ |
---|
286 | } |
---|
287 | #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ |
---|
288 | { \ |
---|
289 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
290 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
291 | { \ |
---|
292 | sig [it1] = interface[it1]->set_signal_valack_out(name, type); \ |
---|
293 | } \ |
---|
294 | } |
---|
295 | #define ALLOC1_VALACK_IN( sig, type) \ |
---|
296 | { \ |
---|
297 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
298 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
299 | { \ |
---|
300 | sig [it1] = interface[it1]->set_signal_valack_in (type); \ |
---|
301 | } \ |
---|
302 | } |
---|
303 | #define ALLOC1_VALACK_OUT( sig, type) \ |
---|
304 | { \ |
---|
305 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
306 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
307 | { \ |
---|
308 | sig [it1] = interface[it1]->set_signal_valack_out(type); \ |
---|
309 | } \ |
---|
310 | } |
---|
311 | #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ |
---|
312 | { \ |
---|
313 | sig = new SC_IN (type) * [iterator_1]; \ |
---|
314 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
315 | { \ |
---|
316 | if (size > 0) \ |
---|
317 | { \ |
---|
318 | sig [it1] = interface[it1]->set_signal_in <type> (name, size); \ |
---|
319 | } \ |
---|
320 | else \ |
---|
321 | { \ |
---|
322 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
323 | } \ |
---|
324 | } \ |
---|
325 | } |
---|
326 | |
---|
327 | #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ |
---|
328 | { \ |
---|
329 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
330 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
331 | { \ |
---|
332 | if (size > 0) \ |
---|
333 | { \ |
---|
334 | sig [it1] = interface[it1]->set_signal_out<type> (name, size); \ |
---|
335 | } \ |
---|
336 | else \ |
---|
337 | { \ |
---|
338 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
339 | } \ |
---|
340 | } \ |
---|
341 | } |
---|
342 | |
---|
343 | #define DELETE1_SIGNAL(sig, x1, size) \ |
---|
344 | { \ |
---|
345 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
346 | { \ |
---|
347 | if (size > 0) \ |
---|
348 | { \ |
---|
349 | delete sig[it1]; \ |
---|
350 | } \ |
---|
351 | } \ |
---|
352 | delete [] sig; \ |
---|
353 | } |
---|
354 | |
---|
355 | #define ALLOC1_FOREIGN_SIGNAL_IN(sig, interface, name, type, size,x1) \ |
---|
356 | { \ |
---|
357 | sig = new SC_IN (type) * [x1]; \ |
---|
358 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
359 | if (size > 0) \ |
---|
360 | { \ |
---|
361 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ |
---|
362 | sig [it1] = new SC_IN (type) (str.c_str()); \ |
---|
363 | } \ |
---|
364 | } |
---|
365 | |
---|
366 | #define ALLOC1_FOREIGN_SIGNAL_OUT(sig, interface, name, type, size,x1) \ |
---|
367 | { \ |
---|
368 | sig = new SC_OUT (type) * [x1]; \ |
---|
369 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
370 | if (size > 0) \ |
---|
371 | { \ |
---|
372 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ |
---|
373 | sig [it1] = new SC_OUT (type) (str.c_str()); \ |
---|
374 | } \ |
---|
375 | } |
---|
376 | |
---|
377 | #define DELETE1_FOREIGN_SIGNAL( sig, size,x1) \ |
---|
378 | { \ |
---|
379 | DELETE1_SIGNAL(sig,x1,size); \ |
---|
380 | } |
---|
381 | |
---|
382 | #define ALLOC1_SC_SIGNAL( sig, name, type, x1) \ |
---|
383 | sig = new sc_signal<type> * [x1]; \ |
---|
384 | { \ |
---|
385 | std::string separator="_"; \ |
---|
386 | std::string str; \ |
---|
387 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
388 | { \ |
---|
389 | str = name+separator+toString(it1); \ |
---|
390 | sig [it1] = new sc_signal<type> (str.c_str()); \ |
---|
391 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1]); \ |
---|
392 | } \ |
---|
393 | } |
---|
394 | |
---|
395 | #define INSTANCE1_SC_SIGNAL(component, sig, x1) \ |
---|
396 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
397 | { \ |
---|
398 | TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \ |
---|
399 | TEST_SIGNAL(sig [it1]->name(),sig [it1]); \ |
---|
400 | (*(component->sig[it1])) (*(sig[it1])); \ |
---|
401 | } |
---|
402 | |
---|
403 | #define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1) \ |
---|
404 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
405 | { \ |
---|
406 | TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \ |
---|
407 | TEST_SIGNAL(sig2 [it1]->name(),sig2 [it1]); \ |
---|
408 | (*(component->sig1[it1])) (*(sig2[it1])); \ |
---|
409 | } |
---|
410 | |
---|
411 | #define DELETE1_SC_SIGNAL(sig, x1) \ |
---|
412 | { \ |
---|
413 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
414 | { \ |
---|
415 | PRINT_SIGNAL_ADDRESS("",sig[it1]); \ |
---|
416 | delete sig[it1]; \ |
---|
417 | } \ |
---|
418 | delete [] sig; \ |
---|
419 | } |
---|
420 | |
---|
421 | // ---------------------------------------------------------------------- |
---|
422 | // -----[ ITERATION 2 ]-------------------------------------------------- |
---|
423 | // ---------------------------------------------------------------------- |
---|
424 | |
---|
425 | #ifdef POSITION |
---|
426 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
427 | INTERFACE_PRINT(name); \ |
---|
428 | uint32_t iterator_1 = 0; \ |
---|
429 | uint32_t iterator_2 = 0; \ |
---|
430 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
431 | { \ |
---|
432 | std::string separator="_"; \ |
---|
433 | iterator_1 = x1; \ |
---|
434 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
435 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
436 | { \ |
---|
437 | iterator_2 = x2; \ |
---|
438 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
439 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
440 | { \ |
---|
441 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2), direction, localisation, str); \ |
---|
442 | } \ |
---|
443 | } \ |
---|
444 | } |
---|
445 | #else |
---|
446 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
447 | INTERFACE_PRINT(name); \ |
---|
448 | uint32_t iterator_1 = 0; \ |
---|
449 | uint32_t iterator_2 = 0; \ |
---|
450 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
451 | { \ |
---|
452 | std::string separator="_"; \ |
---|
453 | iterator_1 = x1; \ |
---|
454 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
455 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
456 | { \ |
---|
457 | iterator_2 = x2; \ |
---|
458 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
459 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
460 | { \ |
---|
461 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)); \ |
---|
462 | } \ |
---|
463 | } \ |
---|
464 | } |
---|
465 | #endif |
---|
466 | |
---|
467 | #define ALLOC2_INTERFACE_END(x1, x2) \ |
---|
468 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
469 | delete interface [it1]; \ |
---|
470 | delete [] interface; |
---|
471 | |
---|
472 | #define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2) \ |
---|
473 | { \ |
---|
474 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
475 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
476 | { \ |
---|
477 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
478 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
479 | { \ |
---|
480 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (name, type); \ |
---|
481 | } \ |
---|
482 | } \ |
---|
483 | } |
---|
484 | |
---|
485 | #define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2) \ |
---|
486 | { \ |
---|
487 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
488 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
489 | { \ |
---|
490 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
491 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
492 | { \ |
---|
493 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (name, type); \ |
---|
494 | } \ |
---|
495 | } \ |
---|
496 | } |
---|
497 | |
---|
498 | #define _ALLOC2_VALACK_IN( sig,type, x1, x2) \ |
---|
499 | { \ |
---|
500 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
501 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
502 | { \ |
---|
503 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
504 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
505 | { \ |
---|
506 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (type); \ |
---|
507 | } \ |
---|
508 | } \ |
---|
509 | } |
---|
510 | |
---|
511 | #define _ALLOC2_VALACK_OUT( sig,type, x1, x2) \ |
---|
512 | { \ |
---|
513 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
514 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
515 | { \ |
---|
516 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
517 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
518 | { \ |
---|
519 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (type); \ |
---|
520 | } \ |
---|
521 | } \ |
---|
522 | } |
---|
523 | |
---|
524 | #define _ALLOC2_SIGNAL_IN( sig, name, type, size, x1, x2) \ |
---|
525 | { \ |
---|
526 | sig = new SC_IN (type) ** [x1]; \ |
---|
527 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
528 | { \ |
---|
529 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
530 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
531 | { \ |
---|
532 | if (size > 0) \ |
---|
533 | { \ |
---|
534 | sig [it1][it2] = interface[it1][it2]->set_signal_in <type> (name, size); \ |
---|
535 | } \ |
---|
536 | else \ |
---|
537 | { \ |
---|
538 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
539 | } \ |
---|
540 | } \ |
---|
541 | } \ |
---|
542 | } |
---|
543 | |
---|
544 | #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, x1, x2) \ |
---|
545 | { \ |
---|
546 | sig = new SC_OUT (type) ** [x1]; \ |
---|
547 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
548 | { \ |
---|
549 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
550 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
551 | { \ |
---|
552 | if (size > 0) \ |
---|
553 | { \ |
---|
554 | sig [it1][it2] = interface[it1][it2]->set_signal_out <type> (name, size); \ |
---|
555 | } \ |
---|
556 | else \ |
---|
557 | { \ |
---|
558 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
559 | } \ |
---|
560 | } \ |
---|
561 | } \ |
---|
562 | } |
---|
563 | |
---|
564 | #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) |
---|
565 | #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) |
---|
566 | #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) |
---|
567 | #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) |
---|
568 | #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) |
---|
569 | #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) |
---|
570 | |
---|
571 | #define DELETE2_SIGNAL(sig, x1,x2, size) \ |
---|
572 | { \ |
---|
573 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
574 | { \ |
---|
575 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
576 | { \ |
---|
577 | if (size > 0) \ |
---|
578 | { \ |
---|
579 | delete sig[it1][it2]; \ |
---|
580 | } \ |
---|
581 | } \ |
---|
582 | delete [] sig[it1]; \ |
---|
583 | } \ |
---|
584 | delete [] sig; \ |
---|
585 | } |
---|
586 | |
---|
587 | |
---|
588 | #define ALLOC2_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2) \ |
---|
589 | { \ |
---|
590 | sig = new SC_IN (type) ** [x1]; \ |
---|
591 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
592 | { \ |
---|
593 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
594 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
595 | if (size > 0) \ |
---|
596 | { \ |
---|
597 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ |
---|
598 | sig [it1][it2] = new SC_IN (type) (str.c_str()); \ |
---|
599 | } \ |
---|
600 | } \ |
---|
601 | } |
---|
602 | |
---|
603 | #define ALLOC2_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2) \ |
---|
604 | { \ |
---|
605 | sig = new SC_OUT (type) ** [x1]; \ |
---|
606 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
607 | { \ |
---|
608 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
609 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
610 | if (size > 0) \ |
---|
611 | { \ |
---|
612 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ |
---|
613 | sig [it1][it2] = new SC_IN (type) (str.c_str()); \ |
---|
614 | } \ |
---|
615 | } \ |
---|
616 | } |
---|
617 | |
---|
618 | #define DELETE2_FOREIGN_SIGNAL( sig, size,x1,x2) \ |
---|
619 | { \ |
---|
620 | DELETE2_SIGNAL(sig,x1,x2,size); \ |
---|
621 | } |
---|
622 | |
---|
623 | #define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2) \ |
---|
624 | sig = new sc_signal<type> ** [x1]; \ |
---|
625 | { \ |
---|
626 | std::string separator="_"; \ |
---|
627 | std::string str; \ |
---|
628 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
629 | { \ |
---|
630 | sig [it1] = new sc_signal<type> * [x2]; \ |
---|
631 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
632 | { \ |
---|
633 | str = name+separator+toString(it1)+separator+toString(it2); \ |
---|
634 | sig [it1][it2] = new sc_signal<type> (str.c_str()); \ |
---|
635 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2]); \ |
---|
636 | } \ |
---|
637 | } \ |
---|
638 | } |
---|
639 | |
---|
640 | #define INSTANCE2_SC_SIGNAL(component, sig, x1, x2) \ |
---|
641 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
642 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
643 | { \ |
---|
644 | TEST_SIGNAL(component->sig [it1][it2]->name(),component->sig [it1][it2]); \ |
---|
645 | TEST_SIGNAL(sig [it1][it2]->name(),sig [it1][it2]); \ |
---|
646 | (*(component->sig[it1][it2])) (*(sig[it1][it2])); \ |
---|
647 | } |
---|
648 | |
---|
649 | #define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2) \ |
---|
650 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
651 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
652 | { \ |
---|
653 | TEST_SIGNAL(component->sig1 [it1][it2]->name(),component->sig1 [it1][it2]); \ |
---|
654 | TEST_SIGNAL(sig2 [it1][it2]->name(),sig2 [it1][it2]); \ |
---|
655 | (*(component->sig1[it1][it2])) (*(sig2[it1][it2])); \ |
---|
656 | } |
---|
657 | |
---|
658 | #define DELETE2_SC_SIGNAL(sig,x1,x2) \ |
---|
659 | { \ |
---|
660 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
661 | { \ |
---|
662 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
663 | { \ |
---|
664 | PRINT_SIGNAL_ADDRESS("",sig[it1][it2]); \ |
---|
665 | delete sig[it1][it2]; \ |
---|
666 | } \ |
---|
667 | delete [] sig[it1]; \ |
---|
668 | } \ |
---|
669 | delete [] sig; \ |
---|
670 | } |
---|
671 | |
---|
672 | // ---------------------------------------------------------------------- |
---|
673 | // -----[ ITERATION 3 ]-------------------------------------------------- |
---|
674 | // ---------------------------------------------------------------------- |
---|
675 | |
---|
676 | #ifdef POSITION |
---|
677 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
678 | INTERFACE_PRINT(name); \ |
---|
679 | uint32_t iterator_1 = 0; \ |
---|
680 | uint32_t iterator_2 = 0; \ |
---|
681 | uint32_t iterator_3 = 0; \ |
---|
682 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
683 | { \ |
---|
684 | std::string separator="_"; \ |
---|
685 | iterator_1 = x1; \ |
---|
686 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
687 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
688 | { \ |
---|
689 | iterator_2 = x2; \ |
---|
690 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
691 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
692 | { \ |
---|
693 | iterator_3 = x3; \ |
---|
694 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
695 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
696 | { \ |
---|
697 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \ |
---|
698 | } \ |
---|
699 | } \ |
---|
700 | } \ |
---|
701 | } |
---|
702 | #else |
---|
703 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
704 | INTERFACE_PRINT(name); \ |
---|
705 | uint32_t iterator_1 = 0; \ |
---|
706 | uint32_t iterator_2 = 0; \ |
---|
707 | uint32_t iterator_3 = 0; \ |
---|
708 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
709 | { \ |
---|
710 | std::string separator="_"; \ |
---|
711 | iterator_1 = x1; \ |
---|
712 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
713 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
714 | { \ |
---|
715 | iterator_2 = x2; \ |
---|
716 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
717 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
718 | { \ |
---|
719 | iterator_3 = x3; \ |
---|
720 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
721 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
722 | { \ |
---|
723 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3)); \ |
---|
724 | } \ |
---|
725 | } \ |
---|
726 | } \ |
---|
727 | } |
---|
728 | #endif |
---|
729 | |
---|
730 | #define ALLOC3_INTERFACE_END(x1, x2, x3) \ |
---|
731 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
732 | { \ |
---|
733 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
734 | delete interface [it1][it2]; \ |
---|
735 | delete [] interface [it1]; \ |
---|
736 | } \ |
---|
737 | delete [] interface; |
---|
738 | |
---|
739 | // #define _ALLOC3_VAL_ACK_IN( sig, name, type, x1, x2, x3) |
---|
740 | // #define _ALLOC3_VAL_ACK_OUT( sig, name, type, x1, x2, x3) |
---|
741 | |
---|
742 | #define _ALLOC3_VALACK_IN( sig,type, x1, x2, x3) \ |
---|
743 | { \ |
---|
744 | sig = new SC_IN (Tcontrol_t) *** [x1]; \ |
---|
745 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
746 | { \ |
---|
747 | sig [it1] = new SC_IN (Tcontrol_t) ** [x2]; \ |
---|
748 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
749 | { \ |
---|
750 | sig [it1][it2] = new SC_IN (Tcontrol_t) * [x3]; \ |
---|
751 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
752 | { \ |
---|
753 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_in (type); \ |
---|
754 | } \ |
---|
755 | } \ |
---|
756 | } \ |
---|
757 | } |
---|
758 | |
---|
759 | #define _ALLOC3_VALACK_OUT( sig,type, x1, x2, x3) \ |
---|
760 | { \ |
---|
761 | sig = new SC_OUT (Tcontrol_t) *** [x1]; \ |
---|
762 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
763 | { \ |
---|
764 | sig [it1] = new SC_OUT (Tcontrol_t) ** [x2]; \ |
---|
765 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
766 | { \ |
---|
767 | sig [it1][it2] = new SC_OUT (Tcontrol_t) * [x3]; \ |
---|
768 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
769 | { \ |
---|
770 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_out (type); \ |
---|
771 | } \ |
---|
772 | } \ |
---|
773 | } \ |
---|
774 | } |
---|
775 | |
---|
776 | |
---|
777 | #define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3) \ |
---|
778 | { \ |
---|
779 | sig = new SC_IN (type) *** [x1]; \ |
---|
780 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
781 | { \ |
---|
782 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
783 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
784 | { \ |
---|
785 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
786 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
787 | { \ |
---|
788 | if (size > 0) \ |
---|
789 | { \ |
---|
790 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_in <type> (name, size); \ |
---|
791 | } \ |
---|
792 | else \ |
---|
793 | { \ |
---|
794 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
795 | } \ |
---|
796 | } \ |
---|
797 | } \ |
---|
798 | } \ |
---|
799 | } |
---|
800 | |
---|
801 | #define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3) \ |
---|
802 | { \ |
---|
803 | sig = new SC_OUT (type) *** [x1]; \ |
---|
804 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
805 | { \ |
---|
806 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
807 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
808 | { \ |
---|
809 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
810 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
811 | { \ |
---|
812 | if (size > 0) \ |
---|
813 | { \ |
---|
814 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_out <type> (name, size); \ |
---|
815 | } \ |
---|
816 | else \ |
---|
817 | { \ |
---|
818 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
819 | } \ |
---|
820 | } \ |
---|
821 | } \ |
---|
822 | } \ |
---|
823 | } |
---|
824 | |
---|
825 | // #define ALLOC3_VAL_ACK_IN( sig, name, type ) _ALLOC3_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
826 | // #define ALLOC3_VAL_ACK_OUT(sig, name, type ) _ALLOC3_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
827 | #define ALLOC3_VALACK_IN( sig, type ) _ALLOC3_VALACK_IN( sig, type , iterator_1, iterator_2, iterator_3) |
---|
828 | #define ALLOC3_VALACK_OUT( sig, type ) _ALLOC3_VALACK_OUT( sig, type , iterator_1, iterator_2, iterator_3) |
---|
829 | #define ALLOC3_SIGNAL_IN( sig, name, type, size) _ALLOC3_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
830 | #define ALLOC3_SIGNAL_OUT( sig, name, type, size) _ALLOC3_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
831 | |
---|
832 | #define DELETE3_SIGNAL(sig, x1, x2, x3, size) \ |
---|
833 | { \ |
---|
834 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
835 | { \ |
---|
836 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
837 | { \ |
---|
838 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
839 | { \ |
---|
840 | if (size > 0) \ |
---|
841 | { \ |
---|
842 | delete sig[it1][it2][it3]; \ |
---|
843 | } \ |
---|
844 | } \ |
---|
845 | delete [] sig[it1][it2]; \ |
---|
846 | } \ |
---|
847 | delete [] sig[it1]; \ |
---|
848 | } \ |
---|
849 | delete [] sig; \ |
---|
850 | } |
---|
851 | |
---|
852 | #define ALLOC3_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2,x3) \ |
---|
853 | { \ |
---|
854 | sig = new SC_IN (type) *** [x1]; \ |
---|
855 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
856 | { \ |
---|
857 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
858 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
859 | { \ |
---|
860 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
861 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
862 | if (size > 0) \ |
---|
863 | { \ |
---|
864 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ |
---|
865 | sig [it1][it2][it3] = new SC_IN (type) (str.c_str()); \ |
---|
866 | } \ |
---|
867 | } \ |
---|
868 | } \ |
---|
869 | } |
---|
870 | |
---|
871 | #define ALLOC3_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2,x3) \ |
---|
872 | { \ |
---|
873 | sig = new SC_OUT (type) *** [x1]; \ |
---|
874 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
875 | { \ |
---|
876 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
877 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
878 | { \ |
---|
879 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
880 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
881 | if (size > 0) \ |
---|
882 | { \ |
---|
883 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ |
---|
884 | sig [it1][it2][it3] = new SC_OUT(type) (str.c_str()); \ |
---|
885 | } \ |
---|
886 | } \ |
---|
887 | } \ |
---|
888 | } |
---|
889 | |
---|
890 | #define DELETE3_FOREIGN_SIGNAL( sig, size,x1,x2,x3) \ |
---|
891 | { \ |
---|
892 | DELETE3_SIGNAL(sig,x1,x2,x3,size); \ |
---|
893 | } |
---|
894 | |
---|
895 | #define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3) \ |
---|
896 | sig = new sc_signal<type> *** [x1]; \ |
---|
897 | { \ |
---|
898 | std::string separator="_"; \ |
---|
899 | std::string str; \ |
---|
900 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
901 | { \ |
---|
902 | sig [it1] = new sc_signal<type> ** [x2]; \ |
---|
903 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
904 | { \ |
---|
905 | sig [it1][it2] = new sc_signal<type> * [x3]; \ |
---|
906 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
907 | { \ |
---|
908 | str = name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3); \ |
---|
909 | sig [it1][it2][it3] = new sc_signal<type> (str.c_str()); \ |
---|
910 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2][it3]); \ |
---|
911 | } \ |
---|
912 | } \ |
---|
913 | } \ |
---|
914 | } |
---|
915 | |
---|
916 | #define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3) \ |
---|
917 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
918 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
919 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
920 | { \ |
---|
921 | TEST_SIGNAL(component->sig [it1][it2][it3]->name(),component->sig [it1][it2][it3]); \ |
---|
922 | TEST_SIGNAL(sig [it1][it2][it3]->name(),sig [it1][it2][it3]); \ |
---|
923 | (*(component->sig[it1][it2][it3])) (*(sig[it1][it2][it3])); \ |
---|
924 | } |
---|
925 | |
---|
926 | #define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3) \ |
---|
927 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
928 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
929 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
930 | { \ |
---|
931 | TEST_SIGNAL(component->sig1 [it1][it2][it3]->name(),component->sig1 [it1][it2][it3]); \ |
---|
932 | TEST_SIGNAL(sig2 [it1][it2][it3]->name(),sig2 [it1][it2][it3]); \ |
---|
933 | (*(component->sig1[it1][it2][it3])) (*(sig2[it1][it2][it3])); \ |
---|
934 | } |
---|
935 | |
---|
936 | #define DELETE3_SC_SIGNAL(sig,x1,x2,x3) \ |
---|
937 | { \ |
---|
938 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
939 | { \ |
---|
940 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
941 | { \ |
---|
942 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
943 | { \ |
---|
944 | PRINT_SIGNAL_ADDRESS("",sig[it1][it2][it3]); \ |
---|
945 | delete sig[it1][it2][it3]; \ |
---|
946 | } \ |
---|
947 | delete [] sig[it1][it2]; \ |
---|
948 | } \ |
---|
949 | delete [] sig[it1]; \ |
---|
950 | } \ |
---|
951 | delete [] sig; \ |
---|
952 | } |
---|
953 | |
---|
954 | #endif |
---|