[73] | 1 | #ifndef Allocation_H |
---|
| 2 | #define Allocation_H |
---|
| 3 | |
---|
| 4 | // Help to allocate interface |
---|
| 5 | |
---|
| 6 | // ---------------------------------------------------------------------- |
---|
| 7 | // -----[ NO ITERATION ]------------------------------------------------- |
---|
| 8 | // ---------------------------------------------------------------------- |
---|
| 9 | |
---|
[78] | 10 | #define __ALLOC_SIGNAL(sig, name, type) \ |
---|
| 11 | { \ |
---|
| 12 | sig = new type (name); \ |
---|
| 13 | } |
---|
| 14 | |
---|
[73] | 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 | |
---|
[78] | 23 | #define ALLOC_VAL_ACK_IN( sig, name, type) \ |
---|
[73] | 24 | { \ |
---|
| 25 | sig = interface->set_signal_valack_in (name, type); \ |
---|
| 26 | } |
---|
[78] | 27 | #define ALLOC_VAL_ACK_OUT( sig, name, type) \ |
---|
[73] | 28 | { \ |
---|
| 29 | sig = interface->set_signal_valack_out(name, type); \ |
---|
| 30 | } |
---|
[78] | 31 | #define ALLOC_VALACK_IN( sig, type) \ |
---|
[73] | 32 | { \ |
---|
[78] | 33 | sig = interface->set_signal_valack_in (type); \ |
---|
[73] | 34 | } |
---|
[78] | 35 | #define ALLOC_VALACK_OUT( sig, type) \ |
---|
[73] | 36 | { \ |
---|
[78] | 37 | sig = interface->set_signal_valack_out(type); \ |
---|
[73] | 38 | } |
---|
| 39 | #define ALLOC_SIGNAL_IN( sig, name, type, size) \ |
---|
[76] | 40 | if (size > 0) \ |
---|
| 41 | { \ |
---|
| 42 | sig = interface->set_signal_in <type> (name, size); \ |
---|
| 43 | } |
---|
[73] | 44 | #define ALLOC_SIGNAL_OUT( sig, name, type, size) \ |
---|
[76] | 45 | if (size > 0) \ |
---|
| 46 | { \ |
---|
| 47 | sig = interface->set_signal_out<type> (name, size); \ |
---|
| 48 | } |
---|
[73] | 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 | |
---|
[78] | 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 | |
---|
[73] | 86 | #ifdef POSITION |
---|
| 87 | #define ALLOC1_INTERFACE( name, direction, localisation, str, it1) \ |
---|
[76] | 88 | const uint32_t iterator_1 = it1; \ |
---|
| 89 | Interface_fifo * interface [iterator_1]; \ |
---|
[73] | 90 | { \ |
---|
[78] | 91 | std::string separator="_"; \ |
---|
| 92 | for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ |
---|
[73] | 93 | { \ |
---|
[78] | 94 | interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \ |
---|
[73] | 95 | } \ |
---|
| 96 | } |
---|
| 97 | #else |
---|
| 98 | #define ALLOC1_INTERFACE( name, direction, localisation, str, it1) \ |
---|
[76] | 99 | const uint32_t iterator_1 = it1; \ |
---|
| 100 | Interface_fifo * interface [iterator_1]; \ |
---|
[73] | 101 | { \ |
---|
[78] | 102 | std::string separator="_"; \ |
---|
| 103 | for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ |
---|
[73] | 104 | { \ |
---|
[78] | 105 | interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \ |
---|
[73] | 106 | } \ |
---|
| 107 | } |
---|
| 108 | #endif |
---|
| 109 | |
---|
[78] | 110 | #define ALLOC1_VAL_ACK_IN( sig, name, type) \ |
---|
[73] | 111 | { \ |
---|
[76] | 112 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 113 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 114 | { \ |
---|
[78] | 115 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \ |
---|
[73] | 116 | } \ |
---|
| 117 | } |
---|
[78] | 118 | #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ |
---|
[73] | 119 | { \ |
---|
[76] | 120 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 121 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 122 | { \ |
---|
[78] | 123 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \ |
---|
[73] | 124 | } \ |
---|
| 125 | } |
---|
[78] | 126 | #define ALLOC1_VALACK_IN( sig, type) \ |
---|
[73] | 127 | { \ |
---|
[76] | 128 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 129 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 130 | { \ |
---|
[78] | 131 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \ |
---|
[73] | 132 | } \ |
---|
| 133 | } |
---|
[78] | 134 | #define ALLOC1_VALACK_OUT( sig, type) \ |
---|
[73] | 135 | { \ |
---|
[76] | 136 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 137 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 138 | { \ |
---|
[78] | 139 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \ |
---|
[73] | 140 | } \ |
---|
| 141 | } |
---|
[76] | 142 | #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ |
---|
| 143 | if (size > 0) \ |
---|
| 144 | { \ |
---|
| 145 | sig = new SC_IN (type) * [iterator_1]; \ |
---|
[78] | 146 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[76] | 147 | { \ |
---|
[78] | 148 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \ |
---|
[76] | 149 | } \ |
---|
| 150 | } |
---|
[73] | 151 | |
---|
[76] | 152 | #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ |
---|
| 153 | if (size > 0) \ |
---|
| 154 | { \ |
---|
| 155 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
[78] | 156 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[76] | 157 | { \ |
---|
[78] | 158 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \ |
---|
[76] | 159 | } \ |
---|
| 160 | } |
---|
[73] | 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; \ |
---|
[78] | 167 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
[73] | 168 | { \ |
---|
[78] | 169 | str = name+separator+toString(alloc_signal_it1); \ |
---|
| 170 | sig [alloc_signal_it1] = new sc_signal<type> (str.c_str()); \ |
---|
[73] | 171 | } \ |
---|
| 172 | } |
---|
| 173 | |
---|
[78] | 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])); \ |
---|
[73] | 178 | } |
---|
| 179 | |
---|
[78] | 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 | } |
---|
[73] | 222 | #endif |
---|
[78] | 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 |
---|