[81] | 1 | #ifndef morpheo_behavioural_Allocation_h |
---|
| 2 | #define morpheo_behavioural_Allocation_h |
---|
[73] | 3 | |
---|
[82] | 4 | /* |
---|
| 5 | * $Id: Allocation.h 128 2009-06-26 08:43:23Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
[81] | 11 | #include "Common/include/Debug.h" |
---|
| 12 | |
---|
[88] | 13 | // ====================================================================== |
---|
| 14 | // =====[ ALLOCATION / DELETE of ARRAY ]================================= |
---|
| 15 | // ====================================================================== |
---|
[112] | 16 | #define ALLOC0(var,type) \ |
---|
[128] | 17 | do \ |
---|
| 18 | { \ |
---|
| 19 | var = new type; \ |
---|
| 20 | } while (0) |
---|
[112] | 21 | |
---|
[128] | 22 | #define ALLOC1(var,type,s1) \ |
---|
| 23 | do \ |
---|
| 24 | { \ |
---|
| 25 | var = new type [s1]; \ |
---|
| 26 | } while (0) |
---|
| 27 | |
---|
[88] | 28 | #define ALLOC2(var,type,s1,s2) \ |
---|
[128] | 29 | do \ |
---|
[88] | 30 | { \ |
---|
[128] | 31 | var = new type * [s1]; \ |
---|
| 32 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
| 33 | { \ |
---|
| 34 | var [it1] = new type [s2]; \ |
---|
| 35 | } \ |
---|
| 36 | } while (0) |
---|
[88] | 37 | |
---|
| 38 | #define ALLOC3(var,type,s1,s2,s3) \ |
---|
[128] | 39 | do \ |
---|
[88] | 40 | { \ |
---|
[128] | 41 | var = new type ** [s1]; \ |
---|
| 42 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
[88] | 43 | { \ |
---|
[128] | 44 | var [it1] = new type * [s2]; \ |
---|
| 45 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
| 46 | { \ |
---|
| 47 | var [it1][it2] = new type [s3]; \ |
---|
| 48 | } \ |
---|
[88] | 49 | } \ |
---|
[128] | 50 | } while (0) |
---|
| 51 | |
---|
[88] | 52 | #define ALLOC4(var,type,s1,s2,s3,s4) \ |
---|
[128] | 53 | do \ |
---|
[88] | 54 | { \ |
---|
[128] | 55 | var = new type *** [s1]; \ |
---|
| 56 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
[88] | 57 | { \ |
---|
[128] | 58 | var [it1] = new type ** [s2]; \ |
---|
| 59 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
[88] | 60 | { \ |
---|
[128] | 61 | var [it1][it2] = new type * [s3]; \ |
---|
| 62 | for (uint32_t it3=0; it3<s3; ++it3) \ |
---|
| 63 | { \ |
---|
| 64 | var [it1][it2][it3] = new type [s4]; \ |
---|
| 65 | } \ |
---|
[88] | 66 | } \ |
---|
| 67 | } \ |
---|
[128] | 68 | } while (0) |
---|
[111] | 69 | |
---|
| 70 | #define DELETE0(var) \ |
---|
[128] | 71 | do \ |
---|
| 72 | { \ |
---|
| 73 | delete var; \ |
---|
| 74 | } while (0) |
---|
[88] | 75 | |
---|
[128] | 76 | #define DELETE1(var,s1) \ |
---|
| 77 | do \ |
---|
| 78 | { \ |
---|
| 79 | delete [] var; \ |
---|
| 80 | } while (0) |
---|
| 81 | |
---|
| 82 | #define DELETE2(var,s1,s2) \ |
---|
| 83 | do \ |
---|
[88] | 84 | { \ |
---|
[128] | 85 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
[88] | 86 | { \ |
---|
[128] | 87 | delete [] var [it1]; \ |
---|
[88] | 88 | } \ |
---|
[128] | 89 | delete [] var; \ |
---|
| 90 | } while (0) |
---|
| 91 | |
---|
| 92 | #define DELETE3(var,s1,s2,s3) \ |
---|
| 93 | do \ |
---|
[88] | 94 | { \ |
---|
[128] | 95 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
[88] | 96 | { \ |
---|
[128] | 97 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
[88] | 98 | { \ |
---|
[128] | 99 | delete [] var [it1][it2]; \ |
---|
[88] | 100 | } \ |
---|
[128] | 101 | delete [] var [it1]; \ |
---|
[88] | 102 | } \ |
---|
[128] | 103 | delete [] var; \ |
---|
| 104 | } while (0) |
---|
[88] | 105 | |
---|
[128] | 106 | #define DELETE4(var,s1,s2,s3,s4) \ |
---|
| 107 | do \ |
---|
| 108 | { \ |
---|
| 109 | for (uint32_t it1=0; it1<s1; ++it1) \ |
---|
| 110 | { \ |
---|
| 111 | for (uint32_t it2=0; it2<s2; ++it2) \ |
---|
| 112 | { \ |
---|
| 113 | for (uint32_t it3=0; it3<s3; ++it3) \ |
---|
| 114 | { \ |
---|
| 115 | delete [] var [it1][it2][it3]; \ |
---|
| 116 | } \ |
---|
| 117 | delete [] var [it1][it2]; \ |
---|
| 118 | } \ |
---|
| 119 | delete [] var [it1]; \ |
---|
| 120 | } \ |
---|
| 121 | delete [] var; \ |
---|
| 122 | } while (0) |
---|
| 123 | |
---|
[88] | 124 | // ====================================================================== |
---|
| 125 | // =====[ ALLOCATION / DELETE of SIGNAL]================================= |
---|
| 126 | // ====================================================================== |
---|
| 127 | |
---|
[73] | 128 | // Help to allocate interface |
---|
[88] | 129 | #define INTERFACE_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : Interface's creation : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__); |
---|
| 130 | #define PRINT_SIGNAL_ADDRESS(name,address) log_printf(TRACE,Allocation,FUNCTION,"Signal : %s 0x%.8x(%s, %d)",name,(uint32_t)((uint64_t)(address)),__FILE__,__LINE__); |
---|
| 131 | #define PRINT_SIZE_NUL(component,interface,signal) log_printf(TRACE,Allocation,FUNCTION,_("<%s> %s.%s.%s : size is nul."),_name.c_str(),component->get_name().c_str(),interface->get_name().c_str(),signal); |
---|
| 132 | #define TEST_SIGNAL(name,address) PRINT_SIGNAL_ADDRESS(name,address); TEST_PTR(address) |
---|
[113] | 133 | #define INSTANCE_FOREIGN_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__); |
---|
[73] | 134 | |
---|
| 135 | // ---------------------------------------------------------------------- |
---|
| 136 | // -----[ NO ITERATION ]------------------------------------------------- |
---|
| 137 | // ---------------------------------------------------------------------- |
---|
| 138 | |
---|
[113] | 139 | #define __ALLOC0_SIGNAL(sig, name, type) \ |
---|
[128] | 140 | do \ |
---|
| 141 | { \ |
---|
| 142 | sig = new type (name); \ |
---|
| 143 | } while (0) |
---|
[78] | 144 | |
---|
[73] | 145 | #ifdef POSITION |
---|
[113] | 146 | #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) \ |
---|
[88] | 147 | INTERFACE_PRINT(name); \ |
---|
| 148 | morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str); |
---|
[73] | 149 | #else |
---|
[113] | 150 | #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) \ |
---|
[88] | 151 | INTERFACE_PRINT(name); \ |
---|
| 152 | morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name); |
---|
[73] | 153 | #endif |
---|
| 154 | |
---|
[112] | 155 | #define ALLOC0_INTERFACE_END() |
---|
| 156 | |
---|
[113] | 157 | #define ALLOC0_VAL_ACK_IN( sig, name, type) \ |
---|
[128] | 158 | do \ |
---|
| 159 | { \ |
---|
| 160 | sig = interface->set_signal_valack_in (name, type); \ |
---|
| 161 | } while (0) |
---|
| 162 | |
---|
[113] | 163 | #define ALLOC0_VAL_ACK_OUT( sig, name, type) \ |
---|
[128] | 164 | do \ |
---|
| 165 | { \ |
---|
| 166 | sig = interface->set_signal_valack_out(name, type); \ |
---|
| 167 | } while (0) |
---|
| 168 | |
---|
[113] | 169 | #define ALLOC0_VALACK_IN( sig, type) \ |
---|
[128] | 170 | do \ |
---|
[88] | 171 | { \ |
---|
[128] | 172 | sig = interface->set_signal_valack_in (type); \ |
---|
| 173 | } while (0) |
---|
| 174 | |
---|
| 175 | #define ALLOC0_VALACK_OUT( sig, type) \ |
---|
| 176 | do \ |
---|
[88] | 177 | { \ |
---|
[128] | 178 | sig = interface->set_signal_valack_out(type); \ |
---|
| 179 | } while (0) |
---|
| 180 | |
---|
| 181 | #define ALLOC0_SIGNAL_IN( sig, name, type, size) \ |
---|
| 182 | do \ |
---|
[88] | 183 | { \ |
---|
[128] | 184 | if (size > 0) \ |
---|
| 185 | { \ |
---|
| 186 | sig = interface->set_signal_in <type> (name, size); \ |
---|
| 187 | } \ |
---|
| 188 | else \ |
---|
| 189 | { \ |
---|
| 190 | PRINT_SIZE_NUL(_component,interface,name); \ |
---|
| 191 | } \ |
---|
| 192 | } while (0) |
---|
| 193 | |
---|
| 194 | #define ALLOC0_SIGNAL_OUT( sig, name, type, size) \ |
---|
| 195 | do \ |
---|
[88] | 196 | { \ |
---|
[128] | 197 | if (size > 0) \ |
---|
| 198 | { \ |
---|
| 199 | sig = interface->set_signal_out<type> (name, size); \ |
---|
| 200 | } \ |
---|
| 201 | else \ |
---|
| 202 | { \ |
---|
| 203 | PRINT_SIZE_NUL(_component,interface,name); \ |
---|
| 204 | } \ |
---|
| 205 | } while (0) |
---|
[73] | 206 | |
---|
[113] | 207 | #define DELETE0_SIGNAL( sig, size) \ |
---|
[128] | 208 | do \ |
---|
[88] | 209 | { \ |
---|
[128] | 210 | if (size > 0) \ |
---|
| 211 | { \ |
---|
| 212 | delete sig; \ |
---|
| 213 | } \ |
---|
| 214 | } while (0) |
---|
[81] | 215 | |
---|
[113] | 216 | #define ALLOC0_FOREIGN_SIGNAL_IN( sig, interface, name, type, size) \ |
---|
[128] | 217 | do \ |
---|
[113] | 218 | { \ |
---|
[128] | 219 | if (size > 0) \ |
---|
| 220 | { \ |
---|
| 221 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \ |
---|
| 222 | sig = new SC_IN (type) (str.c_str()); \ |
---|
| 223 | } \ |
---|
| 224 | } while (0) |
---|
[113] | 225 | |
---|
| 226 | #define ALLOC0_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size) \ |
---|
[128] | 227 | do \ |
---|
[113] | 228 | { \ |
---|
[128] | 229 | if (size > 0) \ |
---|
| 230 | { \ |
---|
| 231 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \ |
---|
| 232 | sig = new SC_OUT (type) (str.c_str()); \ |
---|
| 233 | } \ |
---|
| 234 | } while (0) |
---|
[113] | 235 | |
---|
[128] | 236 | #define DELETE0_FOREIGN_SIGNAL( sig, size) \ |
---|
| 237 | do \ |
---|
| 238 | { \ |
---|
| 239 | DELETE0_SIGNAL(sig,size); \ |
---|
| 240 | } while (0) |
---|
[113] | 241 | |
---|
| 242 | #define INSTANCE0_FOREIGN_SIGNAL(component, sig, type, name, size) \ |
---|
[128] | 243 | do \ |
---|
[113] | 244 | { \ |
---|
[128] | 245 | if (size > 0) \ |
---|
| 246 | { \ |
---|
| 247 | INSTANCE_FOREIGN_PRINT(name); \ |
---|
| 248 | _component->set_sc_signal<type>(_name,name,static_cast<void*>(component->sig)); \ |
---|
| 249 | } \ |
---|
| 250 | } while (0) |
---|
[113] | 251 | |
---|
| 252 | #define ALLOC0_SC_SIGNAL( sig, name, type) \ |
---|
[128] | 253 | do \ |
---|
| 254 | { \ |
---|
| 255 | sig = new sc_signal<type> (name); \ |
---|
| 256 | PRINT_SIGNAL_ADDRESS(name,sig); \ |
---|
| 257 | } while (0) |
---|
[73] | 258 | |
---|
[128] | 259 | #define INSTANCE0_SC_SIGNAL(component, sig) \ |
---|
| 260 | do \ |
---|
| 261 | { \ |
---|
| 262 | TEST_SIGNAL(component->sig->name(),component->sig); \ |
---|
| 263 | TEST_SIGNAL(sig ->name(),sig); \ |
---|
| 264 | (*(component->sig)) (*(sig)); \ |
---|
| 265 | } while (0) |
---|
[73] | 266 | |
---|
[113] | 267 | #define _INSTANCE0_SC_SIGNAL(component, sig1,sig2) \ |
---|
[128] | 268 | do \ |
---|
| 269 | { \ |
---|
| 270 | TEST_SIGNAL(component->sig1->name(),component->sig1); \ |
---|
| 271 | TEST_SIGNAL(sig2 ->name(),sig2); \ |
---|
| 272 | (*(component->sig1)) (*(sig2)); \ |
---|
| 273 | } while (0) |
---|
[81] | 274 | |
---|
[128] | 275 | #define DELETE0_SC_SIGNAL( sig) \ |
---|
| 276 | do \ |
---|
| 277 | { \ |
---|
| 278 | PRINT_SIGNAL_ADDRESS("",sig); \ |
---|
| 279 | delete sig; \ |
---|
| 280 | } while (0) |
---|
[88] | 281 | |
---|
[73] | 282 | // ---------------------------------------------------------------------- |
---|
| 283 | // -----[ ITERATION 1 ]-------------------------------------------------- |
---|
| 284 | // ---------------------------------------------------------------------- |
---|
| 285 | |
---|
[128] | 286 | #define __ALLOC1_INTERFACE_BEGIN(name, x1) \ |
---|
[88] | 287 | INTERFACE_PRINT(name); \ |
---|
| 288 | const std::string interface_name = name; \ |
---|
| 289 | const uint32_t iterator_1 = x1; |
---|
[78] | 290 | |
---|
[112] | 291 | #define __ALLOC1_INTERFACE_END(x1) |
---|
| 292 | |
---|
[88] | 293 | #define __ALLOC1_SIGNAL_IN( sig, name, type) \ |
---|
[128] | 294 | do \ |
---|
| 295 | { \ |
---|
| 296 | sig = new SC_IN(type) * [iterator_1]; \ |
---|
| 297 | std::string separator="_"; \ |
---|
| 298 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 299 | { \ |
---|
| 300 | std::string str = "in_"+interface_name+separator+toString(it1)+separator+name; \ |
---|
| 301 | sig [it1] = new SC_IN(type) (str.c_str()); \ |
---|
| 302 | } \ |
---|
| 303 | } while (0) |
---|
[78] | 304 | |
---|
[128] | 305 | |
---|
[88] | 306 | #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ |
---|
[128] | 307 | do \ |
---|
| 308 | { \ |
---|
| 309 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
| 310 | std::string separator="_"; \ |
---|
| 311 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 312 | { \ |
---|
| 313 | std::string str = "out_"+interface_name+separator+toString(it1)+separator+name; \ |
---|
| 314 | sig [it1] = new SC_OUT(type) (str.c_str()); \ |
---|
| 315 | } \ |
---|
| 316 | } while (0) |
---|
[78] | 317 | |
---|
[73] | 318 | #ifdef POSITION |
---|
[122] | 319 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
[88] | 320 | INTERFACE_PRINT(name); \ |
---|
[122] | 321 | uint32_t iterator_1 = 0; \ |
---|
| 322 | morpheo::behavioural::Interface_fifo ** interface; \ |
---|
[88] | 323 | { \ |
---|
| 324 | std::string separator="_"; \ |
---|
[115] | 325 | iterator_1 = x1; \ |
---|
| 326 | interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \ |
---|
[88] | 327 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 328 | { \ |
---|
| 329 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1), direction, localisation, str); \ |
---|
| 330 | } \ |
---|
[73] | 331 | } |
---|
| 332 | #else |
---|
[128] | 333 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
[88] | 334 | INTERFACE_PRINT(name); \ |
---|
[122] | 335 | uint32_t iterator_1 = 0; \ |
---|
| 336 | morpheo::behavioural::Interface_fifo ** interface; \ |
---|
[88] | 337 | { \ |
---|
| 338 | std::string separator="_"; \ |
---|
[122] | 339 | iterator_1 = x1; \ |
---|
| 340 | interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \ |
---|
[88] | 341 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 342 | { \ |
---|
| 343 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1)); \ |
---|
| 344 | } \ |
---|
[73] | 345 | } |
---|
| 346 | #endif |
---|
| 347 | |
---|
[128] | 348 | #define ALLOC1_INTERFACE_END(x1) \ |
---|
| 349 | do \ |
---|
| 350 | { \ |
---|
| 351 | delete [] interface; \ |
---|
| 352 | } while (0) |
---|
[112] | 353 | |
---|
[88] | 354 | #define ALLOC1_VAL_ACK_IN( sig, name, type) \ |
---|
[128] | 355 | do \ |
---|
| 356 | { \ |
---|
| 357 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
| 358 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 359 | { \ |
---|
| 360 | sig [it1] = interface[it1]->set_signal_valack_in (name, type); \ |
---|
| 361 | } \ |
---|
| 362 | } while (0) |
---|
| 363 | |
---|
[88] | 364 | #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ |
---|
[128] | 365 | do \ |
---|
| 366 | { \ |
---|
| 367 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
| 368 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 369 | { \ |
---|
| 370 | sig [it1] = interface[it1]->set_signal_valack_out(name, type); \ |
---|
| 371 | } \ |
---|
| 372 | } while (0) |
---|
| 373 | |
---|
[88] | 374 | #define ALLOC1_VALACK_IN( sig, type) \ |
---|
[128] | 375 | do \ |
---|
| 376 | { \ |
---|
| 377 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
| 378 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 379 | { \ |
---|
| 380 | sig [it1] = interface[it1]->set_signal_valack_in (type); \ |
---|
| 381 | } \ |
---|
| 382 | } while (0) |
---|
| 383 | |
---|
[88] | 384 | #define ALLOC1_VALACK_OUT( sig, type) \ |
---|
[128] | 385 | do \ |
---|
| 386 | { \ |
---|
| 387 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
| 388 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 389 | { \ |
---|
| 390 | sig [it1] = interface[it1]->set_signal_valack_out(type); \ |
---|
| 391 | } \ |
---|
| 392 | } while (0) |
---|
| 393 | |
---|
[88] | 394 | #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ |
---|
[128] | 395 | do \ |
---|
| 396 | { \ |
---|
| 397 | sig = new SC_IN (type) * [iterator_1]; \ |
---|
| 398 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 399 | { \ |
---|
| 400 | if (size > 0) \ |
---|
| 401 | { \ |
---|
| 402 | sig [it1] = interface[it1]->set_signal_in <type> (name, size); \ |
---|
| 403 | } \ |
---|
| 404 | else \ |
---|
| 405 | { \ |
---|
| 406 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
| 407 | } \ |
---|
| 408 | } \ |
---|
| 409 | } while (0) |
---|
| 410 | |
---|
| 411 | #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ |
---|
| 412 | do \ |
---|
| 413 | { \ |
---|
| 414 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
| 415 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 416 | { \ |
---|
| 417 | if (size > 0) \ |
---|
| 418 | { \ |
---|
| 419 | sig [it1] = interface[it1]->set_signal_out<type> (name, size); \ |
---|
| 420 | } \ |
---|
| 421 | else \ |
---|
| 422 | { \ |
---|
| 423 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
| 424 | } \ |
---|
| 425 | } \ |
---|
| 426 | } while (0) |
---|
| 427 | |
---|
| 428 | #define DELETE1_SIGNAL(sig, x1, size) \ |
---|
| 429 | do \ |
---|
| 430 | { \ |
---|
| 431 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 432 | { \ |
---|
| 433 | if (size > 0) \ |
---|
| 434 | { \ |
---|
| 435 | delete sig[it1]; \ |
---|
| 436 | } \ |
---|
| 437 | } \ |
---|
| 438 | delete [] sig; \ |
---|
| 439 | } while (0) |
---|
| 440 | |
---|
| 441 | #define ALLOC1_FOREIGN_SIGNAL_IN(sig, interface, name, type, size,x1) \ |
---|
| 442 | do \ |
---|
| 443 | { \ |
---|
| 444 | sig = new SC_IN (type) * [x1]; \ |
---|
| 445 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[88] | 446 | if (size > 0) \ |
---|
| 447 | { \ |
---|
[128] | 448 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ |
---|
| 449 | sig [it1] = new SC_IN (type) (str.c_str()); \ |
---|
[88] | 450 | } \ |
---|
[128] | 451 | } while (0) |
---|
[73] | 452 | |
---|
[128] | 453 | #define ALLOC1_FOREIGN_SIGNAL_OUT(sig, interface, name, type, size,x1) \ |
---|
| 454 | do \ |
---|
| 455 | { \ |
---|
| 456 | sig = new SC_OUT (type) * [x1]; \ |
---|
| 457 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[88] | 458 | if (size > 0) \ |
---|
| 459 | { \ |
---|
[128] | 460 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ |
---|
| 461 | sig [it1] = new SC_OUT (type) (str.c_str()); \ |
---|
[88] | 462 | } \ |
---|
[128] | 463 | } while (0) |
---|
[73] | 464 | |
---|
[128] | 465 | #define DELETE1_FOREIGN_SIGNAL( sig, size,x1) \ |
---|
| 466 | do \ |
---|
| 467 | { \ |
---|
| 468 | DELETE1_SIGNAL(sig,x1,size); \ |
---|
| 469 | } while (0) |
---|
| 470 | |
---|
| 471 | #define ALLOC1_SC_SIGNAL( sig, name, type, x1) \ |
---|
| 472 | do \ |
---|
| 473 | { \ |
---|
| 474 | sig = new sc_signal<type> * [x1]; \ |
---|
[88] | 475 | { \ |
---|
[128] | 476 | std::string separator="_"; \ |
---|
| 477 | std::string str; \ |
---|
| 478 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[88] | 479 | { \ |
---|
[128] | 480 | str = name+separator+toString(it1); \ |
---|
| 481 | sig [it1] = new sc_signal<type> (str.c_str()); \ |
---|
| 482 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1]); \ |
---|
[88] | 483 | } \ |
---|
| 484 | } \ |
---|
[128] | 485 | } while (0) |
---|
[81] | 486 | |
---|
[128] | 487 | #define INSTANCE1_SC_SIGNAL(component, sig, x1) \ |
---|
| 488 | do \ |
---|
| 489 | { \ |
---|
| 490 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[113] | 491 | { \ |
---|
[128] | 492 | TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \ |
---|
| 493 | TEST_SIGNAL(sig [it1]->name(),sig [it1]); \ |
---|
| 494 | (*(component->sig[it1])) (*(sig[it1])); \ |
---|
[113] | 495 | } \ |
---|
[128] | 496 | } while (0) |
---|
[113] | 497 | |
---|
[128] | 498 | #define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1) \ |
---|
| 499 | do \ |
---|
| 500 | { \ |
---|
| 501 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[113] | 502 | { \ |
---|
[128] | 503 | TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \ |
---|
| 504 | TEST_SIGNAL(sig2 [it1]->name(),sig2 [it1]); \ |
---|
| 505 | (*(component->sig1[it1])) (*(sig2[it1])); \ |
---|
[113] | 506 | } \ |
---|
[128] | 507 | } while (0) |
---|
[113] | 508 | |
---|
[128] | 509 | #define DELETE1_SC_SIGNAL(sig, x1) \ |
---|
| 510 | do \ |
---|
[88] | 511 | { \ |
---|
[128] | 512 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 513 | { \ |
---|
| 514 | PRINT_SIGNAL_ADDRESS("",sig[it1]); \ |
---|
| 515 | delete sig[it1]; \ |
---|
| 516 | } \ |
---|
| 517 | delete [] sig; \ |
---|
| 518 | } while (0) |
---|
[73] | 519 | |
---|
[78] | 520 | // ---------------------------------------------------------------------- |
---|
| 521 | // -----[ ITERATION 2 ]-------------------------------------------------- |
---|
| 522 | // ---------------------------------------------------------------------- |
---|
| 523 | |
---|
| 524 | #ifdef POSITION |
---|
[128] | 525 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
[88] | 526 | INTERFACE_PRINT(name); \ |
---|
| 527 | uint32_t iterator_1 = 0; \ |
---|
| 528 | uint32_t iterator_2 = 0; \ |
---|
| 529 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
| 530 | { \ |
---|
| 531 | std::string separator="_"; \ |
---|
| 532 | iterator_1 = x1; \ |
---|
| 533 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
| 534 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 535 | { \ |
---|
| 536 | iterator_2 = x2; \ |
---|
| 537 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
| 538 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 539 | { \ |
---|
| 540 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2), direction, localisation, str); \ |
---|
| 541 | } \ |
---|
| 542 | } \ |
---|
[78] | 543 | } |
---|
| 544 | #else |
---|
[128] | 545 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
[88] | 546 | INTERFACE_PRINT(name); \ |
---|
| 547 | uint32_t iterator_1 = 0; \ |
---|
| 548 | uint32_t iterator_2 = 0; \ |
---|
| 549 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
| 550 | { \ |
---|
| 551 | std::string separator="_"; \ |
---|
| 552 | iterator_1 = x1; \ |
---|
| 553 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
| 554 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 555 | { \ |
---|
| 556 | iterator_2 = x2; \ |
---|
| 557 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
| 558 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 559 | { \ |
---|
| 560 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)); \ |
---|
| 561 | } \ |
---|
| 562 | } \ |
---|
[78] | 563 | } |
---|
[73] | 564 | #endif |
---|
[78] | 565 | |
---|
[122] | 566 | #define ALLOC2_INTERFACE_END(x1, x2) \ |
---|
[128] | 567 | do \ |
---|
| 568 | { \ |
---|
| 569 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 570 | delete [] interface [it1]; \ |
---|
| 571 | delete [] interface; \ |
---|
| 572 | } while (0) |
---|
[112] | 573 | |
---|
[88] | 574 | #define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2) \ |
---|
[128] | 575 | do \ |
---|
| 576 | { \ |
---|
| 577 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
| 578 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 579 | { \ |
---|
| 580 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
| 581 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 582 | { \ |
---|
| 583 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (name, type); \ |
---|
| 584 | } \ |
---|
| 585 | } \ |
---|
| 586 | } while (0) |
---|
[78] | 587 | |
---|
[88] | 588 | #define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2) \ |
---|
[128] | 589 | do \ |
---|
| 590 | { \ |
---|
| 591 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
| 592 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 593 | { \ |
---|
| 594 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
| 595 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 596 | { \ |
---|
| 597 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (name, type); \ |
---|
| 598 | } \ |
---|
| 599 | } \ |
---|
| 600 | } while (0) |
---|
[78] | 601 | |
---|
[88] | 602 | #define _ALLOC2_VALACK_IN( sig,type, x1, x2) \ |
---|
[128] | 603 | do \ |
---|
| 604 | { \ |
---|
| 605 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
| 606 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 607 | { \ |
---|
| 608 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
| 609 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 610 | { \ |
---|
| 611 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (type); \ |
---|
| 612 | } \ |
---|
| 613 | } \ |
---|
| 614 | } while (0) |
---|
[78] | 615 | |
---|
[88] | 616 | #define _ALLOC2_VALACK_OUT( sig,type, x1, x2) \ |
---|
[128] | 617 | do \ |
---|
| 618 | { \ |
---|
| 619 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
| 620 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 621 | { \ |
---|
| 622 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
| 623 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 624 | { \ |
---|
| 625 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (type); \ |
---|
| 626 | } \ |
---|
| 627 | } \ |
---|
| 628 | } while (0) |
---|
[78] | 629 | |
---|
[88] | 630 | #define _ALLOC2_SIGNAL_IN( sig, name, type, size, x1, x2) \ |
---|
[128] | 631 | do \ |
---|
| 632 | { \ |
---|
| 633 | sig = new SC_IN (type) ** [x1]; \ |
---|
| 634 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 635 | { \ |
---|
| 636 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
| 637 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 638 | { \ |
---|
| 639 | if (size > 0) \ |
---|
| 640 | { \ |
---|
| 641 | sig [it1][it2] = interface[it1][it2]->set_signal_in <type> (name, size); \ |
---|
| 642 | } \ |
---|
| 643 | else \ |
---|
| 644 | { \ |
---|
| 645 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
| 646 | } \ |
---|
| 647 | } \ |
---|
| 648 | } \ |
---|
| 649 | } while (0) |
---|
[78] | 650 | |
---|
[88] | 651 | #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, x1, x2) \ |
---|
[128] | 652 | do \ |
---|
| 653 | { \ |
---|
| 654 | sig = new SC_OUT (type) ** [x1]; \ |
---|
| 655 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 656 | { \ |
---|
| 657 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
| 658 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 659 | { \ |
---|
| 660 | if (size > 0) \ |
---|
| 661 | { \ |
---|
| 662 | sig [it1][it2] = interface[it1][it2]->set_signal_out <type> (name, size); \ |
---|
| 663 | } \ |
---|
| 664 | else \ |
---|
| 665 | { \ |
---|
| 666 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
| 667 | } \ |
---|
| 668 | } \ |
---|
| 669 | } \ |
---|
| 670 | } while (0) |
---|
[78] | 671 | |
---|
| 672 | #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) |
---|
| 673 | #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) |
---|
| 674 | #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) |
---|
| 675 | #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) |
---|
| 676 | #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) |
---|
| 677 | #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) |
---|
| 678 | |
---|
[88] | 679 | #define DELETE2_SIGNAL(sig, x1,x2, size) \ |
---|
[128] | 680 | do \ |
---|
| 681 | { \ |
---|
| 682 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 683 | { \ |
---|
| 684 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 685 | { \ |
---|
| 686 | if (size > 0) \ |
---|
| 687 | { \ |
---|
| 688 | delete sig[it1][it2]; \ |
---|
| 689 | } \ |
---|
| 690 | } \ |
---|
| 691 | delete [] sig[it1]; \ |
---|
| 692 | } \ |
---|
| 693 | delete [] sig; \ |
---|
| 694 | } while (0) |
---|
| 695 | |
---|
| 696 | #define ALLOC2_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2) \ |
---|
| 697 | do \ |
---|
| 698 | { \ |
---|
| 699 | sig = new SC_IN (type) ** [x1]; \ |
---|
| 700 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 701 | { \ |
---|
| 702 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
| 703 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
[88] | 704 | if (size > 0) \ |
---|
| 705 | { \ |
---|
[128] | 706 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ |
---|
| 707 | sig [it1][it2] = new SC_IN (type) (str.c_str()); \ |
---|
[88] | 708 | } \ |
---|
[128] | 709 | } \ |
---|
| 710 | } while (0) |
---|
[81] | 711 | |
---|
[113] | 712 | #define ALLOC2_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2) \ |
---|
[128] | 713 | do \ |
---|
| 714 | { \ |
---|
| 715 | sig = new SC_OUT (type) ** [x1]; \ |
---|
| 716 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 717 | { \ |
---|
| 718 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
| 719 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 720 | if (size > 0) \ |
---|
| 721 | { \ |
---|
| 722 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ |
---|
| 723 | sig [it1][it2] = new SC_IN (type) (str.c_str()); \ |
---|
| 724 | } \ |
---|
| 725 | } \ |
---|
| 726 | } while (0) |
---|
[113] | 727 | |
---|
| 728 | #define DELETE2_FOREIGN_SIGNAL( sig, size,x1,x2) \ |
---|
[128] | 729 | do \ |
---|
| 730 | { \ |
---|
| 731 | DELETE2_SIGNAL(sig,x1,x2,size); \ |
---|
| 732 | } while (0) |
---|
[113] | 733 | |
---|
[88] | 734 | #define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2) \ |
---|
[128] | 735 | do \ |
---|
| 736 | { \ |
---|
| 737 | sig = new sc_signal<type> ** [x1]; \ |
---|
[88] | 738 | { \ |
---|
[128] | 739 | std::string separator="_"; \ |
---|
| 740 | std::string str; \ |
---|
| 741 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[88] | 742 | { \ |
---|
[128] | 743 | sig [it1] = new sc_signal<type> * [x2]; \ |
---|
| 744 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 745 | { \ |
---|
| 746 | str = name+separator+toString(it1)+separator+toString(it2); \ |
---|
| 747 | sig [it1][it2] = new sc_signal<type> (str.c_str()); \ |
---|
| 748 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2]); \ |
---|
| 749 | } \ |
---|
[88] | 750 | } \ |
---|
| 751 | } \ |
---|
[128] | 752 | } while (0) |
---|
[78] | 753 | |
---|
[88] | 754 | #define INSTANCE2_SC_SIGNAL(component, sig, x1, x2) \ |
---|
[128] | 755 | do \ |
---|
| 756 | { \ |
---|
| 757 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 758 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 759 | { \ |
---|
| 760 | TEST_SIGNAL(component->sig [it1][it2]->name(),component->sig [it1][it2]); \ |
---|
| 761 | TEST_SIGNAL(sig [it1][it2]->name(),sig [it1][it2]); \ |
---|
| 762 | (*(component->sig[it1][it2])) (*(sig[it1][it2])); \ |
---|
| 763 | } \ |
---|
| 764 | } while (0) |
---|
[81] | 765 | |
---|
[88] | 766 | #define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2) \ |
---|
[128] | 767 | do \ |
---|
| 768 | { \ |
---|
| 769 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
[88] | 770 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 771 | { \ |
---|
[128] | 772 | TEST_SIGNAL(component->sig1 [it1][it2]->name(),component->sig1 [it1][it2]); \ |
---|
| 773 | TEST_SIGNAL(sig2 [it1][it2]->name(),sig2 [it1][it2]); \ |
---|
| 774 | (*(component->sig1[it1][it2])) (*(sig2[it1][it2])); \ |
---|
[88] | 775 | } \ |
---|
[128] | 776 | } while (0) |
---|
[81] | 777 | |
---|
[128] | 778 | #define DELETE2_SC_SIGNAL(sig,x1,x2) \ |
---|
| 779 | do \ |
---|
| 780 | { \ |
---|
| 781 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 782 | { \ |
---|
| 783 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 784 | { \ |
---|
| 785 | PRINT_SIGNAL_ADDRESS("",sig[it1][it2]); \ |
---|
| 786 | delete sig[it1][it2]; \ |
---|
| 787 | } \ |
---|
| 788 | delete [] sig[it1]; \ |
---|
| 789 | } \ |
---|
| 790 | delete [] sig; \ |
---|
| 791 | } while (0) |
---|
| 792 | |
---|
[88] | 793 | // ---------------------------------------------------------------------- |
---|
| 794 | // -----[ ITERATION 3 ]-------------------------------------------------- |
---|
| 795 | // ---------------------------------------------------------------------- |
---|
| 796 | |
---|
| 797 | #ifdef POSITION |
---|
[112] | 798 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
[88] | 799 | INTERFACE_PRINT(name); \ |
---|
| 800 | uint32_t iterator_1 = 0; \ |
---|
| 801 | uint32_t iterator_2 = 0; \ |
---|
| 802 | uint32_t iterator_3 = 0; \ |
---|
| 803 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
| 804 | { \ |
---|
| 805 | std::string separator="_"; \ |
---|
| 806 | iterator_1 = x1; \ |
---|
| 807 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
| 808 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 809 | { \ |
---|
| 810 | iterator_2 = x2; \ |
---|
| 811 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
| 812 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 813 | { \ |
---|
| 814 | iterator_3 = x3; \ |
---|
| 815 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
| 816 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
| 817 | { \ |
---|
| 818 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \ |
---|
| 819 | } \ |
---|
| 820 | } \ |
---|
| 821 | } \ |
---|
| 822 | } |
---|
| 823 | #else |
---|
[112] | 824 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
[88] | 825 | INTERFACE_PRINT(name); \ |
---|
| 826 | uint32_t iterator_1 = 0; \ |
---|
| 827 | uint32_t iterator_2 = 0; \ |
---|
| 828 | uint32_t iterator_3 = 0; \ |
---|
| 829 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
| 830 | { \ |
---|
| 831 | std::string separator="_"; \ |
---|
| 832 | iterator_1 = x1; \ |
---|
| 833 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
| 834 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 835 | { \ |
---|
| 836 | iterator_2 = x2; \ |
---|
| 837 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
| 838 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 839 | { \ |
---|
| 840 | iterator_3 = x3; \ |
---|
| 841 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
| 842 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
| 843 | { \ |
---|
| 844 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3)); \ |
---|
| 845 | } \ |
---|
| 846 | } \ |
---|
| 847 | } \ |
---|
| 848 | } |
---|
[78] | 849 | #endif |
---|
[88] | 850 | |
---|
[112] | 851 | #define ALLOC3_INTERFACE_END(x1, x2, x3) \ |
---|
[128] | 852 | do \ |
---|
[112] | 853 | { \ |
---|
[128] | 854 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 855 | { \ |
---|
| 856 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 857 | delete [] interface [it1][it2]; \ |
---|
| 858 | delete [] interface [it1]; \ |
---|
| 859 | } \ |
---|
| 860 | delete [] interface; \ |
---|
| 861 | } while (0) |
---|
[112] | 862 | |
---|
[88] | 863 | // #define _ALLOC3_VAL_ACK_IN( sig, name, type, x1, x2, x3) |
---|
| 864 | // #define _ALLOC3_VAL_ACK_OUT( sig, name, type, x1, x2, x3) |
---|
| 865 | |
---|
| 866 | #define _ALLOC3_VALACK_IN( sig,type, x1, x2, x3) \ |
---|
[128] | 867 | do \ |
---|
| 868 | { \ |
---|
| 869 | sig = new SC_IN (Tcontrol_t) *** [x1]; \ |
---|
| 870 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 871 | { \ |
---|
| 872 | sig [it1] = new SC_IN (Tcontrol_t) ** [x2]; \ |
---|
| 873 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 874 | { \ |
---|
| 875 | sig [it1][it2] = new SC_IN (Tcontrol_t) * [x3]; \ |
---|
| 876 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 877 | { \ |
---|
| 878 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_in (type); \ |
---|
| 879 | } \ |
---|
| 880 | } \ |
---|
| 881 | } \ |
---|
| 882 | } while (0) |
---|
[88] | 883 | |
---|
| 884 | #define _ALLOC3_VALACK_OUT( sig,type, x1, x2, x3) \ |
---|
[128] | 885 | do \ |
---|
| 886 | { \ |
---|
| 887 | sig = new SC_OUT (Tcontrol_t) *** [x1]; \ |
---|
| 888 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 889 | { \ |
---|
| 890 | sig [it1] = new SC_OUT (Tcontrol_t) ** [x2]; \ |
---|
| 891 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 892 | { \ |
---|
| 893 | sig [it1][it2] = new SC_OUT (Tcontrol_t) * [x3]; \ |
---|
| 894 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 895 | { \ |
---|
| 896 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_out (type); \ |
---|
| 897 | } \ |
---|
| 898 | } \ |
---|
| 899 | } \ |
---|
| 900 | } while (0) |
---|
[88] | 901 | |
---|
| 902 | |
---|
| 903 | #define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3) \ |
---|
[128] | 904 | do \ |
---|
| 905 | { \ |
---|
| 906 | sig = new SC_IN (type) *** [x1]; \ |
---|
| 907 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 908 | { \ |
---|
| 909 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
| 910 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 911 | { \ |
---|
| 912 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
| 913 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 914 | { \ |
---|
| 915 | if (size > 0) \ |
---|
| 916 | { \ |
---|
| 917 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_in <type> (name, size); \ |
---|
| 918 | } \ |
---|
| 919 | else \ |
---|
| 920 | { \ |
---|
| 921 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
| 922 | } \ |
---|
| 923 | } \ |
---|
| 924 | } \ |
---|
| 925 | } \ |
---|
| 926 | } while (0) |
---|
[88] | 927 | |
---|
| 928 | #define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3) \ |
---|
[128] | 929 | do \ |
---|
| 930 | { \ |
---|
| 931 | sig = new SC_OUT (type) *** [x1]; \ |
---|
| 932 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 933 | { \ |
---|
| 934 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
| 935 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 936 | { \ |
---|
| 937 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
| 938 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 939 | { \ |
---|
| 940 | if (size > 0) \ |
---|
| 941 | { \ |
---|
| 942 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_out <type> (name, size); \ |
---|
| 943 | } \ |
---|
| 944 | else \ |
---|
| 945 | { \ |
---|
| 946 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
| 947 | } \ |
---|
| 948 | } \ |
---|
| 949 | } \ |
---|
| 950 | } \ |
---|
| 951 | } while (0) |
---|
[88] | 952 | |
---|
| 953 | // #define ALLOC3_VAL_ACK_IN( sig, name, type ) _ALLOC3_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
| 954 | // #define ALLOC3_VAL_ACK_OUT(sig, name, type ) _ALLOC3_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
| 955 | #define ALLOC3_VALACK_IN( sig, type ) _ALLOC3_VALACK_IN( sig, type , iterator_1, iterator_2, iterator_3) |
---|
| 956 | #define ALLOC3_VALACK_OUT( sig, type ) _ALLOC3_VALACK_OUT( sig, type , iterator_1, iterator_2, iterator_3) |
---|
| 957 | #define ALLOC3_SIGNAL_IN( sig, name, type, size) _ALLOC3_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
| 958 | #define ALLOC3_SIGNAL_OUT( sig, name, type, size) _ALLOC3_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
| 959 | |
---|
| 960 | #define DELETE3_SIGNAL(sig, x1, x2, x3, size) \ |
---|
[128] | 961 | do \ |
---|
| 962 | { \ |
---|
| 963 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 964 | { \ |
---|
| 965 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 966 | { \ |
---|
| 967 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 968 | { \ |
---|
| 969 | if (size > 0) \ |
---|
| 970 | { \ |
---|
| 971 | delete sig[it1][it2][it3]; \ |
---|
| 972 | } \ |
---|
| 973 | } \ |
---|
| 974 | delete [] sig[it1][it2]; \ |
---|
| 975 | } \ |
---|
| 976 | delete [] sig[it1]; \ |
---|
| 977 | } \ |
---|
| 978 | delete [] sig; \ |
---|
| 979 | } while (0) |
---|
| 980 | |
---|
| 981 | #define ALLOC3_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2,x3) \ |
---|
| 982 | do \ |
---|
| 983 | { \ |
---|
| 984 | sig = new SC_IN (type) *** [x1]; \ |
---|
| 985 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 986 | { \ |
---|
| 987 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
| 988 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 989 | { \ |
---|
| 990 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
| 991 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
[88] | 992 | if (size > 0) \ |
---|
| 993 | { \ |
---|
[128] | 994 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ |
---|
| 995 | sig [it1][it2][it3] = new SC_IN (type) (str.c_str()); \ |
---|
[88] | 996 | } \ |
---|
[128] | 997 | } \ |
---|
| 998 | } \ |
---|
| 999 | } while (0) |
---|
[88] | 1000 | |
---|
[113] | 1001 | #define ALLOC3_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2,x3) \ |
---|
[128] | 1002 | do \ |
---|
| 1003 | { \ |
---|
| 1004 | sig = new SC_OUT (type) *** [x1]; \ |
---|
| 1005 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 1006 | { \ |
---|
| 1007 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
| 1008 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 1009 | { \ |
---|
| 1010 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
| 1011 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 1012 | if (size > 0) \ |
---|
| 1013 | { \ |
---|
| 1014 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ |
---|
| 1015 | sig [it1][it2][it3] = new SC_OUT(type) (str.c_str()); \ |
---|
| 1016 | } \ |
---|
| 1017 | } \ |
---|
| 1018 | } \ |
---|
| 1019 | } while (0) |
---|
[113] | 1020 | |
---|
| 1021 | #define DELETE3_FOREIGN_SIGNAL( sig, size,x1,x2,x3) \ |
---|
[128] | 1022 | do \ |
---|
| 1023 | { \ |
---|
| 1024 | DELETE3_SIGNAL(sig,x1,x2,x3,size); \ |
---|
| 1025 | } while (0) |
---|
[113] | 1026 | |
---|
[88] | 1027 | #define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3) \ |
---|
[128] | 1028 | do \ |
---|
| 1029 | { \ |
---|
| 1030 | sig = new sc_signal<type> *** [x1]; \ |
---|
[88] | 1031 | { \ |
---|
[128] | 1032 | std::string separator="_"; \ |
---|
| 1033 | std::string str; \ |
---|
| 1034 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 1035 | { \ |
---|
| 1036 | sig [it1] = new sc_signal<type> ** [x2]; \ |
---|
| 1037 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 1038 | { \ |
---|
| 1039 | sig [it1][it2] = new sc_signal<type> * [x3]; \ |
---|
| 1040 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 1041 | { \ |
---|
| 1042 | str = name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3); \ |
---|
| 1043 | sig [it1][it2][it3] = new sc_signal<type> (str.c_str()); \ |
---|
| 1044 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2][it3]); \ |
---|
| 1045 | } \ |
---|
| 1046 | } \ |
---|
| 1047 | } \ |
---|
[88] | 1048 | } \ |
---|
[128] | 1049 | } while (0) |
---|
[88] | 1050 | |
---|
| 1051 | #define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3) \ |
---|
[128] | 1052 | do \ |
---|
| 1053 | { \ |
---|
| 1054 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 1055 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 1056 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 1057 | { \ |
---|
| 1058 | TEST_SIGNAL(component->sig [it1][it2][it3]->name(),component->sig [it1][it2][it3]); \ |
---|
| 1059 | TEST_SIGNAL(sig [it1][it2][it3]->name(),sig [it1][it2][it3]); \ |
---|
| 1060 | (*(component->sig[it1][it2][it3])) (*(sig[it1][it2][it3])); \ |
---|
| 1061 | } \ |
---|
| 1062 | } while (0) |
---|
[88] | 1063 | |
---|
| 1064 | #define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3) \ |
---|
[128] | 1065 | do \ |
---|
| 1066 | { \ |
---|
| 1067 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 1068 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 1069 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 1070 | { \ |
---|
| 1071 | TEST_SIGNAL(component->sig1 [it1][it2][it3]->name(),component->sig1 [it1][it2][it3]); \ |
---|
| 1072 | TEST_SIGNAL(sig2 [it1][it2][it3]->name(),sig2 [it1][it2][it3]); \ |
---|
| 1073 | (*(component->sig1[it1][it2][it3])) (*(sig2[it1][it2][it3])); \ |
---|
| 1074 | } \ |
---|
| 1075 | } while (0) |
---|
[88] | 1076 | |
---|
| 1077 | #define DELETE3_SC_SIGNAL(sig,x1,x2,x3) \ |
---|
[128] | 1078 | do \ |
---|
| 1079 | { \ |
---|
| 1080 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 1081 | { \ |
---|
| 1082 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 1083 | { \ |
---|
| 1084 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 1085 | { \ |
---|
| 1086 | PRINT_SIGNAL_ADDRESS("",sig[it1][it2][it3]); \ |
---|
| 1087 | delete sig[it1][it2][it3]; \ |
---|
| 1088 | } \ |
---|
| 1089 | delete [] sig[it1][it2]; \ |
---|
| 1090 | } \ |
---|
| 1091 | delete [] sig[it1]; \ |
---|
| 1092 | } \ |
---|
| 1093 | delete [] sig; \ |
---|
| 1094 | } while (0) |
---|
[88] | 1095 | |
---|
| 1096 | #endif |
---|