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
RevLine 
[81]1#ifndef morpheo_behavioural_Allocation_h
2#define morpheo_behavioural_Allocation_h
[73]3
[82]4/*
5 * $Id: Allocation.h 139 2010-07-30 14:47:27Z rosiere $
6 *
7 * [ Description ]
8 *
9 */
10
[81]11#include "Common/include/Debug.h"
12
[88]13// ======================================================================
14// =====[ ALLOCATION / DELETE of ARRAY ]=================================
15// ======================================================================
[112]16#define ALLOC0(var,type)                        \
[128]17  do                                            \
18    {                                           \
19      var = new type;                           \
20    } while (0)
[112]21
[128]22#define ALLOC1(var,type,s1)                     \
23  do                                            \
24    {                                           \
25      var = new type [s1];                      \
26    } while (0)
27
[88]28#define ALLOC2(var,type,s1,s2)                   \
[128]29  do                                             \
[88]30    {                                            \
[128]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)
[88]37
38#define ALLOC3(var,type,s1,s2,s3)                \
[128]39  do                                             \
[88]40    {                                            \
[128]41      var = new type ** [s1];                    \
42      for (uint32_t it1=0; it1<s1; ++it1)        \
[88]43        {                                        \
[128]44          var [it1] = new type * [s2];           \
45          for (uint32_t it2=0; it2<s2; ++it2)    \
46            {                                    \
47              var [it1][it2] = new type [s3];    \
48            }                                    \
[88]49        }                                        \
[128]50    } while (0)
51
[88]52#define ALLOC4(var,type,s1,s2,s3,s4)                    \
[128]53  do                                                    \
[88]54    {                                                   \
[128]55      var = new type *** [s1];                          \
56      for (uint32_t it1=0; it1<s1; ++it1)               \
[88]57        {                                               \
[128]58          var [it1] = new type ** [s2];                 \
59          for (uint32_t it2=0; it2<s2; ++it2)           \
[88]60            {                                           \
[128]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                }                                       \
[88]66            }                                           \
67        }                                               \
[128]68    } while (0)
[111]69
70#define DELETE0(var)                            \
[128]71  do                                            \
72    {                                           \
73      delete var;                               \
74    } while (0)
[88]75
[128]76#define DELETE1(var,s1)                         \
77  do                                            \
78    {                                           \
79      delete [] var;                            \
80    } while (0)
81
82#define DELETE2(var,s1,s2)                      \
83  do                                            \
[88]84    {                                            \
[128]85      for (uint32_t it1=0; it1<s1; ++it1)        \
[88]86        {                                        \
[128]87          delete [] var [it1];                   \
[88]88        }                                        \
[128]89      delete [] var;                             \
90    } while (0)
91
92#define DELETE3(var,s1,s2,s3)                    \
93  do                                             \
[88]94    {                                            \
[128]95      for (uint32_t it1=0; it1<s1; ++it1)        \
[88]96        {                                        \
[128]97          for (uint32_t it2=0; it2<s2; ++it2)    \
[88]98            {                                    \
[128]99              delete [] var [it1][it2];          \
[88]100            }                                    \
[128]101          delete [] var [it1];                   \
[88]102        }                                        \
[128]103      delete [] var;                             \
104    } while (0)
[88]105
[128]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
[88]124// ======================================================================
125// =====[ ALLOCATION / DELETE of SIGNAL]=================================
126// ======================================================================
127
[73]128// Help to allocate interface
[88]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)
[113]133#define INSTANCE_FOREIGN_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__);
[73]134
135// ----------------------------------------------------------------------
136// -----[ NO ITERATION ]-------------------------------------------------
137// ----------------------------------------------------------------------
138
[113]139#define __ALLOC0_SIGNAL(sig, name, type)        \
[128]140  do                                            \
141    {                                           \
142      sig = new type (name);                    \
143    } while (0)
[78]144
[73]145#ifdef POSITION
[113]146#define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str)     \
[88]147  INTERFACE_PRINT(name);                                                \
148  morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str);
[73]149#else
[113]150#define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str)     \
[88]151  INTERFACE_PRINT(name);                                                \
152  morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name);
[73]153#endif
154
[112]155#define ALLOC0_INTERFACE_END()
156
[135]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
[113]167#define ALLOC0_VAL_ACK_IN(  sig, name, type)                            \
[128]168  do                                                                    \
169    {                                                                   \
170      sig = interface->set_signal_valack_in (name, type);               \
171    } while (0)
172
[113]173#define ALLOC0_VAL_ACK_OUT( sig, name, type)                            \
[128]174  do                                                                    \
175    {                                                                   \
176      sig = interface->set_signal_valack_out(name, type);               \
177    } while (0)
178                                                                 
[113]179#define ALLOC0_VALACK_IN(     sig, type)                                \
[128]180  do                                                                    \
[88]181    {                                                                   \
[128]182      sig = interface->set_signal_valack_in (type);                     \
183    } while (0)
184                                                                   
185#define ALLOC0_VALACK_OUT(    sig, type)                                \
186  do                                                                    \
[88]187    {                                                                   \
[128]188      sig = interface->set_signal_valack_out(type);                     \
189    } while (0)
190                                                                     
191#define ALLOC0_SIGNAL_IN(  sig, name, type, size)                       \
192  do                                                                    \
[88]193    {                                                                   \
[128]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                                                                    \
[88]206    {                                                                   \
[128]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)
[73]216
[113]217#define DELETE0_SIGNAL( sig, size)                                      \
[128]218  do                                                                    \
[88]219    {                                                                   \
[128]220      if (size > 0)                                                     \
221        {                                                               \
222          delete sig;                                                   \
223        }                                                               \
224    } while (0)
[81]225
[113]226#define ALLOC0_FOREIGN_SIGNAL_IN(  sig, interface, name, type, size)    \
[128]227  do                                                                    \
[113]228    {                                                                   \
[128]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)
[113]235
236#define ALLOC0_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size)    \
[128]237  do                                                                    \
[113]238    {                                                                   \
[128]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)
[113]245
[128]246#define DELETE0_FOREIGN_SIGNAL( sig, size)                              \
247  do                                                                    \
248    {                                                                   \
249      DELETE0_SIGNAL(sig,size);                                         \
250    } while (0)
[113]251
252#define INSTANCE0_FOREIGN_SIGNAL(component, sig, type, name, size)      \
[128]253  do                                                                    \
[113]254    {                                                                   \
[128]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)
[113]261
262#define ALLOC0_SC_SIGNAL(  sig, name, type)                             \
[128]263  do                                                                    \
264    {                                                                   \
265      sig = new sc_signal<type> (name);                                 \
266      PRINT_SIGNAL_ADDRESS(name,sig);                                   \
267    } while (0)
[73]268
[128]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)
[73]276
[113]277#define _INSTANCE0_SC_SIGNAL(component, sig1,sig2)                      \
[128]278  do                                                                    \
279    {                                                                   \
280      TEST_SIGNAL(component->sig1->name(),component->sig1);             \
281      TEST_SIGNAL(sig2           ->name(),sig2);                        \
282      (*(component->sig1)) (*(sig2));                                   \
283    } while (0)
[81]284
[128]285#define DELETE0_SC_SIGNAL( sig)                                         \
286  do                                                                    \
287    {                                                                   \
288      PRINT_SIGNAL_ADDRESS("",sig);                                     \
289      delete sig;                                                       \
290    } while (0)
[88]291
[73]292// ----------------------------------------------------------------------
293// -----[ ITERATION 1 ]--------------------------------------------------
294// ----------------------------------------------------------------------
295
[128]296#define __ALLOC1_INTERFACE_BEGIN(name, x1)                              \
[88]297  INTERFACE_PRINT(name);                                                \
298  const std::string interface_name = name;                              \
299  const uint32_t iterator_1 = x1;
[78]300
[112]301#define __ALLOC1_INTERFACE_END(x1)
302
[88]303#define __ALLOC1_SIGNAL_IN( sig, name, type)                            \
[128]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)
[78]314
[128]315
[88]316#define __ALLOC1_SIGNAL_OUT( sig, name, type)                           \
[128]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)
[78]327
[73]328#ifdef POSITION
[122]329#define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \
[88]330  INTERFACE_PRINT(name);                                                \
[122]331  uint32_t iterator_1 = 0;                                              \
332  morpheo::behavioural::Interface_fifo ** interface;                    \
[88]333  {                                                                     \
334    std::string separator="_";                                          \
[115]335    iterator_1 = x1;                                                    \
336    interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \
[88]337    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
338      {                                                                 \
[137]339        interface [it1] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1), direction, localisation, str); \
[88]340      }                                                                 \
[73]341  }
342#else
[128]343#define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \
[88]344  INTERFACE_PRINT(name);                                                \
[122]345  uint32_t iterator_1 = 0;                                              \
346  morpheo::behavioural::Interface_fifo ** interface;                    \
[88]347  {                                                                     \
348    std::string separator="_";                                          \
[122]349    iterator_1 = x1;                                                    \
350    interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \
[88]351    for (uint32_t it1=0; it1<iterator_1; it1++)                         \
352      {                                                                 \
[137]353        interface [it1] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)); \
[88]354      }                                                                 \
[73]355  }
356#endif
357
[128]358#define ALLOC1_INTERFACE_END(x1)                                        \
359  do                                                                    \
360    {                                                                   \
361      delete [] interface;                                              \
362    } while (0)
[112]363
[135]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
[88]375#define ALLOC1_VAL_ACK_IN( sig, name, type)                             \
[128]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
[88]385#define ALLOC1_VAL_ACK_OUT(sig, name, type)                             \
[128]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
[88]395#define ALLOC1_VALACK_IN(    sig, type)                                 \
[128]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
[88]405#define ALLOC1_VALACK_OUT(   sig, type)                                 \
[128]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
[139]415#define ALLOC1_SIGNAL_IN_COND( sig, name, type, size, cond)             \
[128]416  do                                                                    \
417    {                                                                   \
418      sig = new SC_IN (type) * [iterator_1];                            \
419      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
420        {                                                               \
[139]421          if (cond)                                                     \
[128]422            {                                                           \
[139]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                }                                                       \
[128]431            }                                                           \
432        }                                                               \
433    } while (0)
434
[139]435#define ALLOC1_SIGNAL_OUT_COND(sig, name, type, size, cond)             \
[128]436  do                                                                    \
437    {                                                                   \
438      sig = new SC_OUT(type) * [iterator_1];                            \
439      for (uint32_t it1=0; it1<iterator_1; it1++)                       \
440        {                                                               \
[139]441          if (cond)                                                     \
[128]442            {                                                           \
[139]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                }                                                       \
[128]451            }                                                           \
452        }                                                               \
453    } while (0)
454
[139]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)                        \
[128]459  do                                                                    \
460    {                                                                   \
461      for (uint32_t it1=0; it1<x1; it1++)                               \
462        {                                                               \
[139]463          if (cond)                                                     \
[128]464            {                                                           \
[139]465              if (size > 0)                                             \
466                {                                                       \
467                  delete sig[it1];                                      \
468                }                                                       \
[128]469            }                                                           \
470        }                                                               \
471      delete [] sig;                                                    \
472    } while (0)
473
[139]474#define DELETE1_SIGNAL(sig, x1, size) DELETE1_SIGNAL_COND(sig, x1, size, true)
475
[128]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++)                               \
[88]481        if (size > 0)                                                   \
482          {                                                             \
[128]483            std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \
484            sig [it1] = new SC_IN (type) (str.c_str());                 \
[88]485          }                                                             \
[128]486    } while (0)
[73]487
[128]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++)                               \
[88]493        if (size > 0)                                                   \
494          {                                                             \
[128]495            std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \
496            sig [it1] = new SC_OUT (type) (str.c_str());                \
[88]497          }                                                             \
[128]498    } while (0)
[73]499
[128]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];                                 \
[88]510      {                                                                 \
[128]511        std::string separator="_";                                      \
512        std::string str;                                                \
513        for (uint32_t it1=0; it1<x1; it1++)                             \
[88]514          {                                                             \
[128]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]);                 \
[88]518          }                                                             \
519      }                                                                 \
[128]520    } while (0)
[81]521
[128]522#define INSTANCE1_SC_SIGNAL(component, sig, x1)                         \
523  do                                                                    \
524    {                                                                   \
525      for (uint32_t it1=0; it1<x1; it1++)                               \
[113]526        {                                                               \
[128]527          TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \
528          TEST_SIGNAL(sig            [it1]->name(),sig            [it1]); \
529          (*(component->sig[it1])) (*(sig[it1]));                       \
[113]530        }                                                               \
[128]531    } while (0)
[113]532
[128]533#define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1)                 \
534  do                                                                    \
535    {                                                                   \
536      for (uint32_t it1=0; it1<x1; it1++)                               \
[113]537        {                                                               \
[128]538          TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \
539          TEST_SIGNAL(sig2            [it1]->name(),sig2            [it1]); \
540          (*(component->sig1[it1])) (*(sig2[it1]));                     \
[113]541        }                                                               \
[128]542    } while (0)
[113]543
[128]544#define DELETE1_SC_SIGNAL(sig, x1)                                      \
545  do                                                                    \
[88]546    {                                                                   \
[128]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)
[73]554
[78]555// ----------------------------------------------------------------------
556// -----[ ITERATION 2 ]--------------------------------------------------
557// ----------------------------------------------------------------------
558
559#ifdef POSITION
[128]560#define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \
[88]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          {                                                             \
[137]575            interface [it1][it2] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2), direction, localisation, str); \
[88]576          }                                                             \
577      }                                                                 \
[78]578  }
579#else
[128]580#define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \
[88]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          {                                                             \
[137]595            interface [it1][it2] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2)); \
[88]596          }                                                             \
597      }                                                                 \
[78]598  }
[73]599#endif
[78]600
[122]601#define ALLOC2_INTERFACE_END(x1, x2)                                    \
[128]602  do                                                                    \
603    {                                                                   \
604      for (uint32_t it1=0; it1<x1; it1++)                               \
605        delete [] interface [it1];                                      \
606      delete [] interface;                                              \
607    } while (0)
[112]608
[135]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
[88]621#define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2)                    \
[128]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)
[78]634
[88]635#define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2)                   \
[128]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)
[78]648
[88]649#define _ALLOC2_VALACK_IN(    sig,type, x1, x2)                         \
[128]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)
[78]662
[88]663#define _ALLOC2_VALACK_OUT(    sig,type, x1, x2)                        \
[128]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)
[78]676
[139]677#define _ALLOC2_SIGNAL_IN_COND( sig, name, type, size, x1, x2, cond)    \
[128]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            {                                                           \
[139]686              if (cond)                                                 \
[128]687                {                                                       \
[139]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                    }                                                   \
[128]696                }                                                       \
697            }                                                           \
698        }                                                               \
699    } while (0)
[78]700
[139]701#define _ALLOC2_SIGNAL_OUT_COND( sig, name, type, size, x1, x2, cond)   \
[128]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            {                                                           \
[139]710              if (cond)                                                 \
[128]711                {                                                       \
[139]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                    }                                                   \
[128]720                }                                                       \
721            }                                                           \
722        }                                                               \
723    } while (0)
[78]724
[139]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)
[78]727
[139]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)                     \
[128]736  do                                                                    \
737    {                                                                   \
738      for (uint32_t it1=0; it1<x1; it1++)                               \
739        {                                                               \
740          for (uint32_t it2=0; it2<x2; it2++)                           \
741            {                                                           \
[139]742              if (cond)                                                 \
[128]743                {                                                       \
[139]744                  if (size > 0)                                         \
745                    {                                                   \
746                      delete sig[it1][it2];                             \
747                    }                                                   \
[128]748                }                                                       \
749            }                                                           \
750          delete [] sig[it1];                                           \
751        }                                                               \
752      delete [] sig;                                                    \
753    } while (0)
754
[139]755#define DELETE2_SIGNAL(sig, x1,x2, size) DELETE2_SIGNAL_COND(sig, x1,x2, size,true)
756
[128]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++)                           \
[88]765            if (size > 0)                                               \
766              {                                                         \
[128]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());     \
[88]769              }                                                         \
[128]770        }                                                               \
771    } while (0)
[81]772
[113]773#define ALLOC2_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2) \
[128]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)
[113]788
789#define DELETE2_FOREIGN_SIGNAL( sig, size,x1,x2)            \
[128]790  do                                                        \
791    {                                                       \
792      DELETE2_SIGNAL(sig,x1,x2,size);                       \
793    } while (0)
[113]794
[88]795#define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2)                      \
[128]796  do                                                                    \
797    {                                                                   \
798      sig = new sc_signal<type> ** [x1];                                \
[88]799      {                                                                 \
[128]800        std::string separator="_";                                      \
801        std::string str;                                                \
802        for (uint32_t it1=0; it1<x1; it1++)                             \
[88]803          {                                                             \
[128]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              }                                                         \
[88]811          }                                                             \
812      }                                                                 \
[128]813    } while (0)
[78]814
[88]815#define INSTANCE2_SC_SIGNAL(component, sig, x1, x2)                     \
[128]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)
[81]826
[88]827#define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2)             \
[128]828  do                                                                    \
829    {                                                                   \
830      for (uint32_t it1=0; it1<x1; it1++)                               \
[88]831        for (uint32_t it2=0; it2<x2; it2++)                             \
832          {                                                             \
[128]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]));         \
[88]836          }                                                             \
[128]837    } while (0)
[81]838
[128]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
[88]854// ----------------------------------------------------------------------
855// -----[ ITERATION 3 ]--------------------------------------------------
856// ----------------------------------------------------------------------
857
858#ifdef POSITION
[112]859#define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \
[88]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              {                                                         \
[137]879                interface [it1][it2][it3] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \
[88]880              }                                                         \
881          }                                                             \
882      }                                                                 \
883  }
884#else
[112]885#define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \
[88]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              {                                                         \
[137]905                interface [it1][it2][it3] = _interfaces->set_interface(((toString(name)!="")?(name+separator):"")+toString(it1)+separator+toString(it2)+separator+toString(it3)); \
[88]906              }                                                         \
907          }                                                             \
908      }                                                                 \
909  }
[78]910#endif
[88]911
[112]912#define ALLOC3_INTERFACE_END(x1, x2, x3)                         \
[128]913  do                                                                    \
[112]914    {                                                                   \
[128]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)
[112]923
[135]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
[88]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)                     \
[128]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)
[88]957
958#define _ALLOC3_VALACK_OUT(    sig,type, x1, x2, x3)                    \
[128]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)
[88]975
976
977#define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3)            \
[128]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)
[88]1001
1002#define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3)           \
[128]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)
[88]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)                           \
[128]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++)                       \
[88]1066                if (size > 0)                                           \
1067                  {                                                     \
[128]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()); \
[88]1070                  }                                                     \
[128]1071            }                                                           \
1072        }                                                               \
1073    } while (0)
[88]1074
[113]1075#define ALLOC3_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2,x3)    \
[128]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)
[113]1094
1095#define DELETE3_FOREIGN_SIGNAL( sig, size,x1,x2,x3)            \
[128]1096  do                                                           \
1097    {                                                          \
1098      DELETE3_SIGNAL(sig,x1,x2,x3,size);                       \
1099    } while (0)
[113]1100
[88]1101#define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3)                  \
[128]1102  do                                                                    \
1103    {                                                                   \
1104      sig = new sc_signal<type> *** [x1];                               \
[88]1105      {                                                                 \
[128]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          }                                                             \
[88]1122      }                                                                 \
[128]1123    } while (0)
[88]1124
1125#define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3)                 \
[128]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)
[88]1137
1138#define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3)         \
[128]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)
[88]1150
1151#define DELETE3_SC_SIGNAL(sig,x1,x2,x3)                                 \
[128]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)
[88]1169
1170#endif
Note: See TracBrowser for help on using the repository browser.