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

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

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
File size: 13.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#define __ALLOC_SIGNAL(sig, name, type)         \
11  {                                             \
12    sig = new type (name);                      \
13  }
14
15#ifdef POSITION
16#define ALLOC_INTERFACE( name, direction, localisation, str)            \
17  Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str);
18#else
19#define ALLOC_INTERFACE( name, direction, localisation, str)            \
20  Interface_fifo * interface = _interfaces->set_interface( name);
21#endif
22
23#define ALLOC_VAL_ACK_IN(  sig, name, type)                             \
24  {                                                                     \
25    sig = interface->set_signal_valack_in (name, type);                 \
26  }                                                                     
27#define ALLOC_VAL_ACK_OUT( sig, name, type)                             \
28  {                                                                     \
29    sig = interface->set_signal_valack_out(name, type);                 \
30  }                                                                     
31#define ALLOC_VALACK_IN(     sig, type)                                 \
32  {                                                                     \
33    sig = interface->set_signal_valack_in (type);                       \
34  }                                                                     
35#define ALLOC_VALACK_OUT(    sig, type)                                 \
36  {                                                                     \
37    sig = interface->set_signal_valack_out(type);                       \
38  }                                                                     
39#define ALLOC_SIGNAL_IN(  sig, name, type, size)                        \
40  if (size > 0)                                                         \
41    {                                                                   \
42      sig = interface->set_signal_in <type> (name, size);               \
43    }                                                                   
44#define ALLOC_SIGNAL_OUT( sig, name, type, size)                        \
45  if (size > 0)                                                         \
46    {                                                                   \
47      sig = interface->set_signal_out<type> (name, size);               \
48    }
49
50#define ALLOC_SC_SIGNAL(  sig, name, type)                              \
51  sc_signal<type> * sig = new sc_signal<type> (name);
52
53#define INSTANCE_SC_SIGNAL(component, sig)      \
54  (*(component->sig)) (*(sig));
55
56// ----------------------------------------------------------------------
57// -----[ ITERATION 1 ]--------------------------------------------------
58// ----------------------------------------------------------------------
59
60#define __ALLOC1_INTERFACE(name, it1)           \
61  const std::string interface_name = name;      \
62  const uint32_t iterator_1 = it1;
63
64#define __ALLOC1_SIGNAL_IN( sig, name, type)            \
65  {                                                                     \
66    sig = new SC_IN(type) * [iterator_1];                               \
67    std::string separator="_";                                          \
68    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
69      {                                                                 \
70        std::string str = "in_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \
71        sig [alloc_signal_it1] = new SC_IN(type) (str.c_str());         \
72      }                                                                 \
73  }
74
75#define __ALLOC1_SIGNAL_OUT( sig, name, type)           \
76  {                                                                     \
77    sig = new SC_OUT(type) * [iterator_1];                              \
78    std::string separator="_";                                          \
79    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
80      {                                                                 \
81        std::string str = "out_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \
82        sig [alloc_signal_it1] = new SC_OUT(type) (str.c_str());                \
83      }                                                                 \
84  }
85
86#ifdef POSITION
87#define ALLOC1_INTERFACE( name, direction, localisation, str, it1)      \
88  const uint32_t iterator_1 = it1;                                      \
89  Interface_fifo * interface [iterator_1];                              \
90  {                                                                     \
91    std::string separator="_";                                          \
92    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
93      {                                                                 \
94        interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \
95      }                                                                 \
96  }
97#else
98#define ALLOC1_INTERFACE( name, direction, localisation, str, it1)      \
99  const uint32_t iterator_1 = it1;                                      \
100  Interface_fifo * interface [iterator_1];                              \
101  {                                                                     \
102    std::string separator="_";                                          \
103    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
104      {                                                                 \
105        interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \
106      }                                                                 \
107  }
108#endif
109
110#define ALLOC1_VAL_ACK_IN( sig, name, type)                             \
111  {                                                                     \
112    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
113    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
114      {                                                                 \
115        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \
116      }                                                                 \
117  }
118#define ALLOC1_VAL_ACK_OUT(sig, name, type)                             \
119  {                                                                     \
120    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
121    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
122      {                                                                 \
123        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \
124      }                                                                 \
125  }
126#define ALLOC1_VALACK_IN(    sig, type)                                 \
127  {                                                                     \
128    sig = new SC_IN (Tcontrol_t) * [iterator_1];                        \
129    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
130      {                                                                 \
131        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \
132      }                                                                 \
133  }
134#define ALLOC1_VALACK_OUT(   sig, type)                                 \
135  {                                                                     \
136    sig = new SC_OUT(Tcontrol_t) * [iterator_1];                        \
137    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
138      {                                                                 \
139        sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \
140      }                                                                 \
141  }
142#define ALLOC1_SIGNAL_IN( sig, name, type, size)                        \
143  if (size > 0)                                                         \
144    {                                                                   \
145      sig = new SC_IN (type) * [iterator_1];                            \
146      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
147        {                                                               \
148          sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \
149        }                                                               \
150    }
151
152#define ALLOC1_SIGNAL_OUT(sig, name, type, size)                        \
153  if (size > 0)                                                         \
154    {                                                                   \
155      sig = new SC_OUT(type) * [iterator_1];                            \
156      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \
157        {                                                               \
158          sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \
159        }                                                               \
160    }
161
162#define ALLOC1_SC_SIGNAL( sig, name, type, it1)                         \
163  sc_signal<type> ** sig = new sc_signal<type> * [it1];                 \
164  {                                                                     \
165    std::string separator="_";                                          \
166    std::string str;                                                    \
167    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
168      {                                                                 \
169        str = name+separator+toString(alloc_signal_it1);                \
170        sig [alloc_signal_it1] = new sc_signal<type> (str.c_str());     \
171      }                                                                 \
172  }
173
174#define INSTANCE1_SC_SIGNAL(component, sig, it1)                        \
175  for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
176    {                                                                   \
177      (*(component->sig[alloc_signal_it1])) (*(sig[alloc_signal_it1])); \
178    }
179
180// ----------------------------------------------------------------------
181// -----[ ITERATION 2 ]--------------------------------------------------
182// ----------------------------------------------------------------------
183
184#ifdef POSITION
185#define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \
186  uint32_t iterator_1 = 0;                                              \
187  uint32_t iterator_2 = 0;                                              \
188  Interface_fifo *** interface;                                         \
189  {                                                                     \
190    std::string separator="_";                                          \
191    iterator_1 = it1;                                                   \
192    interface = new Interface_fifo ** [iterator_1];                     \
193    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
194      {                                                                 \
195        iterator_2 = it2;                                               \
196        interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \
197        for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \
198          {                                                             \
199            interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2), direction, localisation, str); \
200          }                                                             \
201      }                                                                 \
202  }
203#else
204#define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \
205  uint32_t iterator_1 = 0;                                              \
206  uint32_t iterator_2 = 0;                                              \
207  Interface_fifo *** interface;                                         \
208  {                                                                     \
209    std::string separator="_";                                          \
210    iterator_1 = it1;                                                   \
211    interface = new Interface_fifo ** [iterator_1];                     \
212    for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \
213      {                                                                 \
214        iterator_2 = it2;                                               \
215        interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \
216        for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \
217          {                                                             \
218            interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2)); \
219          }                                                             \
220      }                                                                 \
221  }
222#endif
223
224#define _ALLOC2_VAL_ACK_IN( sig, name, type, it1, it2)                  \
225  {                                                                     \
226    sig = new SC_IN (Tcontrol_t) ** [it1];                              \
227    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
228      {                                                                 \
229        sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2];        \
230        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
231          {                                                             \
232            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (name, type); \
233          }                                                             \
234      }                                                                 \
235  }
236
237#define _ALLOC2_VAL_ACK_OUT( sig, name, type, it1, it2)                 \
238  {                                                                     \
239    sig = new SC_OUT (Tcontrol_t) ** [it1];                             \
240    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
241      {                                                                 \
242        sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2];       \
243        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
244          {                                                             \
245            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (name, type); \
246          }                                                             \
247      }                                                                 \
248  }
249
250#define _ALLOC2_VALACK_IN(    sig,type, it1, it2)                       \
251  {                                                                     \
252    sig = new SC_IN (Tcontrol_t) ** [it1];                              \
253    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
254      {                                                                 \
255        sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2];        \
256        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
257          {                                                             \
258            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (type); \
259          }                                                             \
260      }                                                                 \
261  }
262
263#define _ALLOC2_VALACK_OUT(    sig,type, it1, it2)                      \
264  {                                                                     \
265    sig = new SC_OUT (Tcontrol_t) ** [it1];                             \
266    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
267      {                                                                 \
268        sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2];       \
269        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
270          {                                                             \
271            sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (type); \
272          }                                                             \
273      }                                                                 \
274  }
275
276#define _ALLOC2_SIGNAL_IN( sig, name, type, size, it1, it2)             \
277  if (size > 0)                                                         \
278    {                                                                   \
279      sig = new SC_IN (type) ** [it1];                                  \
280      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
281        {                                                               \
282          sig [alloc_signal_it1] = new SC_IN (type) * [it2];            \
283          for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
284            {                                                           \
285              sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_in <type> (name, size); \
286            }                                                           \
287        }                                                               \
288    }
289
290#define _ALLOC2_SIGNAL_OUT( sig, name, type, size, it1, it2)            \
291  if (size > 0)                                                         \
292    {                                                                   \
293      sig = new SC_OUT (type) ** [it1];                                 \
294      for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
295        {                                                               \
296          sig [alloc_signal_it1] = new SC_OUT (type) * [it2];           \
297          for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
298            {                                                           \
299              sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_out <type> (name, size); \
300            }                                                           \
301        }                                                               \
302    }
303
304#define ALLOC2_VAL_ACK_IN( sig, name, type      ) _ALLOC2_VAL_ACK_IN( sig, name, type      , iterator_1, iterator_2)
305#define ALLOC2_VAL_ACK_OUT(sig, name, type      ) _ALLOC2_VAL_ACK_OUT(sig, name, type      , iterator_1, iterator_2)
306#define ALLOC2_VALACK_IN(  sig,       type      ) _ALLOC2_VALACK_IN(  sig,       type      , iterator_1, iterator_2)
307#define ALLOC2_VALACK_OUT( sig,       type      ) _ALLOC2_VALACK_OUT( sig,       type      , iterator_1, iterator_2)
308#define ALLOC2_SIGNAL_IN(  sig, name, type, size) _ALLOC2_SIGNAL_IN(  sig, name, type, size, iterator_1, iterator_2)
309#define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2)
310
311#define ALLOC2_SC_SIGNAL( sig, name, type, it1, it2)                    \
312  sc_signal<type> *** sig = new sc_signal<type> ** [it1];               \
313  {                                                                     \
314    std::string separator="_";                                          \
315    std::string str;                                                    \
316    for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
317      {                                                                 \
318        sig [alloc_signal_it1] = new sc_signal<type> * [it2];           \
319        for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
320          {                                                             \
321            str = name+separator+toString(alloc_signal_it1)+separator+toString(alloc_signal_it2); \
322            sig [alloc_signal_it1][alloc_signal_it2] = new sc_signal<type> (str.c_str()); \
323          }                                                             \
324      }                                                                 \
325  }
326
327#define INSTANCE2_SC_SIGNAL(component, sig, it1, it2)                   \
328  for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \
329    for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \
330      {                                                                 \
331        (*(component->sig[alloc_signal_it1][alloc_signal_it2])) (*(sig[alloc_signal_it1][alloc_signal_it2])); \
332      }
333#endif
Note: See TracBrowser for help on using the repository browser.