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