[81] | 1 | #ifndef morpheo_behavioural_Allocation_h |
---|
| 2 | #define morpheo_behavioural_Allocation_h |
---|
[73] | 3 | |
---|
[82] | 4 | /* |
---|
| 5 | * $Id: Allocation.h 115 2009-04-20 21:29:17Z 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); \ |
---|
[115] | 254 | uint32_t iterator_1 = 0; \ |
---|
| 255 | morpheo::behavioural::Interface_fifo ** interface; \ |
---|
[88] | 256 | { \ |
---|
| 257 | std::string separator="_"; \ |
---|
[115] | 258 | iterator_1 = x1; \ |
---|
| 259 | interface = new morpheo::behavioural::Interface_fifo * [iterator_1]; \ |
---|
[88] | 260 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 261 | { \ |
---|
| 262 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1), direction, localisation, str); \ |
---|
| 263 | } \ |
---|
[73] | 264 | } |
---|
| 265 | #else |
---|
[112] | 266 | #define ALLOC1_INTERFACE_BEGIN( name, direction, localisation, str, x1) \ |
---|
[88] | 267 | INTERFACE_PRINT(name); \ |
---|
| 268 | const uint32_t iterator_1 = x1; \ |
---|
| 269 | morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ |
---|
| 270 | { \ |
---|
| 271 | std::string separator="_"; \ |
---|
| 272 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 273 | { \ |
---|
| 274 | interface [it1] = _interfaces->set_interface( name+separator+toString(it1)); \ |
---|
| 275 | } \ |
---|
[73] | 276 | } |
---|
| 277 | #endif |
---|
| 278 | |
---|
[112] | 279 | #define ALLOC1_INTERFACE_END(x1) |
---|
| 280 | |
---|
[88] | 281 | #define ALLOC1_VAL_ACK_IN( sig, name, type) \ |
---|
| 282 | { \ |
---|
| 283 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
| 284 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 285 | { \ |
---|
| 286 | sig [it1] = interface[it1]->set_signal_valack_in (name, type); \ |
---|
| 287 | } \ |
---|
[73] | 288 | } |
---|
[88] | 289 | #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ |
---|
| 290 | { \ |
---|
| 291 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
| 292 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 293 | { \ |
---|
| 294 | sig [it1] = interface[it1]->set_signal_valack_out(name, type); \ |
---|
| 295 | } \ |
---|
[73] | 296 | } |
---|
[88] | 297 | #define ALLOC1_VALACK_IN( sig, type) \ |
---|
| 298 | { \ |
---|
| 299 | sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ |
---|
| 300 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 301 | { \ |
---|
| 302 | sig [it1] = interface[it1]->set_signal_valack_in (type); \ |
---|
| 303 | } \ |
---|
[73] | 304 | } |
---|
[88] | 305 | #define ALLOC1_VALACK_OUT( sig, type) \ |
---|
| 306 | { \ |
---|
| 307 | sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ |
---|
| 308 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 309 | { \ |
---|
| 310 | sig [it1] = interface[it1]->set_signal_valack_out(type); \ |
---|
| 311 | } \ |
---|
[73] | 312 | } |
---|
[88] | 313 | #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ |
---|
| 314 | { \ |
---|
| 315 | sig = new SC_IN (type) * [iterator_1]; \ |
---|
| 316 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 317 | { \ |
---|
| 318 | if (size > 0) \ |
---|
| 319 | { \ |
---|
| 320 | sig [it1] = interface[it1]->set_signal_in <type> (name, size); \ |
---|
| 321 | } \ |
---|
| 322 | else \ |
---|
| 323 | { \ |
---|
| 324 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
| 325 | } \ |
---|
| 326 | } \ |
---|
[81] | 327 | } |
---|
[73] | 328 | |
---|
[88] | 329 | #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ |
---|
| 330 | { \ |
---|
| 331 | sig = new SC_OUT(type) * [iterator_1]; \ |
---|
| 332 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 333 | { \ |
---|
| 334 | if (size > 0) \ |
---|
| 335 | { \ |
---|
| 336 | sig [it1] = interface[it1]->set_signal_out<type> (name, size); \ |
---|
| 337 | } \ |
---|
| 338 | else \ |
---|
| 339 | { \ |
---|
| 340 | PRINT_SIZE_NUL(_component,interface[it1],name); \ |
---|
| 341 | } \ |
---|
| 342 | } \ |
---|
[81] | 343 | } |
---|
[73] | 344 | |
---|
[88] | 345 | #define DELETE1_SIGNAL(sig, x1, size) \ |
---|
| 346 | { \ |
---|
| 347 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 348 | { \ |
---|
| 349 | if (size > 0) \ |
---|
| 350 | { \ |
---|
| 351 | delete sig[it1]; \ |
---|
| 352 | } \ |
---|
| 353 | } \ |
---|
| 354 | delete [] sig; \ |
---|
[81] | 355 | } |
---|
| 356 | |
---|
[113] | 357 | #define ALLOC1_FOREIGN_SIGNAL_IN(sig, interface, name, type, size,x1) \ |
---|
| 358 | { \ |
---|
| 359 | sig = new SC_IN (type) * [x1]; \ |
---|
| 360 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 361 | if (size > 0) \ |
---|
| 362 | { \ |
---|
| 363 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ |
---|
| 364 | sig [it1] = new SC_IN (type) (str.c_str()); \ |
---|
| 365 | } \ |
---|
| 366 | } |
---|
| 367 | |
---|
| 368 | #define ALLOC1_FOREIGN_SIGNAL_OUT(sig, interface, name, type, size,x1) \ |
---|
| 369 | { \ |
---|
| 370 | sig = new SC_OUT (type) * [x1]; \ |
---|
| 371 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 372 | if (size > 0) \ |
---|
| 373 | { \ |
---|
| 374 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ |
---|
| 375 | sig [it1] = new SC_OUT (type) (str.c_str()); \ |
---|
| 376 | } \ |
---|
| 377 | } |
---|
| 378 | |
---|
| 379 | #define DELETE1_FOREIGN_SIGNAL( sig, size,x1) \ |
---|
| 380 | { \ |
---|
| 381 | DELETE1_SIGNAL(sig,x1,size); \ |
---|
| 382 | } |
---|
| 383 | |
---|
[88] | 384 | #define ALLOC1_SC_SIGNAL( sig, name, type, x1) \ |
---|
[113] | 385 | sig = new sc_signal<type> * [x1]; \ |
---|
[88] | 386 | { \ |
---|
| 387 | std::string separator="_"; \ |
---|
| 388 | std::string str; \ |
---|
| 389 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 390 | { \ |
---|
| 391 | str = name+separator+toString(it1); \ |
---|
| 392 | sig [it1] = new sc_signal<type> (str.c_str()); \ |
---|
| 393 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1]); \ |
---|
| 394 | } \ |
---|
[73] | 395 | } |
---|
| 396 | |
---|
[88] | 397 | #define INSTANCE1_SC_SIGNAL(component, sig, x1) \ |
---|
| 398 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 399 | { \ |
---|
| 400 | TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \ |
---|
| 401 | TEST_SIGNAL(sig [it1]->name(),sig [it1]); \ |
---|
| 402 | (*(component->sig[it1])) (*(sig[it1])); \ |
---|
[73] | 403 | } |
---|
| 404 | |
---|
[88] | 405 | #define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1) \ |
---|
| 406 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 407 | { \ |
---|
| 408 | TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \ |
---|
| 409 | TEST_SIGNAL(sig2 [it1]->name(),sig2 [it1]); \ |
---|
| 410 | (*(component->sig1[it1])) (*(sig2[it1])); \ |
---|
| 411 | } |
---|
| 412 | |
---|
| 413 | #define DELETE1_SC_SIGNAL(sig, x1) \ |
---|
| 414 | { \ |
---|
| 415 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 416 | { \ |
---|
[113] | 417 | PRINT_SIGNAL_ADDRESS("",sig[it1]); \ |
---|
[88] | 418 | delete sig[it1]; \ |
---|
| 419 | } \ |
---|
| 420 | delete [] sig; \ |
---|
[81] | 421 | } |
---|
| 422 | |
---|
[78] | 423 | // ---------------------------------------------------------------------- |
---|
| 424 | // -----[ ITERATION 2 ]-------------------------------------------------- |
---|
| 425 | // ---------------------------------------------------------------------- |
---|
| 426 | |
---|
| 427 | #ifdef POSITION |
---|
[112] | 428 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
[88] | 429 | INTERFACE_PRINT(name); \ |
---|
| 430 | uint32_t iterator_1 = 0; \ |
---|
| 431 | uint32_t iterator_2 = 0; \ |
---|
| 432 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
| 433 | { \ |
---|
| 434 | std::string separator="_"; \ |
---|
| 435 | iterator_1 = x1; \ |
---|
| 436 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
| 437 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 438 | { \ |
---|
| 439 | iterator_2 = x2; \ |
---|
| 440 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
| 441 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 442 | { \ |
---|
| 443 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2), direction, localisation, str); \ |
---|
| 444 | } \ |
---|
| 445 | } \ |
---|
[78] | 446 | } |
---|
| 447 | #else |
---|
[112] | 448 | #define ALLOC2_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2) \ |
---|
[88] | 449 | INTERFACE_PRINT(name); \ |
---|
| 450 | uint32_t iterator_1 = 0; \ |
---|
| 451 | uint32_t iterator_2 = 0; \ |
---|
| 452 | morpheo::behavioural::Interface_fifo *** interface; \ |
---|
| 453 | { \ |
---|
| 454 | std::string separator="_"; \ |
---|
| 455 | iterator_1 = x1; \ |
---|
| 456 | interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ |
---|
| 457 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 458 | { \ |
---|
| 459 | iterator_2 = x2; \ |
---|
| 460 | interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ |
---|
| 461 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 462 | { \ |
---|
| 463 | interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)); \ |
---|
| 464 | } \ |
---|
| 465 | } \ |
---|
[78] | 466 | } |
---|
[73] | 467 | #endif |
---|
[78] | 468 | |
---|
[112] | 469 | #define ALLOC2_INTERFACE_END(x1, x2) \ |
---|
| 470 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 471 | delete interface [it1]; \ |
---|
| 472 | delete [] interface; |
---|
| 473 | |
---|
[88] | 474 | #define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2) \ |
---|
| 475 | { \ |
---|
| 476 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
| 477 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 478 | { \ |
---|
| 479 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
| 480 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 481 | { \ |
---|
| 482 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (name, type); \ |
---|
| 483 | } \ |
---|
| 484 | } \ |
---|
[78] | 485 | } |
---|
| 486 | |
---|
[88] | 487 | #define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2) \ |
---|
| 488 | { \ |
---|
| 489 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
| 490 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 491 | { \ |
---|
| 492 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
| 493 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 494 | { \ |
---|
| 495 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (name, type); \ |
---|
| 496 | } \ |
---|
| 497 | } \ |
---|
[78] | 498 | } |
---|
| 499 | |
---|
[88] | 500 | #define _ALLOC2_VALACK_IN( sig,type, x1, x2) \ |
---|
| 501 | { \ |
---|
| 502 | sig = new SC_IN (Tcontrol_t) ** [x1]; \ |
---|
| 503 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 504 | { \ |
---|
| 505 | sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ |
---|
| 506 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 507 | { \ |
---|
| 508 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (type); \ |
---|
| 509 | } \ |
---|
| 510 | } \ |
---|
[78] | 511 | } |
---|
| 512 | |
---|
[88] | 513 | #define _ALLOC2_VALACK_OUT( sig,type, x1, x2) \ |
---|
| 514 | { \ |
---|
| 515 | sig = new SC_OUT (Tcontrol_t) ** [x1]; \ |
---|
| 516 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 517 | { \ |
---|
| 518 | sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ |
---|
| 519 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 520 | { \ |
---|
| 521 | sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (type); \ |
---|
| 522 | } \ |
---|
| 523 | } \ |
---|
[78] | 524 | } |
---|
| 525 | |
---|
[88] | 526 | #define _ALLOC2_SIGNAL_IN( sig, name, type, size, x1, x2) \ |
---|
| 527 | { \ |
---|
| 528 | sig = new SC_IN (type) ** [x1]; \ |
---|
| 529 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 530 | { \ |
---|
| 531 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
| 532 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 533 | { \ |
---|
| 534 | if (size > 0) \ |
---|
| 535 | { \ |
---|
| 536 | sig [it1][it2] = interface[it1][it2]->set_signal_in <type> (name, size); \ |
---|
| 537 | } \ |
---|
| 538 | else \ |
---|
| 539 | { \ |
---|
| 540 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
| 541 | } \ |
---|
| 542 | } \ |
---|
| 543 | } \ |
---|
[81] | 544 | } |
---|
[78] | 545 | |
---|
[88] | 546 | #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, x1, x2) \ |
---|
| 547 | { \ |
---|
| 548 | sig = new SC_OUT (type) ** [x1]; \ |
---|
| 549 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 550 | { \ |
---|
| 551 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
| 552 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 553 | { \ |
---|
| 554 | if (size > 0) \ |
---|
| 555 | { \ |
---|
| 556 | sig [it1][it2] = interface[it1][it2]->set_signal_out <type> (name, size); \ |
---|
| 557 | } \ |
---|
| 558 | else \ |
---|
| 559 | { \ |
---|
| 560 | PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ |
---|
| 561 | } \ |
---|
| 562 | } \ |
---|
| 563 | } \ |
---|
[81] | 564 | } |
---|
[78] | 565 | |
---|
| 566 | #define ALLOC2_VAL_ACK_IN( sig, name, type ) _ALLOC2_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2) |
---|
| 567 | #define ALLOC2_VAL_ACK_OUT(sig, name, type ) _ALLOC2_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2) |
---|
| 568 | #define ALLOC2_VALACK_IN( sig, type ) _ALLOC2_VALACK_IN( sig, type , iterator_1, iterator_2) |
---|
| 569 | #define ALLOC2_VALACK_OUT( sig, type ) _ALLOC2_VALACK_OUT( sig, type , iterator_1, iterator_2) |
---|
| 570 | #define ALLOC2_SIGNAL_IN( sig, name, type, size) _ALLOC2_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2) |
---|
| 571 | #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) |
---|
| 572 | |
---|
[88] | 573 | #define DELETE2_SIGNAL(sig, x1,x2, size) \ |
---|
| 574 | { \ |
---|
| 575 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 576 | { \ |
---|
| 577 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 578 | { \ |
---|
| 579 | if (size > 0) \ |
---|
| 580 | { \ |
---|
| 581 | delete sig[it1][it2]; \ |
---|
| 582 | } \ |
---|
| 583 | } \ |
---|
| 584 | delete [] sig[it1]; \ |
---|
| 585 | } \ |
---|
| 586 | delete [] sig; \ |
---|
[81] | 587 | } |
---|
| 588 | |
---|
[113] | 589 | |
---|
| 590 | #define ALLOC2_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2) \ |
---|
| 591 | { \ |
---|
| 592 | sig = new SC_IN (type) ** [x1]; \ |
---|
| 593 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 594 | { \ |
---|
| 595 | sig [it1] = new SC_IN (type) * [x2]; \ |
---|
| 596 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 597 | if (size > 0) \ |
---|
| 598 | { \ |
---|
| 599 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ |
---|
| 600 | sig [it1][it2] = new SC_IN (type) (str.c_str()); \ |
---|
| 601 | } \ |
---|
| 602 | } \ |
---|
| 603 | } |
---|
| 604 | |
---|
| 605 | #define ALLOC2_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2) \ |
---|
| 606 | { \ |
---|
| 607 | sig = new SC_OUT (type) ** [x1]; \ |
---|
| 608 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 609 | { \ |
---|
| 610 | sig [it1] = new SC_OUT (type) * [x2]; \ |
---|
| 611 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 612 | if (size > 0) \ |
---|
| 613 | { \ |
---|
| 614 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ |
---|
| 615 | sig [it1][it2] = new SC_IN (type) (str.c_str()); \ |
---|
| 616 | } \ |
---|
| 617 | } \ |
---|
| 618 | } |
---|
| 619 | |
---|
| 620 | #define DELETE2_FOREIGN_SIGNAL( sig, size,x1,x2) \ |
---|
| 621 | { \ |
---|
| 622 | DELETE2_SIGNAL(sig,x1,x2,size); \ |
---|
| 623 | } |
---|
| 624 | |
---|
[88] | 625 | #define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2) \ |
---|
[113] | 626 | sig = new sc_signal<type> ** [x1]; \ |
---|
[88] | 627 | { \ |
---|
| 628 | std::string separator="_"; \ |
---|
| 629 | std::string str; \ |
---|
| 630 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 631 | { \ |
---|
| 632 | sig [it1] = new sc_signal<type> * [x2]; \ |
---|
| 633 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 634 | { \ |
---|
| 635 | str = name+separator+toString(it1)+separator+toString(it2); \ |
---|
| 636 | sig [it1][it2] = new sc_signal<type> (str.c_str()); \ |
---|
| 637 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2]); \ |
---|
| 638 | } \ |
---|
| 639 | } \ |
---|
[78] | 640 | } |
---|
| 641 | |
---|
[88] | 642 | #define INSTANCE2_SC_SIGNAL(component, sig, x1, x2) \ |
---|
| 643 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 644 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 645 | { \ |
---|
| 646 | TEST_SIGNAL(component->sig [it1][it2]->name(),component->sig [it1][it2]); \ |
---|
| 647 | TEST_SIGNAL(sig [it1][it2]->name(),sig [it1][it2]); \ |
---|
| 648 | (*(component->sig[it1][it2])) (*(sig[it1][it2])); \ |
---|
[78] | 649 | } |
---|
[81] | 650 | |
---|
[88] | 651 | #define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2) \ |
---|
| 652 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 653 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 654 | { \ |
---|
| 655 | TEST_SIGNAL(component->sig1 [it1][it2]->name(),component->sig1 [it1][it2]); \ |
---|
| 656 | TEST_SIGNAL(sig2 [it1][it2]->name(),sig2 [it1][it2]); \ |
---|
| 657 | (*(component->sig1[it1][it2])) (*(sig2[it1][it2])); \ |
---|
| 658 | } |
---|
| 659 | |
---|
| 660 | #define DELETE2_SC_SIGNAL(sig,x1,x2) \ |
---|
| 661 | { \ |
---|
| 662 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 663 | { \ |
---|
| 664 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 665 | { \ |
---|
[113] | 666 | PRINT_SIGNAL_ADDRESS("",sig[it1][it2]); \ |
---|
[88] | 667 | delete sig[it1][it2]; \ |
---|
| 668 | } \ |
---|
| 669 | delete [] sig[it1]; \ |
---|
| 670 | } \ |
---|
| 671 | delete [] sig; \ |
---|
[81] | 672 | } |
---|
| 673 | |
---|
[88] | 674 | // ---------------------------------------------------------------------- |
---|
| 675 | // -----[ ITERATION 3 ]-------------------------------------------------- |
---|
| 676 | // ---------------------------------------------------------------------- |
---|
| 677 | |
---|
| 678 | #ifdef POSITION |
---|
[112] | 679 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
[88] | 680 | INTERFACE_PRINT(name); \ |
---|
| 681 | uint32_t iterator_1 = 0; \ |
---|
| 682 | uint32_t iterator_2 = 0; \ |
---|
| 683 | uint32_t iterator_3 = 0; \ |
---|
| 684 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
| 685 | { \ |
---|
| 686 | std::string separator="_"; \ |
---|
| 687 | iterator_1 = x1; \ |
---|
| 688 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
| 689 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 690 | { \ |
---|
| 691 | iterator_2 = x2; \ |
---|
| 692 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
| 693 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 694 | { \ |
---|
| 695 | iterator_3 = x3; \ |
---|
| 696 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
| 697 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
| 698 | { \ |
---|
| 699 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \ |
---|
| 700 | } \ |
---|
| 701 | } \ |
---|
| 702 | } \ |
---|
| 703 | } |
---|
| 704 | #else |
---|
[112] | 705 | #define ALLOC3_INTERFACE_BEGIN( name, direction, localisation, str, x1, x2, x3) \ |
---|
[88] | 706 | INTERFACE_PRINT(name); \ |
---|
| 707 | uint32_t iterator_1 = 0; \ |
---|
| 708 | uint32_t iterator_2 = 0; \ |
---|
| 709 | uint32_t iterator_3 = 0; \ |
---|
| 710 | morpheo::behavioural::Interface_fifo **** interface; \ |
---|
| 711 | { \ |
---|
| 712 | std::string separator="_"; \ |
---|
| 713 | iterator_1 = x1; \ |
---|
| 714 | interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ |
---|
| 715 | for (uint32_t it1=0; it1<iterator_1; it1++) \ |
---|
| 716 | { \ |
---|
| 717 | iterator_2 = x2; \ |
---|
| 718 | interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ |
---|
| 719 | for (uint32_t it2=0; it2<iterator_2; it2++) \ |
---|
| 720 | { \ |
---|
| 721 | iterator_3 = x3; \ |
---|
| 722 | interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ |
---|
| 723 | for (uint32_t it3=0; it3<iterator_3; it3++) \ |
---|
| 724 | { \ |
---|
| 725 | interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3)); \ |
---|
| 726 | } \ |
---|
| 727 | } \ |
---|
| 728 | } \ |
---|
| 729 | } |
---|
[78] | 730 | #endif |
---|
[88] | 731 | |
---|
[112] | 732 | #define ALLOC3_INTERFACE_END(x1, x2, x3) \ |
---|
| 733 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 734 | { \ |
---|
| 735 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 736 | delete interface [it1][it2]; \ |
---|
| 737 | delete [] interface [it1]; \ |
---|
| 738 | } \ |
---|
| 739 | delete [] interface; |
---|
| 740 | |
---|
[88] | 741 | // #define _ALLOC3_VAL_ACK_IN( sig, name, type, x1, x2, x3) |
---|
| 742 | // #define _ALLOC3_VAL_ACK_OUT( sig, name, type, x1, x2, x3) |
---|
| 743 | |
---|
| 744 | #define _ALLOC3_VALACK_IN( sig,type, x1, x2, x3) \ |
---|
| 745 | { \ |
---|
| 746 | sig = new SC_IN (Tcontrol_t) *** [x1]; \ |
---|
| 747 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 748 | { \ |
---|
| 749 | sig [it1] = new SC_IN (Tcontrol_t) ** [x2]; \ |
---|
| 750 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 751 | { \ |
---|
| 752 | sig [it1][it2] = new SC_IN (Tcontrol_t) * [x3]; \ |
---|
| 753 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 754 | { \ |
---|
| 755 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_in (type); \ |
---|
| 756 | } \ |
---|
| 757 | } \ |
---|
| 758 | } \ |
---|
| 759 | } |
---|
| 760 | |
---|
| 761 | #define _ALLOC3_VALACK_OUT( sig,type, x1, x2, x3) \ |
---|
| 762 | { \ |
---|
| 763 | sig = new SC_OUT (Tcontrol_t) *** [x1]; \ |
---|
| 764 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 765 | { \ |
---|
| 766 | sig [it1] = new SC_OUT (Tcontrol_t) ** [x2]; \ |
---|
| 767 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 768 | { \ |
---|
| 769 | sig [it1][it2] = new SC_OUT (Tcontrol_t) * [x3]; \ |
---|
| 770 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 771 | { \ |
---|
| 772 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_out (type); \ |
---|
| 773 | } \ |
---|
| 774 | } \ |
---|
| 775 | } \ |
---|
| 776 | } |
---|
| 777 | |
---|
| 778 | |
---|
| 779 | #define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3) \ |
---|
| 780 | { \ |
---|
| 781 | sig = new SC_IN (type) *** [x1]; \ |
---|
| 782 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 783 | { \ |
---|
| 784 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
| 785 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 786 | { \ |
---|
| 787 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
| 788 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 789 | { \ |
---|
| 790 | if (size > 0) \ |
---|
| 791 | { \ |
---|
| 792 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_in <type> (name, size); \ |
---|
| 793 | } \ |
---|
| 794 | else \ |
---|
| 795 | { \ |
---|
| 796 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
| 797 | } \ |
---|
| 798 | } \ |
---|
| 799 | } \ |
---|
| 800 | } \ |
---|
| 801 | } |
---|
| 802 | |
---|
| 803 | #define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3) \ |
---|
| 804 | { \ |
---|
| 805 | sig = new SC_OUT (type) *** [x1]; \ |
---|
| 806 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 807 | { \ |
---|
| 808 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
| 809 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 810 | { \ |
---|
| 811 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
| 812 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 813 | { \ |
---|
| 814 | if (size > 0) \ |
---|
| 815 | { \ |
---|
| 816 | sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_out <type> (name, size); \ |
---|
| 817 | } \ |
---|
| 818 | else \ |
---|
| 819 | { \ |
---|
| 820 | PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ |
---|
| 821 | } \ |
---|
| 822 | } \ |
---|
| 823 | } \ |
---|
| 824 | } \ |
---|
| 825 | } |
---|
| 826 | |
---|
| 827 | // #define ALLOC3_VAL_ACK_IN( sig, name, type ) _ALLOC3_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
| 828 | // #define ALLOC3_VAL_ACK_OUT(sig, name, type ) _ALLOC3_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2, iterator_3) |
---|
| 829 | #define ALLOC3_VALACK_IN( sig, type ) _ALLOC3_VALACK_IN( sig, type , iterator_1, iterator_2, iterator_3) |
---|
| 830 | #define ALLOC3_VALACK_OUT( sig, type ) _ALLOC3_VALACK_OUT( sig, type , iterator_1, iterator_2, iterator_3) |
---|
| 831 | #define ALLOC3_SIGNAL_IN( sig, name, type, size) _ALLOC3_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
| 832 | #define ALLOC3_SIGNAL_OUT( sig, name, type, size) _ALLOC3_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2, iterator_3) |
---|
| 833 | |
---|
| 834 | #define DELETE3_SIGNAL(sig, x1, x2, x3, size) \ |
---|
| 835 | { \ |
---|
| 836 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 837 | { \ |
---|
| 838 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 839 | { \ |
---|
| 840 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 841 | { \ |
---|
| 842 | if (size > 0) \ |
---|
| 843 | { \ |
---|
| 844 | delete sig[it1][it2][it3]; \ |
---|
| 845 | } \ |
---|
| 846 | } \ |
---|
| 847 | delete [] sig[it1][it2]; \ |
---|
| 848 | } \ |
---|
| 849 | delete [] sig[it1]; \ |
---|
| 850 | } \ |
---|
| 851 | delete [] sig; \ |
---|
| 852 | } |
---|
| 853 | |
---|
[113] | 854 | #define ALLOC3_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2,x3) \ |
---|
| 855 | { \ |
---|
| 856 | sig = new SC_IN (type) *** [x1]; \ |
---|
| 857 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 858 | { \ |
---|
| 859 | sig [it1] = new SC_IN (type) ** [x2]; \ |
---|
| 860 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 861 | { \ |
---|
| 862 | sig [it1][it2] = new SC_IN (type) * [x3]; \ |
---|
| 863 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 864 | if (size > 0) \ |
---|
| 865 | { \ |
---|
| 866 | std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ |
---|
| 867 | sig [it1][it2][it3] = new SC_IN (type) (str.c_str()); \ |
---|
| 868 | } \ |
---|
| 869 | } \ |
---|
| 870 | } \ |
---|
| 871 | } |
---|
| 872 | |
---|
| 873 | #define ALLOC3_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2,x3) \ |
---|
| 874 | { \ |
---|
| 875 | sig = new SC_OUT (type) *** [x1]; \ |
---|
| 876 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 877 | { \ |
---|
| 878 | sig [it1] = new SC_OUT (type) ** [x2]; \ |
---|
| 879 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 880 | { \ |
---|
| 881 | sig [it1][it2] = new SC_OUT (type) * [x3]; \ |
---|
| 882 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 883 | if (size > 0) \ |
---|
| 884 | { \ |
---|
| 885 | std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ |
---|
| 886 | sig [it1][it2][it3] = new SC_OUT(type) (str.c_str()); \ |
---|
| 887 | } \ |
---|
| 888 | } \ |
---|
| 889 | } \ |
---|
| 890 | } |
---|
| 891 | |
---|
| 892 | #define DELETE3_FOREIGN_SIGNAL( sig, size,x1,x2,x3) \ |
---|
| 893 | { \ |
---|
| 894 | DELETE3_SIGNAL(sig,x1,x2,x3,size); \ |
---|
| 895 | } |
---|
| 896 | |
---|
[88] | 897 | #define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3) \ |
---|
[113] | 898 | sig = new sc_signal<type> *** [x1]; \ |
---|
[88] | 899 | { \ |
---|
| 900 | std::string separator="_"; \ |
---|
| 901 | std::string str; \ |
---|
| 902 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 903 | { \ |
---|
| 904 | sig [it1] = new sc_signal<type> ** [x2]; \ |
---|
| 905 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 906 | { \ |
---|
| 907 | sig [it1][it2] = new sc_signal<type> * [x3]; \ |
---|
| 908 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 909 | { \ |
---|
| 910 | str = name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3); \ |
---|
| 911 | sig [it1][it2][it3] = new sc_signal<type> (str.c_str()); \ |
---|
| 912 | PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2][it3]); \ |
---|
| 913 | } \ |
---|
| 914 | } \ |
---|
| 915 | } \ |
---|
| 916 | } |
---|
| 917 | |
---|
| 918 | #define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3) \ |
---|
| 919 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 920 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 921 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 922 | { \ |
---|
| 923 | TEST_SIGNAL(component->sig [it1][it2][it3]->name(),component->sig [it1][it2][it3]); \ |
---|
| 924 | TEST_SIGNAL(sig [it1][it2][it3]->name(),sig [it1][it2][it3]); \ |
---|
| 925 | (*(component->sig[it1][it2][it3])) (*(sig[it1][it2][it3])); \ |
---|
| 926 | } |
---|
| 927 | |
---|
| 928 | #define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3) \ |
---|
| 929 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 930 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 931 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 932 | { \ |
---|
| 933 | TEST_SIGNAL(component->sig1 [it1][it2][it3]->name(),component->sig1 [it1][it2][it3]); \ |
---|
| 934 | TEST_SIGNAL(sig2 [it1][it2][it3]->name(),sig2 [it1][it2][it3]); \ |
---|
| 935 | (*(component->sig1[it1][it2][it3])) (*(sig2[it1][it2][it3])); \ |
---|
| 936 | } |
---|
| 937 | |
---|
| 938 | #define DELETE3_SC_SIGNAL(sig,x1,x2,x3) \ |
---|
| 939 | { \ |
---|
| 940 | for (uint32_t it1=0; it1<x1; it1++) \ |
---|
| 941 | { \ |
---|
| 942 | for (uint32_t it2=0; it2<x2; it2++) \ |
---|
| 943 | { \ |
---|
| 944 | for (uint32_t it3=0; it3<x3; it3++) \ |
---|
| 945 | { \ |
---|
[113] | 946 | PRINT_SIGNAL_ADDRESS("",sig[it1][it2][it3]); \ |
---|
[88] | 947 | delete sig[it1][it2][it3]; \ |
---|
| 948 | } \ |
---|
| 949 | delete [] sig[it1][it2]; \ |
---|
| 950 | } \ |
---|
| 951 | delete [] sig[it1]; \ |
---|
| 952 | } \ |
---|
| 953 | delete [] sig; \ |
---|
| 954 | } |
---|
| 955 | |
---|
| 956 | #endif |
---|