[81] | 1 | #ifndef morpheo_behavioural_Allocation_h |
---|
| 2 | #define morpheo_behavioural_Allocation_h |
---|
[73] | 3 | |
---|
[81] | 4 | #include "Common/include/Debug.h" |
---|
| 5 | |
---|
[73] | 6 | // Help to allocate interface |
---|
[81] | 7 | #define INTERFACE_PRINT(name) log_printf(TRACE,true,"allocation","Interface's creation : %s (%s, %d)",name,__FILE__,__LINE__); |
---|
[73] | 8 | |
---|
| 9 | // ---------------------------------------------------------------------- |
---|
| 10 | // -----[ NO ITERATION ]------------------------------------------------- |
---|
| 11 | // ---------------------------------------------------------------------- |
---|
| 12 | |
---|
[78] | 13 | #define __ALLOC_SIGNAL(sig, name, type) \ |
---|
| 14 | { \ |
---|
| 15 | sig = new type (name); \ |
---|
| 16 | } |
---|
| 17 | |
---|
[73] | 18 | #ifdef POSITION |
---|
| 19 | #define ALLOC_INTERFACE( name, direction, localisation, str) \ |
---|
[81] | 20 | INTERFACE_PRINT(name); \ |
---|
[73] | 21 | Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str); |
---|
| 22 | #else |
---|
| 23 | #define ALLOC_INTERFACE( name, direction, localisation, str) \ |
---|
[81] | 24 | INTERFACE_PRINT(name); \ |
---|
[73] | 25 | Interface_fifo * interface = _interfaces->set_interface( name); |
---|
| 26 | #endif |
---|
| 27 | |
---|
[78] | 28 | #define ALLOC_VAL_ACK_IN( sig, name, type) \ |
---|
[73] | 29 | { \ |
---|
| 30 | sig = interface->set_signal_valack_in (name, type); \ |
---|
| 31 | } |
---|
[78] | 32 | #define ALLOC_VAL_ACK_OUT( sig, name, type) \ |
---|
[73] | 33 | { \ |
---|
| 34 | sig = interface->set_signal_valack_out(name, type); \ |
---|
| 35 | } |
---|
[78] | 36 | #define ALLOC_VALACK_IN( sig, type) \ |
---|
[73] | 37 | { \ |
---|
[78] | 38 | sig = interface->set_signal_valack_in (type); \ |
---|
[73] | 39 | } |
---|
[78] | 40 | #define ALLOC_VALACK_OUT( sig, type) \ |
---|
[73] | 41 | { \ |
---|
[78] | 42 | sig = interface->set_signal_valack_out(type); \ |
---|
[73] | 43 | } |
---|
| 44 | #define ALLOC_SIGNAL_IN( sig, name, type, size) \ |
---|
[76] | 45 | if (size > 0) \ |
---|
| 46 | { \ |
---|
| 47 | sig = interface->set_signal_in <type> (name, size); \ |
---|
| 48 | } |
---|
[73] | 49 | #define ALLOC_SIGNAL_OUT( sig, name, type, size) \ |
---|
[76] | 50 | if (size > 0) \ |
---|
| 51 | { \ |
---|
| 52 | sig = interface->set_signal_out<type> (name, size); \ |
---|
| 53 | } |
---|
[73] | 54 | |
---|
[81] | 55 | #define DELETE_SIGNAL( sig, size) \ |
---|
| 56 | if (size > 0) \ |
---|
| 57 | { \ |
---|
| 58 | delete sig; \ |
---|
| 59 | } |
---|
| 60 | |
---|
[73] | 61 | #define ALLOC_SC_SIGNAL( sig, name, type) \ |
---|
| 62 | sc_signal<type> * sig = new sc_signal<type> (name); |
---|
| 63 | |
---|
| 64 | #define INSTANCE_SC_SIGNAL(component, sig) \ |
---|
| 65 | (*(component->sig)) (*(sig)); |
---|
| 66 | |
---|
[81] | 67 | #define DELETE_SC_SIGNAL( sig) \ |
---|
| 68 | delete sig; |
---|
| 69 | |
---|
[73] | 70 | // ---------------------------------------------------------------------- |
---|
| 71 | // -----[ ITERATION 1 ]-------------------------------------------------- |
---|
| 72 | // ---------------------------------------------------------------------- |
---|
| 73 | |
---|
[81] | 74 | #define __ALLOC1_INTERFACE(name, it1) \ |
---|
| 75 | INTERFACE_PRINT(name); \ |
---|
| 76 | const std::string interface_name = name; \ |
---|
[78] | 77 | const uint32_t iterator_1 = it1; |
---|
| 78 | |
---|
| 79 | #define __ALLOC1_SIGNAL_IN( sig, name, type) \ |
---|
| 80 | { \ |
---|
| 81 | sig = new SC_IN(type) * [iterator_1]; \ |
---|
| 82 | std::string separator="_"; \ |
---|
| 83 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
| 84 | { \ |
---|
| 85 | std::string str = "in_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \ |
---|
| 86 | sig [alloc_signal_it1] = new SC_IN(type) (str.c_str()); \ |
---|
| 87 | } \ |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ |
---|
| 91 | { \ |
---|
| 92 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
| 93 | std::string separator="_"; \ |
---|
| 94 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
| 95 | { \ |
---|
| 96 | std::string str = "out_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \ |
---|
| 97 | sig [alloc_signal_it1] = new SC_OUT(type) (str.c_str()); \ |
---|
| 98 | } \ |
---|
| 99 | } |
---|
| 100 | |
---|
[73] | 101 | #ifdef POSITION |
---|
| 102 | #define ALLOC1_INTERFACE( name, direction, localisation, str, it1) \ |
---|
[81] | 103 | INTERFACE_PRINT(name); \ |
---|
[76] | 104 | const uint32_t iterator_1 = it1; \ |
---|
| 105 | Interface_fifo * interface [iterator_1]; \ |
---|
[73] | 106 | { \ |
---|
[78] | 107 | std::string separator="_"; \ |
---|
| 108 | for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ |
---|
[73] | 109 | { \ |
---|
[78] | 110 | interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \ |
---|
[73] | 111 | } \ |
---|
| 112 | } |
---|
| 113 | #else |
---|
| 114 | #define ALLOC1_INTERFACE( name, direction, localisation, str, it1) \ |
---|
[81] | 115 | INTERFACE_PRINT(name); \ |
---|
[76] | 116 | const uint32_t iterator_1 = it1; \ |
---|
| 117 | Interface_fifo * interface [iterator_1]; \ |
---|
[73] | 118 | { \ |
---|
[78] | 119 | std::string separator="_"; \ |
---|
| 120 | for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ |
---|
[73] | 121 | { \ |
---|
[78] | 122 | interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \ |
---|
[73] | 123 | } \ |
---|
| 124 | } |
---|
| 125 | #endif |
---|
| 126 | |
---|
[78] | 127 | #define ALLOC1_VAL_ACK_IN( sig, name, type) \ |
---|
[73] | 128 | { \ |
---|
[76] | 129 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 130 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 131 | { \ |
---|
[78] | 132 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \ |
---|
[73] | 133 | } \ |
---|
| 134 | } |
---|
[78] | 135 | #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ |
---|
[73] | 136 | { \ |
---|
[76] | 137 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 138 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 139 | { \ |
---|
[78] | 140 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \ |
---|
[73] | 141 | } \ |
---|
| 142 | } |
---|
[78] | 143 | #define ALLOC1_VALACK_IN( sig, type) \ |
---|
[73] | 144 | { \ |
---|
[76] | 145 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 146 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 147 | { \ |
---|
[78] | 148 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \ |
---|
[73] | 149 | } \ |
---|
| 150 | } |
---|
[78] | 151 | #define ALLOC1_VALACK_OUT( sig, type) \ |
---|
[73] | 152 | { \ |
---|
[76] | 153 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
[78] | 154 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
[73] | 155 | { \ |
---|
[78] | 156 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \ |
---|
[73] | 157 | } \ |
---|
| 158 | } |
---|
[76] | 159 | #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ |
---|
[81] | 160 | { \ |
---|
| 161 | sig = new SC_IN (type) * [iterator_1]; \ |
---|
| 162 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
| 163 | { \ |
---|
| 164 | if (size > 0) \ |
---|
| 165 | { \ |
---|
| 166 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \ |
---|
| 167 | } \ |
---|
| 168 | } \ |
---|
| 169 | } |
---|
[73] | 170 | |
---|
[76] | 171 | #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ |
---|
[81] | 172 | { \ |
---|
| 173 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
| 174 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ |
---|
| 175 | { \ |
---|
| 176 | if (size > 0) \ |
---|
| 177 | { \ |
---|
| 178 | sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \ |
---|
| 179 | } \ |
---|
| 180 | } \ |
---|
| 181 | } |
---|
[73] | 182 | |
---|
[81] | 183 | #define DELETE1_SIGNAL(sig, it1, size) \ |
---|
| 184 | { \ |
---|
| 185 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 186 | { \ |
---|
| 187 | if (size > 0) \ |
---|
| 188 | { \ |
---|
| 189 | delete sig[alloc_signal_it1]; \ |
---|
| 190 | } \ |
---|
| 191 | } \ |
---|
| 192 | delete [] sig; \ |
---|
| 193 | } |
---|
| 194 | |
---|
[73] | 195 | #define ALLOC1_SC_SIGNAL( sig, name, type, it1) \ |
---|
| 196 | sc_signal<type> ** sig = new sc_signal<type> * [it1]; \ |
---|
| 197 | { \ |
---|
| 198 | std::string separator="_"; \ |
---|
| 199 | std::string str; \ |
---|
[78] | 200 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
[73] | 201 | { \ |
---|
[78] | 202 | str = name+separator+toString(alloc_signal_it1); \ |
---|
| 203 | sig [alloc_signal_it1] = new sc_signal<type> (str.c_str()); \ |
---|
[73] | 204 | } \ |
---|
| 205 | } |
---|
| 206 | |
---|
[78] | 207 | #define INSTANCE1_SC_SIGNAL(component, sig, it1) \ |
---|
| 208 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 209 | { \ |
---|
| 210 | (*(component->sig[alloc_signal_it1])) (*(sig[alloc_signal_it1])); \ |
---|
[73] | 211 | } |
---|
| 212 | |
---|
[81] | 213 | #define DELETE1_SC_SIGNAL(sig, it1) \ |
---|
| 214 | { \ |
---|
| 215 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 216 | { \ |
---|
| 217 | delete sig[alloc_signal_it1]; \ |
---|
| 218 | } \ |
---|
| 219 | delete [] sig; \ |
---|
| 220 | } |
---|
| 221 | |
---|
[78] | 222 | // ---------------------------------------------------------------------- |
---|
| 223 | // -----[ ITERATION 2 ]-------------------------------------------------- |
---|
| 224 | // ---------------------------------------------------------------------- |
---|
| 225 | |
---|
| 226 | #ifdef POSITION |
---|
| 227 | #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \ |
---|
[81] | 228 | INTERFACE_PRINT(name); \ |
---|
[78] | 229 | uint32_t iterator_1 = 0; \ |
---|
| 230 | uint32_t iterator_2 = 0; \ |
---|
| 231 | Interface_fifo *** interface; \ |
---|
| 232 | { \ |
---|
| 233 | std::string separator="_"; \ |
---|
| 234 | iterator_1 = it1; \ |
---|
| 235 | interface = new Interface_fifo ** [iterator_1]; \ |
---|
| 236 | for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ |
---|
| 237 | { \ |
---|
| 238 | iterator_2 = it2; \ |
---|
| 239 | interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \ |
---|
| 240 | for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \ |
---|
| 241 | { \ |
---|
| 242 | interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2), direction, localisation, str); \ |
---|
| 243 | } \ |
---|
| 244 | } \ |
---|
| 245 | } |
---|
| 246 | #else |
---|
| 247 | #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2) \ |
---|
[81] | 248 | INTERFACE_PRINT(name); \ |
---|
[78] | 249 | uint32_t iterator_1 = 0; \ |
---|
| 250 | uint32_t iterator_2 = 0; \ |
---|
| 251 | Interface_fifo *** interface; \ |
---|
| 252 | { \ |
---|
| 253 | std::string separator="_"; \ |
---|
| 254 | iterator_1 = it1; \ |
---|
| 255 | interface = new Interface_fifo ** [iterator_1]; \ |
---|
| 256 | for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++) \ |
---|
| 257 | { \ |
---|
| 258 | iterator_2 = it2; \ |
---|
| 259 | interface [alloc_interface_it1] = new Interface_fifo * [iterator_2]; \ |
---|
| 260 | for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++) \ |
---|
| 261 | { \ |
---|
| 262 | interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2)); \ |
---|
| 263 | } \ |
---|
| 264 | } \ |
---|
| 265 | } |
---|
[73] | 266 | #endif |
---|
[78] | 267 | |
---|
| 268 | #define _ALLOC2_VAL_ACK_IN( sig, name, type, it1, it2) \ |
---|
| 269 | { \ |
---|
| 270 | sig = new SC_IN (Tcontrol_t) ** [it1]; \ |
---|
| 271 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 272 | { \ |
---|
| 273 | sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2]; \ |
---|
| 274 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 275 | { \ |
---|
| 276 | sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (name, type); \ |
---|
| 277 | } \ |
---|
| 278 | } \ |
---|
| 279 | } |
---|
| 280 | |
---|
| 281 | #define _ALLOC2_VAL_ACK_OUT( sig, name, type, it1, it2) \ |
---|
| 282 | { \ |
---|
| 283 | sig = new SC_OUT (Tcontrol_t) ** [it1]; \ |
---|
| 284 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 285 | { \ |
---|
| 286 | sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2]; \ |
---|
| 287 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 288 | { \ |
---|
| 289 | sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (name, type); \ |
---|
| 290 | } \ |
---|
| 291 | } \ |
---|
| 292 | } |
---|
| 293 | |
---|
| 294 | #define _ALLOC2_VALACK_IN( sig,type, it1, it2) \ |
---|
| 295 | { \ |
---|
| 296 | sig = new SC_IN (Tcontrol_t) ** [it1]; \ |
---|
| 297 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 298 | { \ |
---|
| 299 | sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2]; \ |
---|
| 300 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 301 | { \ |
---|
| 302 | sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (type); \ |
---|
| 303 | } \ |
---|
| 304 | } \ |
---|
| 305 | } |
---|
| 306 | |
---|
| 307 | #define _ALLOC2_VALACK_OUT( sig,type, it1, it2) \ |
---|
| 308 | { \ |
---|
| 309 | sig = new SC_OUT (Tcontrol_t) ** [it1]; \ |
---|
| 310 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 311 | { \ |
---|
| 312 | sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2]; \ |
---|
| 313 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 314 | { \ |
---|
| 315 | sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (type); \ |
---|
| 316 | } \ |
---|
| 317 | } \ |
---|
| 318 | } |
---|
| 319 | |
---|
| 320 | #define _ALLOC2_SIGNAL_IN( sig, name, type, size, it1, it2) \ |
---|
[81] | 321 | { \ |
---|
| 322 | sig = new SC_IN (type) ** [it1]; \ |
---|
| 323 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 324 | { \ |
---|
| 325 | sig [alloc_signal_it1] = new SC_IN (type) * [it2]; \ |
---|
| 326 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 327 | { \ |
---|
| 328 | if (size > 0) \ |
---|
| 329 | { \ |
---|
| 330 | sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_in <type> (name, size); \ |
---|
| 331 | } \ |
---|
| 332 | } \ |
---|
| 333 | } \ |
---|
| 334 | } |
---|
[78] | 335 | |
---|
| 336 | #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, it1, it2) \ |
---|
[81] | 337 | { \ |
---|
| 338 | sig = new SC_OUT (type) ** [it1]; \ |
---|
| 339 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 340 | { \ |
---|
| 341 | sig [alloc_signal_it1] = new SC_OUT (type) * [it2]; \ |
---|
| 342 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 343 | { \ |
---|
| 344 | if (size > 0) \ |
---|
| 345 | { \ |
---|
| 346 | sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_out <type> (name, size); \ |
---|
| 347 | } \ |
---|
| 348 | } \ |
---|
| 349 | } \ |
---|
| 350 | } |
---|
[78] | 351 | |
---|
| 352 | #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) |
---|
| 353 | #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) |
---|
| 354 | #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) |
---|
| 355 | #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) |
---|
| 356 | #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) |
---|
| 357 | #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) |
---|
| 358 | |
---|
[81] | 359 | #define DELETE2_SIGNAL(sig, it1,it2, size) \ |
---|
| 360 | { \ |
---|
| 361 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 362 | { \ |
---|
| 363 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 364 | { \ |
---|
| 365 | if (size > 0) \ |
---|
| 366 | { \ |
---|
| 367 | delete sig[alloc_signal_it1][alloc_signal_it2]; \ |
---|
| 368 | } \ |
---|
| 369 | } \ |
---|
| 370 | delete [] sig[alloc_signal_it1]; \ |
---|
| 371 | } \ |
---|
| 372 | delete [] sig; \ |
---|
| 373 | } |
---|
| 374 | |
---|
[78] | 375 | #define ALLOC2_SC_SIGNAL( sig, name, type, it1, it2) \ |
---|
| 376 | sc_signal<type> *** sig = new sc_signal<type> ** [it1]; \ |
---|
| 377 | { \ |
---|
| 378 | std::string separator="_"; \ |
---|
| 379 | std::string str; \ |
---|
| 380 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 381 | { \ |
---|
| 382 | sig [alloc_signal_it1] = new sc_signal<type> * [it2]; \ |
---|
| 383 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 384 | { \ |
---|
| 385 | str = name+separator+toString(alloc_signal_it1)+separator+toString(alloc_signal_it2); \ |
---|
| 386 | sig [alloc_signal_it1][alloc_signal_it2] = new sc_signal<type> (str.c_str()); \ |
---|
| 387 | } \ |
---|
| 388 | } \ |
---|
| 389 | } |
---|
| 390 | |
---|
| 391 | #define INSTANCE2_SC_SIGNAL(component, sig, it1, it2) \ |
---|
| 392 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 393 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 394 | { \ |
---|
| 395 | (*(component->sig[alloc_signal_it1][alloc_signal_it2])) (*(sig[alloc_signal_it1][alloc_signal_it2])); \ |
---|
| 396 | } |
---|
[81] | 397 | |
---|
| 398 | #define DELETE2_SC_SIGNAL(sig,it1,it2) \ |
---|
| 399 | { \ |
---|
| 400 | for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ |
---|
| 401 | { \ |
---|
| 402 | for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ |
---|
| 403 | { \ |
---|
| 404 | delete sig[alloc_signal_it1][alloc_signal_it2]; \ |
---|
| 405 | } \ |
---|
| 406 | delete [] sig[alloc_signal_it1]; \ |
---|
| 407 | } \ |
---|
| 408 | delete [] sig; \ |
---|
| 409 | } |
---|
| 410 | |
---|
[78] | 411 | #endif |
---|