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