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