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

Last change on this file since 146 was 146, checked in by rosiere, 13 years ago

1) Integration of RegisterFile_Internal_Banked in RegisterFile?
2) Erase "read_write" interface in RegisterFile_Monolithic component
3) Add smith predictor parameters in Load_store_pointer_unit.
4) Fix not statistics flags

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