source: trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h @ 139

Last change on this file since 139 was 139, checked in by rosiere, 14 years ago
  • Add test for all configuration
  • RAT : add rat scheme (depth_save)
  • Property svn:keywords set to Id
File size: 71.2 KB
Line 
1#ifndef morpheo_behavioural_Allocation_h
2#define morpheo_behavioural_Allocation_h
3
4/*
5 * $Id: Allocation.h 139 2010-07-30 14:47:27Z 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  do                                            \
18    {                                           \
19      var = new type;                           \
20    } while (0)
21
22#define ALLOC1(var,type,s1)                     \
23  do                                            \
24    {                                           \
25      var = new type [s1];                      \
26    } while (0)
27
28#define ALLOC2(var,type,s1,s2)                   \
29  do                                             \
30    {                                            \
31      var = new type * [s1];                     \
32      for (uint32_t it1=0; it1<s1; ++it1)        \
33        {                                        \
34          var [it1] = new type [s2];             \
35        }                                        \
36    } while (0)
37
38#define ALLOC3(var,type,s1,s2,s3)                \
39  do                                             \
40    {                                            \
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            }                                    \
49        }                                        \
50    } while (0)
51
52#define ALLOC4(var,type,s1,s2,s3,s4)                    \
53  do                                                    \
54    {                                                   \
55      var = new type *** [s1];                          \
56      for (uint32_t it1=0; it1<s1; ++it1)               \
57        {                                               \
58          var [it1] = new type ** [s2];                 \
59          for (uint32_t it2=0; it2<s2; ++it2)           \
60            {                                           \
61              var [it1][it2] = new type * [s3];         \
62              for (uint32_t it3=0; it3<s3; ++it3)       \
63                {                                       \
64                  var [it1][it2][it3] = new type [s4];  \
65                }                                       \
66            }                                           \
67        }                                               \
68    } while (0)
69
70#define DELETE0(var)                            \
71  do                                            \
72    {                                           \
73      delete var;                               \
74    } while (0)
75
76#define DELETE1(var,s1)                         \
77  do                                            \
78    {                                           \
79      delete [] var;                            \
80    } while (0)
81
82#define DELETE2(var,s1,s2)                      \
83  do                                            \
84    {                                            \
85      for (uint32_t it1=0; it1<s1; ++it1)        \
86        {                                        \
87          delete [] var [it1];                   \
88        }                                        \
89      delete [] var;                             \
90    } while (0)
91
92#define DELETE3(var,s1,s2,s3)                    \
93  do                                             \
94    {                                            \
95      for (uint32_t it1=0; it1<s1; ++it1)        \
96        {                                        \
97          for (uint32_t it2=0; it2<s2; ++it2)    \
98            {                                    \
99              delete [] var [it1][it2];          \
100            }                                    \
101          delete [] var [it1];                   \
102        }                                        \
103      delete [] var;                             \
104    } while (0)
105
106#define DELETE4(var,s1,s2,s3,s4)                        \
107  do                                                    \
108    {                                                   \
109      for (uint32_t it1=0; it1<s1; ++it1)               \
110        {                                               \
111          for (uint32_t it2=0; it2<s2; ++it2)           \
112            {                                           \
113              for (uint32_t it3=0; it3<s3; ++it3)       \
114                {                                       \
115                  delete [] var [it1][it2][it3];        \
116                }                                       \
117              delete [] var [it1][it2];                 \
118            }                                           \
119          delete [] var [it1];                          \
120        }                                               \
121      delete [] var;                                    \
122    } while (0)
123
124// ======================================================================
125// =====[ ALLOCATION / DELETE of SIGNAL]=================================
126// ======================================================================
127
128// Help to allocate interface
129#define INTERFACE_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : Interface's creation : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__);
130#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__);
131#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);
132#define TEST_SIGNAL(name,address) PRINT_SIGNAL_ADDRESS(name,address); TEST_PTR(address)
133#define INSTANCE_FOREIGN_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__);
134
135// ----------------------------------------------------------------------
136// -----[ NO ITERATION ]-------------------------------------------------
137// ----------------------------------------------------------------------
138
139#define __ALLOC0_SIGNAL(sig, name, type)        \
140  do                                            \
141    {                                           \
142      sig = new type (name);                    \
143    } while (0)
144
145#ifdef POSITION
146#define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str)     \
147  INTERFACE_PRINT(name);                                                \
148  morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str);
149#else
150#define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str)     \
151  INTERFACE_PRINT(name);                                                \
152  morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name);
153#endif
154
155#define ALLOC0_INTERFACE_END()
156
157#ifdef VHDL_TESTBENCH
158#define INTERFACE0_TEST(value)                  \
159  do                                            \
160    {                                           \
161      interface->make_testbench(value);         \
162    } while(0)
163#else
164#define INTERFACE0_TEST(value)
165#endif
166
167#define ALLOC0_VAL_ACK_IN(  sig, name, type)                            \
168  do                                                                    \
169    {                                                                   \
170      sig = interface->set_signal_valack_in (name, type);               \
171    } while (0)
172
173#define ALLOC0_VAL_ACK_OUT( sig, name, type)                            \
174  do                                                                    \
175    {                                                                   \
176      sig = interface->set_signal_valack_out(name, type);               \
177    } while (0)
178                                                                 
179#define ALLOC0_VALACK_IN(     sig, type)                                \
180  do                                                                    \
181    {                                                                   \
182      sig = interface->set_signal_valack_in (type);                     \
183    } while (0)
184                                                                   
185#define ALLOC0_VALACK_OUT(    sig, type)                                \
186  do                                                                    \
187    {                                                                   \
188      sig = interface->set_signal_valack_out(type);                     \
189    } while (0)
190                                                                     
191#define ALLOC0_SIGNAL_IN(  sig, name, type, size)                       \
192  do                                                                    \
193    {                                                                   \
194      if (size > 0)                                                     \
195        {                                                               \
196          sig = interface->set_signal_in <type> (name, size);           \
197        }                                                               \
198      else                                                              \
199        {                                                               \
200          PRINT_SIZE_NUL(_component,interface,name);                    \
201        }                                                               \
202    } while (0)
203
204#define ALLOC0_SIGNAL_OUT( sig, name, type, size)                       \
205  do                                                                    \
206    {                                                                   \
207      if (size > 0)                                                     \
208        {                                                               \
209          sig = interface->set_signal_out<type> (name, size);           \
210        }                                                               \
211      else                                                              \
212        {                                                               \
213          PRINT_SIZE_NUL(_component,interface,name);                    \
214        }                                                               \
215    } while (0)
216
217#define DELETE0_SIGNAL( sig, size)                                      \
218  do                                                                    \
219    {                                                                   \
220      if (size > 0)                                                     \
221        {                                                               \
222          delete sig;                                                   \
223        }                                                               \
224    } while (0)
225
226#define ALLOC0_FOREIGN_SIGNAL_IN(  sig, interface, name, type, size)    \
227  do                                                                    \
228    {                                                                   \
229      if (size > 0)                                                     \
230        {                                                               \
231          std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \
232          sig = new SC_IN    (type) (str.c_str());                      \
233        }                                                               \
234    } while (0)
235
236#define ALLOC0_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size)    \
237  do                                                                    \
238    {                                                                   \
239      if (size > 0)                                                     \
240        {                                                               \
241          std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \
242          sig = new SC_OUT   (type) (str.c_str());                      \
243        }                                                               \
244    } while (0)
245
246#define DELETE0_FOREIGN_SIGNAL( sig, size)                              \
247  do                                                                    \
248    {                                                                   \
249      DELETE0_SIGNAL(sig,size);                                         \
250    } while (0)
251
252#define INSTANCE0_FOREIGN_SIGNAL(component, sig, type, name, size)      \
253  do                                                                    \
254    {                                                                   \
255      if (size > 0)                                                     \
256        {                                                               \
257          INSTANCE_FOREIGN_PRINT(name);                                 \
258          _component->set_sc_signal<type>(_name,name,static_cast<void*>(component->sig)); \
259        }                                                               \
260    } while (0)
261
262#define ALLOC0_SC_SIGNAL(  sig, name, type)                             \
263  do                                                                    \
264    {                                                                   \
265      sig = new sc_signal<type> (name);                                 \
266      PRINT_SIGNAL_ADDRESS(name,sig);                                   \
267    } while (0)
268
269#define INSTANCE0_SC_SIGNAL(component, sig)                             \
270  do                                                                    \
271    {                                                                   \
272      TEST_SIGNAL(component->sig->name(),component->sig);               \
273      TEST_SIGNAL(sig           ->name(),sig);                          \
274      (*(component->sig)) (*(sig));                                     \
275    } while (0)
276
277#define _INSTANCE0_SC_SIGNAL(component, sig1,sig2)                      \
278  do                                                                    \
279    {                                                                   \
280      TEST_SIGNAL(component->sig1->name(),component->sig1);             \
281      TEST_SIGNAL(sig2           ->name(),sig2);                        \
282      (*(component->sig1)) (*(sig2));                                   \
283    } while (0)
284
285#define DELETE0_SC_SIGNAL( sig)                                         \
286  do                                                                    \
287    {                                                                   \
288      PRINT_SIGNAL_ADDRESS("",sig);                                     \
289      delete sig;                                                       \
290    } while (0)
291
292// ----------------------------------------------------------------------
293// -----[ ITERATION 1 ]--------------------------------------------------
294// ----------------------------------------------------------------------
295
296#define __ALLOC1_INTERFACE_BEGIN(name, x1)                              \
297  INTERFACE_PRINT(name);                                                \
298  const std::string interface_name = name;                              \
299  const uint32_t iterator_1 = x1;
300
301#define __ALLOC1_INTERFACE_END(x1)
302
303#define __ALLOC1_SIGNAL_IN( sig, name, type)                            \
304  do                                                                    \
305    {                                                                   \
306      sig = new SC_IN(type) * [iterator_1];                             \
307      std::string separator="_";                                        \
308      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
309        {                                                               \
310          std::string str = "in_"+interface_name+separator+toString(it1)+separator+name; \
311          sig [it1] = new SC_IN(type) (str.c_str());                    \
312        }                                                               \
313    } while (0)
314
315
316#define __ALLOC1_SIGNAL_OUT( sig, name, type)                           \
317  do                                                                    \
318    {                                                                   \
319      sig = new SC_OUT(type) * [iterator_1];                            \
320      std::string separator="_";                                        \
321      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
322        {                                                               \
323          std::string str = "out_"+interface_name+separator+toString(it1)+separator+name; \
324          sig [it1] = new SC_OUT(type) (str.c_str());                   \
325        }                                                               \
326    } while (0)
327
328#ifdef POSITION
329#define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \
330  INTERFACE_PRINT(name);                                                \
331  uint32_t iterator_1 = 0;                                              \
332  morpheo::behavioural::Interface_fifo ** interface;                    \
333  {                                                                     \
334    std::string separator="_";                                          \
335    iterator_1 = x1;                                                    \
336    interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \
337    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
338      {                                                                 \
339        interface [it1] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1), direction, localisation, str); \
340      }                                                                 \
341  }
342#else
343#define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \
344  INTERFACE_PRINT(name);                                                \
345  uint32_t iterator_1 = 0;                                              \
346  morpheo::behavioural::Interface_fifo ** interface;                    \
347  {                                                                     \
348    std::string separator="_";                                          \
349    iterator_1 = x1;                                                    \
350    interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \
351    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
352      {                                                                 \
353        interface [it1] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)); \
354      }                                                                 \
355  }
356#endif
357
358#define ALLOC1_INTERFACE_END(x1)                                        \
359  do                                                                    \
360    {                                                                   \
361      delete [] interface;                                              \
362    } while (0)
363
364#ifdef VHDL_TESTBENCH
365#define INTERFACE1_TEST(value,x1)               \
366  do                                            \
367    {                                           \
368      for (uint32_t it1=0; it1<x1; it1++)       \
369        interface [it1]->make_testbench(value); \
370    } while(0)
371#else
372#define INTERFACE1_TEST(value,x1)
373#endif
374
375#define ALLOC1_VAL_ACK_IN( sig, name, type)                             \
376  do                                                                    \
377    {                                                                   \
378      sig = new SC_IN (Tcontrol_t) * [iterator_1];                      \
379      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
380        {                                                               \
381          sig [it1] = interface[it1]->set_signal_valack_in (name, type); \
382        }                                                               \
383    } while (0)
384
385#define ALLOC1_VAL_ACK_OUT(sig, name, type)                             \
386  do                                                                    \
387    {                                                                   \
388      sig = new SC_OUT(Tcontrol_t) * [iterator_1];                      \
389      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
390        {                                                               \
391          sig [it1] = interface[it1]->set_signal_valack_out(name, type); \
392        }                                                               \
393    } while (0)
394
395#define ALLOC1_VALACK_IN(    sig, type)                                 \
396  do                                                                    \
397    {                                                                   \
398      sig = new SC_IN (Tcontrol_t) * [iterator_1];                      \
399      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
400        {                                                               \
401          sig [it1] = interface[it1]->set_signal_valack_in (type);      \
402        }                                                               \
403    } while (0)
404
405#define ALLOC1_VALACK_OUT(   sig, type)                                 \
406  do                                                                    \
407    {                                                                   \
408      sig = new SC_OUT(Tcontrol_t) * [iterator_1];                      \
409      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
410        {                                                               \
411          sig [it1] = interface[it1]->set_signal_valack_out(type);      \
412        }                                                               \
413    } while (0)
414
415#define ALLOC1_SIGNAL_IN_COND( sig, name, type, size, cond)             \
416  do                                                                    \
417    {                                                                   \
418      sig = new SC_IN (type) * [iterator_1];                            \
419      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
420        {                                                               \
421          if (cond)                                                     \
422            {                                                           \
423              if (size > 0)                                             \
424                {                                                       \
425                  sig [it1] = interface[it1]->set_signal_in <type> (name, size); \
426                }                                                       \
427              else                                                      \
428                {                                                       \
429                  PRINT_SIZE_NUL(_component,interface[it1],name);       \
430                }                                                       \
431            }                                                           \
432        }                                                               \
433    } while (0)
434
435#define ALLOC1_SIGNAL_OUT_COND(sig, name, type, size, cond)             \
436  do                                                                    \
437    {                                                                   \
438      sig = new SC_OUT(type) * [iterator_1];                            \
439      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
440        {                                                               \
441          if (cond)                                                     \
442            {                                                           \
443              if (size > 0)                                             \
444                {                                                       \
445                  sig [it1] = interface[it1]->set_signal_out<type> (name, size); \
446                }                                                       \
447              else                                                      \
448                {                                                       \
449                  PRINT_SIZE_NUL(_component,interface[it1],name);       \
450                }                                                       \
451            }                                                           \
452        }                                                               \
453    } while (0)
454
455#define ALLOC1_SIGNAL_IN( sig, name, type, size) ALLOC1_SIGNAL_IN_COND( sig, name, type, size,true)
456#define ALLOC1_SIGNAL_OUT(sig, name, type, size) ALLOC1_SIGNAL_OUT_COND(sig, name, type, size,true)
457
458#define DELETE1_SIGNAL_COND(sig, x1, size, cond)                        \
459  do                                                                    \
460    {                                                                   \
461      for (uint32_t it1=0; it1<x1; it1++)                               \
462        {                                                               \
463          if (cond)                                                     \
464            {                                                           \
465              if (size > 0)                                             \
466                {                                                       \
467                  delete sig[it1];                                      \
468                }                                                       \
469            }                                                           \
470        }                                                               \
471      delete [] sig;                                                    \
472    } while (0)
473
474#define DELETE1_SIGNAL(sig, x1, size) DELETE1_SIGNAL_COND(sig, x1, size, true)
475
476#define ALLOC1_FOREIGN_SIGNAL_IN(sig, interface, name, type, size,x1)   \
477  do                                                                    \
478    {                                                                   \
479      sig = new SC_IN (type) * [x1];                                    \
480      for (uint32_t it1=0; it1<x1; it1++)                               \
481        if (size > 0)                                                   \
482          {                                                             \
483            std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \
484            sig [it1] = new SC_IN (type) (str.c_str());                 \
485          }                                                             \
486    } while (0)
487
488#define ALLOC1_FOREIGN_SIGNAL_OUT(sig, interface, name, type, size,x1)  \
489  do                                                                    \
490    {                                                                   \
491      sig = new SC_OUT (type) * [x1];                                   \
492      for (uint32_t it1=0; it1<x1; it1++)                               \
493        if (size > 0)                                                   \
494          {                                                             \
495            std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \
496            sig [it1] = new SC_OUT (type) (str.c_str());                \
497          }                                                             \
498    } while (0)
499
500#define DELETE1_FOREIGN_SIGNAL( sig, size,x1)                           \
501  do                                                                    \
502    {                                                                   \
503      DELETE1_SIGNAL(sig,x1,size);                                      \
504    } while (0)
505
506#define ALLOC1_SC_SIGNAL( sig, name, type, x1)                          \
507  do                                                                    \
508    {                                                                   \
509      sig = new sc_signal<type> * [x1];                                 \
510      {                                                                 \
511        std::string separator="_";                                      \
512        std::string str;                                                \
513        for (uint32_t it1=0; it1<x1; it1++)                             \
514          {                                                             \
515            str = name+separator+toString(it1);                         \
516            sig [it1] = new sc_signal<type> (str.c_str());              \
517            PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1]);                 \
518          }                                                             \
519      }                                                                 \
520    } while (0)
521
522#define INSTANCE1_SC_SIGNAL(component, sig, x1)                         \
523  do                                                                    \
524    {                                                                   \
525      for (uint32_t it1=0; it1<x1; it1++)                               \
526        {                                                               \
527          TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \
528          TEST_SIGNAL(sig            [it1]->name(),sig            [it1]); \
529          (*(component->sig[it1])) (*(sig[it1]));                       \
530        }                                                               \
531    } while (0)
532
533#define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1)                 \
534  do                                                                    \
535    {                                                                   \
536      for (uint32_t it1=0; it1<x1; it1++)                               \
537        {                                                               \
538          TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \
539          TEST_SIGNAL(sig2            [it1]->name(),sig2            [it1]); \
540          (*(component->sig1[it1])) (*(sig2[it1]));                     \
541        }                                                               \
542    } while (0)
543
544#define DELETE1_SC_SIGNAL(sig, x1)                                      \
545  do                                                                    \
546    {                                                                   \
547      for (uint32_t it1=0; it1<x1; it1++)                               \
548        {                                                               \
549          PRINT_SIGNAL_ADDRESS("",sig[it1]);                            \
550          delete sig[it1];                                              \
551        }                                                               \
552      delete [] sig;                                                    \
553    } while (0)
554
555// ----------------------------------------------------------------------
556// -----[ ITERATION 2 ]--------------------------------------------------
557// ----------------------------------------------------------------------
558
559#ifdef POSITION
560#define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \
561  INTERFACE_PRINT(name);                                                \
562  uint32_t iterator_1 = 0;                                              \
563  uint32_t iterator_2 = 0;                                              \
564  morpheo::behavioural::Interface_fifo *** interface;                   \
565  {                                                                     \
566    std::string separator="_";                                          \
567    iterator_1 = x1;                                                    \
568    interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \
569    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
570      {                                                                 \
571        iterator_2 = x2;                                                \
572        interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \
573        for (uint32_t it2=0; it2<iterator_2; it2++)                     \
574          {                                                             \
575            interface [it1][it2] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2), direction, localisation, str); \
576          }                                                             \
577      }                                                                 \
578  }
579#else
580#define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \
581  INTERFACE_PRINT(name);                                                \
582  uint32_t iterator_1 = 0;                                              \
583  uint32_t iterator_2 = 0;                                              \
584  morpheo::behavioural::Interface_fifo *** interface;                   \
585  {                                                                     \
586    std::string separator="_";                                          \
587    iterator_1 = x1;                                                    \
588    interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \
589    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
590      {                                                                 \
591        iterator_2 = x2;                                                \
592        interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \
593        for (uint32_t it2=0; it2<iterator_2; it2++)                     \
594          {                                                             \
595            interface [it1][it2] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2)); \
596          }                                                             \
597      }                                                                 \
598  }
599#endif
600
601#define ALLOC2_INTERFACE_END(x1, x2)                                    \
602  do                                                                    \
603    {                                                                   \
604      for (uint32_t it1=0; it1<x1; it1++)                               \
605        delete [] interface [it1];                                      \
606      delete [] interface;                                              \
607    } while (0)
608
609#ifdef VHDL_TESTBENCH
610#define INTERFACE2_TEST(value,x1,x2)                   \
611  do                                                    \
612    {                                                   \
613      for (uint32_t it1=0; it1<x1; it1++)               \
614        for (uint32_t it2=0; it2<x2; it2++)             \
615          interface [it1][it2]->make_testbench(value);  \
616    } while(0)
617#else
618#define INTERFACE2_TEST(value,x1,x2)
619#endif
620
621#define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2)                    \
622  do                                                                    \
623    {                                                                   \
624      sig = new SC_IN (Tcontrol_t) ** [x1];                             \
625      for (uint32_t it1=0; it1<x1; it1++)                               \
626        {                                                               \
627          sig [it1] = new SC_IN (Tcontrol_t) * [x2];                    \
628          for (uint32_t it2=0; it2<x2; it2++)                           \
629            {                                                           \
630              sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (name, type); \
631            }                                                           \
632        }                                                               \
633    } while (0)
634
635#define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2)                   \
636  do                                                                    \
637    {                                                                   \
638      sig = new SC_OUT (Tcontrol_t) ** [x1];                            \
639      for (uint32_t it1=0; it1<x1; it1++)                               \
640        {                                                               \
641          sig [it1] = new SC_OUT (Tcontrol_t) * [x2];                   \
642          for (uint32_t it2=0; it2<x2; it2++)                           \
643            {                                                           \
644              sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (name, type); \
645            }                                                           \
646        }                                                               \
647    } while (0)
648
649#define _ALLOC2_VALACK_IN(    sig,type, x1, x2)                         \
650  do                                                                    \
651    {                                                                   \
652      sig = new SC_IN (Tcontrol_t) ** [x1];                             \
653      for (uint32_t it1=0; it1<x1; it1++)                               \
654        {                                                               \
655          sig [it1] = new SC_IN (Tcontrol_t) * [x2];                    \
656          for (uint32_t it2=0; it2<x2; it2++)                           \
657            {                                                           \
658              sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (type); \
659            }                                                           \
660        }                                                               \
661    } while (0)
662
663#define _ALLOC2_VALACK_OUT(    sig,type, x1, x2)                        \
664  do                                                                    \
665    {                                                                   \
666      sig = new SC_OUT (Tcontrol_t) ** [x1];                            \
667      for (uint32_t it1=0; it1<x1; it1++)                               \
668        {                                                               \
669          sig [it1] = new SC_OUT (Tcontrol_t) * [x2];                   \
670          for (uint32_t it2=0; it2<x2; it2++)                           \
671            {                                                           \
672              sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (type); \
673            }                                                           \
674        }                                                               \
675    } while (0)
676
677#define _ALLOC2_SIGNAL_IN_COND( sig, name, type, size, x1, x2, cond)    \
678  do                                                                    \
679    {                                                                   \
680      sig = new SC_IN (type) ** [x1];                                   \
681      for (uint32_t it1=0; it1<x1; it1++)                               \
682        {                                                               \
683          sig [it1] = new SC_IN (type) * [x2];                          \
684          for (uint32_t it2=0; it2<x2; it2++)                           \
685            {                                                           \
686              if (cond)                                                 \
687                {                                                       \
688                  if (size > 0)                                         \
689                    {                                                   \
690                      sig [it1][it2] = interface[it1][it2]->set_signal_in <type> (name, size); \
691                    }                                                   \
692                  else                                                  \
693                    {                                                   \
694                      PRINT_SIZE_NUL(_component,interface[it1][it2],name); \
695                    }                                                   \
696                }                                                       \
697            }                                                           \
698        }                                                               \
699    } while (0)
700
701#define _ALLOC2_SIGNAL_OUT_COND( sig, name, type, size, x1, x2, cond)   \
702  do                                                                    \
703    {                                                                   \
704      sig = new SC_OUT (type) ** [x1];                                  \
705      for (uint32_t it1=0; it1<x1; it1++)                               \
706        {                                                               \
707          sig [it1] = new SC_OUT (type) * [x2];                         \
708          for (uint32_t it2=0; it2<x2; it2++)                           \
709            {                                                           \
710              if (cond)                                                 \
711                {                                                       \
712                  if (size > 0)                                         \
713                    {                                                   \
714                      sig [it1][it2] = interface[it1][it2]->set_signal_out <type> (name, size); \
715                    }                                                   \
716                  else                                                  \
717                    {                                                   \
718                      PRINT_SIZE_NUL(_component,interface[it1][it2],name); \
719                    }                                                   \
720                }                                                       \
721            }                                                           \
722        }                                                               \
723    } while (0)
724
725#define _ALLOC2_SIGNAL_IN( sig, name, type, size, x1, x2) _ALLOC2_SIGNAL_IN_COND( sig, name, type, size, x1, x2,true)
726#define _ALLOC2_SIGNAL_OUT(sig, name, type, size, x1, x2) _ALLOC2_SIGNAL_OUT_COND(sig, name, type, size, x1, x2,true)
727
728#define ALLOC2_VAL_ACK_IN( sig, name, type      )         _ALLOC2_VAL_ACK_IN( sig, name, type      , iterator_1, iterator_2)
729#define ALLOC2_VAL_ACK_OUT(sig, name, type      )         _ALLOC2_VAL_ACK_OUT(sig, name, type      , iterator_1, iterator_2)
730#define ALLOC2_VALACK_IN(  sig,       type      )         _ALLOC2_VALACK_IN(  sig,       type      , iterator_1, iterator_2)
731#define ALLOC2_VALACK_OUT( sig,       type      )         _ALLOC2_VALACK_OUT( sig,       type      , iterator_1, iterator_2)
732#define ALLOC2_SIGNAL_IN(  sig, name, type, size)         _ALLOC2_SIGNAL_IN(  sig, name, type, size, iterator_1, iterator_2)
733#define ALLOC2_SIGNAL_OUT( sig, name, type, size)         _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2)
734
735#define DELETE2_SIGNAL_COND(sig, x1,x2, size, cond)                     \
736  do                                                                    \
737    {                                                                   \
738      for (uint32_t it1=0; it1<x1; it1++)                               \
739        {                                                               \
740          for (uint32_t it2=0; it2<x2; it2++)                           \
741            {                                                           \
742              if (cond)                                                 \
743                {                                                       \
744                  if (size > 0)                                         \
745                    {                                                   \
746                      delete sig[it1][it2];                             \
747                    }                                                   \
748                }                                                       \
749            }                                                           \
750          delete [] sig[it1];                                           \
751        }                                                               \
752      delete [] sig;                                                    \
753    } while (0)
754
755#define DELETE2_SIGNAL(sig, x1,x2, size) DELETE2_SIGNAL_COND(sig, x1,x2, size,true)
756
757#define ALLOC2_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2) \
758  do                                                                    \
759    {                                                                   \
760      sig = new SC_IN (type) ** [x1];                                   \
761      for (uint32_t it1=0; it1<x1; it1++)                               \
762        {                                                               \
763          sig [it1] = new SC_IN (type) * [x2];                          \
764          for (uint32_t it2=0; it2<x2; it2++)                           \
765            if (size > 0)                                               \
766              {                                                         \
767                std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \
768                sig [it1][it2] = new SC_IN    (type) (str.c_str());     \
769              }                                                         \
770        }                                                               \
771    } while (0)
772
773#define ALLOC2_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2) \
774  do                                                                    \
775    {                                                                   \
776      sig = new SC_OUT (type) ** [x1];                                  \
777      for (uint32_t it1=0; it1<x1; it1++)                               \
778        {                                                               \
779          sig [it1] = new SC_OUT (type) * [x2];                         \
780          for (uint32_t it2=0; it2<x2; it2++)                           \
781            if (size > 0)                                               \
782              {                                                         \
783                std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \
784                sig [it1][it2] = new SC_IN    (type) (str.c_str());     \
785              }                                                         \
786        }                                                               \
787    } while (0)
788
789#define DELETE2_FOREIGN_SIGNAL( sig, size,x1,x2)            \
790  do                                                        \
791    {                                                       \
792      DELETE2_SIGNAL(sig,x1,x2,size);                       \
793    } while (0)
794
795#define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2)                      \
796  do                                                                    \
797    {                                                                   \
798      sig = new sc_signal<type> ** [x1];                                \
799      {                                                                 \
800        std::string separator="_";                                      \
801        std::string str;                                                \
802        for (uint32_t it1=0; it1<x1; it1++)                             \
803          {                                                             \
804            sig [it1] = new sc_signal<type> * [x2];                     \
805            for (uint32_t it2=0; it2<x2; it2++)                         \
806              {                                                         \
807                str = name+separator+toString(it1)+separator+toString(it2); \
808                sig [it1][it2] = new sc_signal<type> (str.c_str());     \
809                PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2]);        \
810              }                                                         \
811          }                                                             \
812      }                                                                 \
813    } while (0)
814
815#define INSTANCE2_SC_SIGNAL(component, sig, x1, x2)                     \
816  do                                                                    \
817    {                                                                   \
818      for (uint32_t it1=0; it1<x1; it1++)                               \
819        for (uint32_t it2=0; it2<x2; it2++)                             \
820          {                                                             \
821            TEST_SIGNAL(component->sig  [it1][it2]->name(),component->sig  [it1][it2]); \
822            TEST_SIGNAL(sig             [it1][it2]->name(),sig             [it1][it2]); \
823            (*(component->sig[it1][it2])) (*(sig[it1][it2]));           \
824          }                                                             \
825    } while (0)
826
827#define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2)             \
828  do                                                                    \
829    {                                                                   \
830      for (uint32_t it1=0; it1<x1; it1++)                               \
831        for (uint32_t it2=0; it2<x2; it2++)                             \
832          {                                                             \
833            TEST_SIGNAL(component->sig1 [it1][it2]->name(),component->sig1 [it1][it2]); \
834            TEST_SIGNAL(sig2            [it1][it2]->name(),sig2            [it1][it2]); \
835            (*(component->sig1[it1][it2])) (*(sig2[it1][it2]));         \
836          }                                                             \
837    } while (0)
838
839#define DELETE2_SC_SIGNAL(sig,x1,x2)                                    \
840  do                                                                    \
841    {                                                                   \
842      for (uint32_t it1=0; it1<x1; it1++)                               \
843        {                                                               \
844          for (uint32_t it2=0; it2<x2; it2++)                           \
845            {                                                           \
846              PRINT_SIGNAL_ADDRESS("",sig[it1][it2]);                   \
847              delete sig[it1][it2];                                     \
848            }                                                           \
849          delete [] sig[it1];                                           \
850        }                                                               \
851      delete [] sig;                                                    \
852    } while (0)
853
854// ----------------------------------------------------------------------
855// -----[ ITERATION 3 ]--------------------------------------------------
856// ----------------------------------------------------------------------
857
858#ifdef POSITION
859#define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \
860  INTERFACE_PRINT(name);                                                \
861  uint32_t iterator_1 = 0;                                              \
862  uint32_t iterator_2 = 0;                                              \
863  uint32_t iterator_3 = 0;                                              \
864  morpheo::behavioural::Interface_fifo **** interface;                  \
865  {                                                                     \
866    std::string separator="_";                                          \
867    iterator_1 = x1;                                                    \
868    interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \
869    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
870      {                                                                 \
871        iterator_2 = x2;                                                \
872        interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \
873        for (uint32_t it2=0; it2<iterator_2; it2++)                     \
874          {                                                             \
875            iterator_3 = x3;                                            \
876            interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \
877            for (uint32_t it3=0; it3<iterator_3; it3++)                 \
878              {                                                         \
879                interface [it1][it2][it3] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \
880              }                                                         \
881          }                                                             \
882      }                                                                 \
883  }
884#else
885#define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \
886  INTERFACE_PRINT(name);                                                \
887  uint32_t iterator_1 = 0;                                              \
888  uint32_t iterator_2 = 0;                                              \
889  uint32_t iterator_3 = 0;                                              \
890  morpheo::behavioural::Interface_fifo **** interface;                  \
891  {                                                                     \
892    std::string separator="_";                                          \
893    iterator_1 = x1;                                                    \
894    interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \
895    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
896      {                                                                 \
897        iterator_2 = x2;                                                \
898        interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \
899        for (uint32_t it2=0; it2<iterator_2; it2++)                     \
900          {                                                             \
901            iterator_3 = x3;                                            \
902            interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \
903            for (uint32_t it3=0; it3<iterator_3; it3++)                 \
904              {                                                         \
905                interface [it1][it2][it3] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2)+separator+toString(it3)); \
906              }                                                         \
907          }                                                             \
908      }                                                                 \
909  }
910#endif
911
912#define ALLOC3_INTERFACE_END(x1, x2, x3)                         \
913  do                                                                    \
914    {                                                                   \
915      for (uint32_t it1=0; it1<x1; it1++)                               \
916        {                                                               \
917          for (uint32_t it2=0; it2<x2; it2++)                           \
918            delete [] interface [it1][it2];                             \
919          delete [] interface [it1];                                    \
920        }                                                               \
921      delete [] interface;                                              \
922    } while (0)
923
924#ifdef VHDL_TESTBENCH
925#define INTERFACE3_TEST(value,x1,x2,x3)                         \
926  do                                                            \
927    {                                                           \
928      for (uint32_t it1=0; it1<x1; it1++)                       \
929        for (uint32_t it2=0; it2<x2; it2++)                     \
930          for (uint32_t it3=0; it3<x3; it3++)                   \
931            interface [it1][it2][it3]->make_testbench(value);   \
932    } while(0)
933#else
934#define INTERFACE3_TEST(value,x1,x2,x3)
935#endif
936
937// #define _ALLOC3_VAL_ACK_IN( sig, name, type, x1, x2, x3)
938// #define _ALLOC3_VAL_ACK_OUT( sig, name, type, x1, x2, x3)
939
940#define _ALLOC3_VALACK_IN(    sig,type, x1, x2, x3)                     \
941  do                                                                    \
942    {                                                                   \
943      sig = new SC_IN (Tcontrol_t) *** [x1];                            \
944      for (uint32_t it1=0; it1<x1; it1++)                               \
945        {                                                               \
946          sig [it1] = new SC_IN (Tcontrol_t) ** [x2];                   \
947          for (uint32_t it2=0; it2<x2; it2++)                           \
948            {                                                           \
949              sig [it1][it2] = new SC_IN (Tcontrol_t) * [x3];           \
950              for (uint32_t it3=0; it3<x3; it3++)                       \
951                {                                                       \
952                  sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_in (type); \
953                }                                                       \
954            }                                                           \
955        }                                                               \
956    } while (0)
957
958#define _ALLOC3_VALACK_OUT(    sig,type, x1, x2, x3)                    \
959  do                                                                    \
960    {                                                                   \
961      sig = new SC_OUT (Tcontrol_t) *** [x1];                           \
962      for (uint32_t it1=0; it1<x1; it1++)                               \
963        {                                                               \
964          sig [it1] = new SC_OUT (Tcontrol_t) ** [x2];                  \
965          for (uint32_t it2=0; it2<x2; it2++)                           \
966            {                                                           \
967              sig [it1][it2] = new SC_OUT (Tcontrol_t) * [x3];          \
968              for (uint32_t it3=0; it3<x3; it3++)                       \
969                {                                                       \
970                  sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_out (type); \
971                }                                                       \
972            }                                                           \
973        }                                                               \
974    } while (0)
975
976
977#define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3)            \
978  do                                                                    \
979    {                                                                   \
980      sig = new SC_IN (type) *** [x1];                                  \
981      for (uint32_t it1=0; it1<x1; it1++)                               \
982        {                                                               \
983          sig [it1] = new SC_IN (type) ** [x2];                         \
984          for (uint32_t it2=0; it2<x2; it2++)                           \
985            {                                                           \
986              sig [it1][it2] = new SC_IN (type) * [x3];                 \
987              for (uint32_t it3=0; it3<x3; it3++)                       \
988                {                                                       \
989                  if (size > 0)                                         \
990                    {                                                   \
991                      sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_in <type> (name, size); \
992                    }                                                   \
993                  else                                                  \
994                    {                                                   \
995                      PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \
996                    }                                                   \
997                }                                                       \
998            }                                                           \
999        }                                                               \
1000    } while (0)
1001
1002#define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3)           \
1003  do                                                                    \
1004    {                                                                   \
1005      sig = new SC_OUT (type) *** [x1];                                 \
1006      for (uint32_t it1=0; it1<x1; it1++)                               \
1007        {                                                               \
1008          sig [it1] = new SC_OUT (type) ** [x2];                        \
1009          for (uint32_t it2=0; it2<x2; it2++)                           \
1010            {                                                           \
1011              sig [it1][it2] = new SC_OUT (type) * [x3];                \
1012              for (uint32_t it3=0; it3<x3; it3++)                       \
1013                {                                                       \
1014                  if (size > 0)                                         \
1015                    {                                                   \
1016                      sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_out <type> (name, size); \
1017                    }                                                   \
1018                  else                                                  \
1019                    {                                                   \
1020                      PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \
1021                    }                                                   \
1022                }                                                       \
1023            }                                                           \
1024        }                                                               \
1025    } while (0)
1026
1027// #define ALLOC3_VAL_ACK_IN( sig, name, type      ) _ALLOC3_VAL_ACK_IN( sig, name, type      , iterator_1, iterator_2, iterator_3)
1028// #define ALLOC3_VAL_ACK_OUT(sig, name, type      ) _ALLOC3_VAL_ACK_OUT(sig, name, type      , iterator_1, iterator_2, iterator_3)
1029#define ALLOC3_VALACK_IN(  sig,       type      ) _ALLOC3_VALACK_IN(  sig,       type      , iterator_1, iterator_2, iterator_3)
1030#define ALLOC3_VALACK_OUT( sig,       type      ) _ALLOC3_VALACK_OUT( sig,       type      , iterator_1, iterator_2, iterator_3)
1031#define ALLOC3_SIGNAL_IN(  sig, name, type, size) _ALLOC3_SIGNAL_IN(  sig, name, type, size, iterator_1, iterator_2, iterator_3)
1032#define ALLOC3_SIGNAL_OUT( sig, name, type, size) _ALLOC3_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2, iterator_3)
1033
1034#define DELETE3_SIGNAL(sig, x1, x2, x3, size)                           \
1035  do                                                                    \
1036    {                                                                   \
1037      for (uint32_t it1=0; it1<x1; it1++)                               \
1038        {                                                               \
1039          for (uint32_t it2=0; it2<x2; it2++)                           \
1040            {                                                           \
1041              for (uint32_t it3=0; it3<x3; it3++)                       \
1042                {                                                       \
1043                  if (size > 0)                                         \
1044                    {                                                   \
1045                      delete sig[it1][it2][it3];                        \
1046                    }                                                   \
1047                }                                                       \
1048              delete [] sig[it1][it2];                                  \
1049            }                                                           \
1050          delete [] sig[it1];                                           \
1051        }                                                               \
1052      delete [] sig;                                                    \
1053    } while (0)
1054
1055#define ALLOC3_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2,x3)     \
1056  do                                                                    \
1057    {                                                                   \
1058      sig = new SC_IN (type) *** [x1];                                  \
1059      for (uint32_t it1=0; it1<x1; it1++)                               \
1060        {                                                               \
1061          sig [it1] = new SC_IN (type) ** [x2];                         \
1062          for (uint32_t it2=0; it2<x2; it2++)                           \
1063            {                                                           \
1064              sig [it1][it2] = new SC_IN (type) * [x3];                 \
1065              for (uint32_t it3=0; it3<x3; it3++)                       \
1066                if (size > 0)                                           \
1067                  {                                                     \
1068                    std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \
1069                    sig [it1][it2][it3] = new SC_IN (type) (str.c_str()); \
1070                  }                                                     \
1071            }                                                           \
1072        }                                                               \
1073    } while (0)
1074
1075#define ALLOC3_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2,x3)    \
1076  do                                                                    \
1077    {                                                                   \
1078      sig = new SC_OUT (type) *** [x1];                                 \
1079      for (uint32_t it1=0; it1<x1; it1++)                               \
1080        {                                                               \
1081          sig [it1] = new SC_OUT (type) ** [x2];                        \
1082          for (uint32_t it2=0; it2<x2; it2++)                           \
1083            {                                                           \
1084              sig [it1][it2] = new SC_OUT (type) * [x3];                \
1085              for (uint32_t it3=0; it3<x3; it3++)                       \
1086                if (size > 0)                                           \
1087                  {                                                     \
1088                    std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \
1089                    sig [it1][it2][it3] = new SC_OUT(type) (str.c_str()); \
1090                  }                                                     \
1091            }                                                           \
1092        }                                                               \
1093    } while (0)
1094
1095#define DELETE3_FOREIGN_SIGNAL( sig, size,x1,x2,x3)            \
1096  do                                                           \
1097    {                                                          \
1098      DELETE3_SIGNAL(sig,x1,x2,x3,size);                       \
1099    } while (0)
1100
1101#define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3)                  \
1102  do                                                                    \
1103    {                                                                   \
1104      sig = new sc_signal<type> *** [x1];                               \
1105      {                                                                 \
1106        std::string separator="_";                                      \
1107        std::string str;                                                \
1108        for (uint32_t it1=0; it1<x1; it1++)                             \
1109          {                                                             \
1110            sig [it1] = new sc_signal<type> ** [x2];                    \
1111            for (uint32_t it2=0; it2<x2; it2++)                         \
1112              {                                                         \
1113                sig [it1][it2] = new sc_signal<type> * [x3];            \
1114                for (uint32_t it3=0; it3<x3; it3++)                     \
1115                  {                                                     \
1116                    str = name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3); \
1117                    sig [it1][it2][it3] = new sc_signal<type> (str.c_str()); \
1118                    PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2][it3]); \
1119                  }                                                     \
1120              }                                                         \
1121          }                                                             \
1122      }                                                                 \
1123    } while (0)
1124
1125#define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3)                 \
1126  do                                                                    \
1127    {                                                                   \
1128      for (uint32_t it1=0; it1<x1; it1++)                               \
1129        for (uint32_t it2=0; it2<x2; it2++)                             \
1130          for (uint32_t it3=0; it3<x3; it3++)                           \
1131            {                                                           \
1132              TEST_SIGNAL(component->sig  [it1][it2][it3]->name(),component->sig  [it1][it2][it3]); \
1133              TEST_SIGNAL(sig             [it1][it2][it3]->name(),sig             [it1][it2][it3]); \
1134              (*(component->sig[it1][it2][it3])) (*(sig[it1][it2][it3])); \
1135            }                                                           \
1136    } while (0)
1137
1138#define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3)         \
1139  do                                                                    \
1140    {                                                                   \
1141      for (uint32_t it1=0; it1<x1; it1++)                               \
1142        for (uint32_t it2=0; it2<x2; it2++)                             \
1143          for (uint32_t it3=0; it3<x3; it3++)                           \
1144            {                                                           \
1145              TEST_SIGNAL(component->sig1 [it1][it2][it3]->name(),component->sig1 [it1][it2][it3]); \
1146              TEST_SIGNAL(sig2            [it1][it2][it3]->name(),sig2            [it1][it2][it3]); \
1147              (*(component->sig1[it1][it2][it3])) (*(sig2[it1][it2][it3])); \
1148            }                                                           \
1149    } while (0)
1150
1151#define DELETE3_SC_SIGNAL(sig,x1,x2,x3)                                 \
1152  do                                                                    \
1153    {                                                                   \
1154      for (uint32_t it1=0; it1<x1; it1++)                               \
1155        {                                                               \
1156          for (uint32_t it2=0; it2<x2; it2++)                           \
1157            {                                                           \
1158              for (uint32_t it3=0; it3<x3; it3++)                       \
1159                {                                                       \
1160                  PRINT_SIGNAL_ADDRESS("",sig[it1][it2][it3]);          \
1161                  delete sig[it1][it2][it3];                            \
1162                }                                                       \
1163              delete [] sig[it1][it2];                                  \
1164            }                                                           \
1165          delete [] sig[it1];                                           \
1166        }                                                               \
1167      delete [] sig;                                                    \
1168    } while (0)
1169
1170#endif
Note: See TracBrowser for help on using the repository browser.