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

Last change on this file since 76 was 76, checked in by rosiere, 16 years ago

Add new component : Read_unit (no tested)
Change functionnal_unit : now use type and operation to execute the good function
Change New_Component's script

File size: 5.4 KB
Line 
1#ifndef Allocation_H
2#define Allocation_H
3
4// Help to allocate interface
5
6// ----------------------------------------------------------------------
7// -----[ NO ITERATION ]-------------------------------------------------
8// ----------------------------------------------------------------------
9
10#ifdef POSITION
11#define ALLOC_INTERFACE( name, direction, localisation, str)            \
12  Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str);
13#else
14#define ALLOC_INTERFACE( name, direction, localisation, str)            \
15  Interface_fifo * interface = _interfaces->set_interface( name);
16#endif
17
18#define ALLOC_VALACK_IN(  sig, name, type)                              \
19  {                                                                     \
20    sig = interface->set_signal_valack_in (name, type);                 \
21  }                                                                     
22#define ALLOC_VALACK_OUT( sig, name, type)                              \
23  {                                                                     \
24    sig = interface->set_signal_valack_out(name, type);                 \
25  }                                                                     
26#define ALLOC_VAL_IN(     sig)                                          \
27  {                                                                     \
28    sig = interface->set_signal_valack_in (VAL);                        \
29  }                                                                     
30#define ALLOC_VAL_OUT(    sig)                                          \
31  {                                                                     \
32    sig = interface->set_signal_valack_out(VAL);                        \
33  }                                                                     
34#define ALLOC_ACK_IN(     sig)                                          \
35  {                                                                     \
36    sig = interface->set_signal_valack_in (ACK);                        \
37  }                                                                     
38#define ALLOC_ACK_OUT(    sig)                                          \
39  {                                                                     \
40    sig = interface->set_signal_valack_out(ACK);                        \
41  }                                                                     
42#define ALLOC_SIGNAL_IN(  sig, name, type, size)                        \
43  if (size > 0)                                                         \
44    {                                                                   \
45      sig = interface->set_signal_in <type> (name, size);               \
46    }                                                                   
47#define ALLOC_SIGNAL_OUT( sig, name, type, size)                        \
48  if (size > 0)                                                         \
49    {                                                                   \
50      sig = interface->set_signal_out<type> (name, size);               \
51    }
52
53#define ALLOC_SC_SIGNAL(  sig, name, type)                              \
54  sc_signal<type> * sig = new sc_signal<type> (name);
55
56#define INSTANCE_SC_SIGNAL(component, sig)      \
57  (*(component->sig)) (*(sig));
58
59// ----------------------------------------------------------------------
60// -----[ ITERATION 1 ]--------------------------------------------------
61// ----------------------------------------------------------------------
62
63#ifdef POSITION
64#define ALLOC1_INTERFACE( name, direction, localisation, str, it1)      \
65  const uint32_t iterator_1 = it1;                                      \
66  Interface_fifo * interface [iterator_1];                              \
67  {                                                                     \
68    std::string      separator="_";                                     \
69    for (uint32_t i=0; i<iterator_1; i++)                               \
70      {                                                                 \
71        interface [i] = _interfaces->set_interface( name+separator+toString(i), direction, localisation, str); \
72      }                                                                 \
73  }
74#else
75#define ALLOC1_INTERFACE( name, direction, localisation, str, it1)      \
76  const uint32_t iterator_1 = it1;                                      \
77  Interface_fifo * interface [iterator_1];                              \
78  {                                                                     \
79    std::string      separator="_";                                     \
80    for (uint32_t i=0; i<iterator_1; i++)                               \
81      {                                                                 \
82        interface [i] = _interfaces->set_interface( name+separator+toString(i)); \
83      }                                                                 \
84  }
85#endif
86
87
88#define ALLOC1_VALACK_IN( sig, name, type)                              \
89  {                                                                     \
90    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
91    for (uint32_t i=0; i<iterator_1; i++)                               \
92      {                                                                 \
93        sig [i] = interface[i]->set_signal_valack_in (name, type);      \
94      }                                                                 \
95  }
96#define ALLOC1_VALACK_OUT(sig, name, type)                              \
97  {                                                                     \
98    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
99    for (uint32_t i=0; i<iterator_1; i++)                               \
100      {                                                                 \
101        sig [i] = interface[i]->set_signal_valack_out(name, type);      \
102      }                                                                 \
103  }
104#define ALLOC1_VAL_IN(    sig)                                          \
105  {                                                                     \
106    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
107    for (uint32_t i=0; i<iterator_1; i++)                               \
108      {                                                                 \
109        sig [i] = interface[i]->set_signal_valack_in (VAL);             \
110      }                                                                 \
111  }
112#define ALLOC1_VAL_OUT(   sig)                                          \
113  {                                                                     \
114    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
115    for (uint32_t i=0; i<iterator_1; i++)                               \
116      {                                                                 \
117        sig [i] = interface[i]->set_signal_valack_out(VAL);             \
118      }                                                                 \
119  }
120#define ALLOC1_ACK_IN(    sig)                                          \
121  {                                                                     \
122    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
123    for (uint32_t i=0; i<iterator_1; i++)                               \
124      {                                                                 \
125        sig [i] = interface[i]->set_signal_valack_in (ACK);             \
126      }                                                                 \
127  }
128#define ALLOC1_ACK_OUT(   sig)                                          \
129  {                                                                     \
130    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
131    for (uint32_t i=0; i<iterator_1; i++)                               \
132      {                                                                 \
133        sig [i] = interface[i]->set_signal_valack_out(ACK);             \
134      }                                                                 \
135  }
136#define ALLOC1_SIGNAL_IN( sig, name, type, size)                        \
137  if (size > 0)                                                         \
138    {                                                                   \
139      sig = new SC_IN (type) * [iterator_1];                            \
140      for (uint32_t i=0; i<iterator_1; i++)                             \
141        {                                                               \
142          sig [i] = interface[i]->set_signal_in <type> (name, size);    \
143        }                                                               \
144    }
145
146#define ALLOC1_SIGNAL_OUT(sig, name, type, size)                        \
147  if (size > 0)                                                         \
148    {                                                                   \
149      sig = new SC_OUT(type) * [iterator_1];                            \
150      for (uint32_t i=0; i<iterator_1; i++)                             \
151        {                                                               \
152          sig [i] = interface[i]->set_signal_out<type> (name, size);    \
153        }                                                               \
154    }
155
156#define ALLOC1_SC_SIGNAL( sig, name, type, it1)                         \
157  sc_signal<type> ** sig = new sc_signal<type> * [it1];                 \
158  {                                                                     \
159    std::string separator="_";                                          \
160    std::string str;                                                    \
161    for (uint32_t i=0; i<it1; i++)                                      \
162      {                                                                 \
163        str = name+separator+toString(i);                               \
164        sig [i] = new sc_signal<type> (str.c_str());                    \
165      }                                                                 \
166  }
167
168#define INSTANCE1_SC_SIGNAL(component, sig, it1)        \
169  for (uint32_t i=0; i<it1; i++)                        \
170    {                                                   \
171      (*(component->sig[i])) (*(sig[i]));               \
172    }
173
174#endif
Note: See TracBrowser for help on using the repository browser.