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

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

add two component :

  • Write Queue (in Moore version)
  • Execute Queue

add macro to help the interface allocation : Allocation.h

File size: 5.2 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  {                                                                     \
44    sig = interface->set_signal_in <type> (name, size);                 \
45  }                                                                     
46#define ALLOC_SIGNAL_OUT( sig, name, type, size)                        \
47  {                                                                     \
48    sig = interface->set_signal_out<type> (name, size);                 \
49  }
50
51#define ALLOC_SC_SIGNAL(  sig, name, type)                              \
52  sc_signal<type> * sig = new sc_signal<type> (name);
53
54#define INSTANCE_SC_SIGNAL(component, sig)      \
55  (*(component->sig)) (*(sig));
56
57// ----------------------------------------------------------------------
58// -----[ ITERATION 1 ]--------------------------------------------------
59// ----------------------------------------------------------------------
60
61#ifdef POSITION
62#define ALLOC1_INTERFACE( name, direction, localisation, str, it1)      \
63  Interface_fifo * interface [it1];                                     \
64  {                                                                     \
65    std::string      separator="_";                                     \
66    for (uint32_t i=0; i<it1; i++)                                      \
67      {                                                                 \
68        interface [i] = _interfaces->set_interface( name+separator+toString(i), direction, localisation, str); \
69      }                                                                 \
70  }
71#else
72#define ALLOC1_INTERFACE( name, direction, localisation, str, it1)      \
73  Interface_fifo * interface [it1];                                     \
74  {                                                                     \
75    std::string      separator="_";                                     \
76    for (uint32_t i=0; i<it1; i++)                                      \
77      {                                                                 \
78        interface [i] = _interfaces->set_interface( name+separator+toString(i)); \
79      }                                                                 \
80  }
81#endif
82
83
84#define ALLOC1_VALACK_IN( sig, name, type, it1)                         \
85  {                                                                     \
86    sig = new SC_IN (Tcontrol_t) * [it1];                               \
87    for (uint32_t i=0; i<it1; i++)                                      \
88      {                                                                 \
89        sig [i] = interface[i]->set_signal_valack_in (name, type);      \
90      }                                                                 \
91  }
92#define ALLOC1_VALACK_OUT(sig, name, type, it1)                         \
93  {                                                                     \
94    sig = new SC_OUT(Tcontrol_t) * [it1];                               \
95    for (uint32_t i=0; i<it1; i++)                                      \
96      {                                                                 \
97        sig [i] = interface[i]->set_signal_valack_out(name, type);      \
98      }                                                                 \
99  }
100#define ALLOC1_VAL_IN(    sig, it1)                                     \
101  {                                                                     \
102    sig = new SC_IN (Tcontrol_t) * [it1];                               \
103    for (uint32_t i=0; i<it1; i++)                                      \
104      {                                                                 \
105        sig [i] = interface[i]->set_signal_valack_in (VAL);             \
106      }                                                                 \
107  }
108#define ALLOC1_VAL_OUT(   sig, it1)                                     \
109  {                                                                     \
110    sig = new SC_OUT(Tcontrol_t) * [it1];                               \
111    for (uint32_t i=0; i<it1; i++)                                      \
112      {                                                                 \
113        sig [i] = interface[i]->set_signal_valack_out(VAL);             \
114      }                                                                 \
115  }
116#define ALLOC1_ACK_IN(    sig, it1)                                     \
117  {                                                                     \
118    sig = new SC_IN (Tcontrol_t) * [it1];                               \
119    for (uint32_t i=0; i<it1; i++)                                      \
120      {                                                                 \
121        sig [i] = interface[i]->set_signal_valack_in (ACK);             \
122      }                                                                 \
123  }
124#define ALLOC1_ACK_OUT(   sig, it1)                                     \
125  {                                                                     \
126    sig = new SC_OUT(Tcontrol_t) * [it1];                               \
127    for (uint32_t i=0; i<it1; i++)                                      \
128      {                                                                 \
129        sig [i] = interface[i]->set_signal_valack_out(ACK);             \
130      }                                                                 \
131  }
132#define ALLOC1_SIGNAL_IN( sig, name, type, size, it1)                   \
133  {                                                                     \
134    sig = new SC_IN (type) * [it1];                                     \
135    for (uint32_t i=0; i<it1; i++)                                      \
136      {                                                                 \
137        sig [i] = interface[i]->set_signal_in <type> (name, size);      \
138      }                                                                 \
139  }
140
141#define ALLOC1_SIGNAL_OUT(sig, name, type, size, it1)                   \
142  {                                                                     \
143    sig = new SC_OUT(type) * [it1];                                     \
144    for (uint32_t i=0; i<it1; i++)                                      \
145      {                                                                 \
146        sig [i] = interface[i]->set_signal_out<type> (name, size);      \
147      }                                                                 \
148  }
149
150#define ALLOC1_SC_SIGNAL( sig, name, type, it1)                         \
151  sc_signal<type> ** sig = new sc_signal<type> * [it1];                 \
152  {                                                                     \
153    std::string separator="_";                                          \
154    std::string str;                                                    \
155    for (uint32_t i=0; i<it1; i++)                                      \
156      {                                                                 \
157        str = name+separator+toString(i);                               \
158        sig [i] = new sc_signal<type> (str.c_str());                    \
159      }                                                                 \
160  }
161
162#define INSTANCE1_SC_SIGNAL(component, sig, it1)        \
163  for (uint32_t i=0; i<it1; i++)                        \
164    {                                                   \
165      (*(component->sig[i])) (*(sig[i]));               \
166    }
167
168#endif
Note: See TracBrowser for help on using the repository browser.