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