- Timestamp:
- Dec 10, 2008, 7:31:39 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h
r82 r88 11 11 #include "Common/include/Debug.h" 12 12 13 // ====================================================================== 14 // =====[ ALLOCATION / DELETE of ARRAY ]================================= 15 // ====================================================================== 16 17 #define ALLOC1(var,type,s1) \ 18 var = new type [s1] 19 20 #define ALLOC2(var,type,s1,s2) \ 21 var = new type * [s1]; \ 22 for (uint32_t it1=0; it1<s1; ++it1) \ 23 { \ 24 var [it1] = new type [s2]; \ 25 } 26 27 #define ALLOC3(var,type,s1,s2,s3) \ 28 var = new type ** [s1]; \ 29 for (uint32_t it1=0; it1<s1; ++it1) \ 30 { \ 31 var [it1] = new type * [s2]; \ 32 for (uint32_t it2=0; it2<s2; ++it2) \ 33 { \ 34 var [it1][it2] = new type [s3]; \ 35 } \ 36 } 37 38 #define ALLOC4(var,type,s1,s2,s3,s4) \ 39 var = new type *** [s1]; \ 40 for (uint32_t it1=0; it1<s1; ++it1) \ 41 { \ 42 var [it1] = new type ** [s2]; \ 43 for (uint32_t it2=0; it2<s2; ++it2) \ 44 { \ 45 var [it1][it2] = new type * [s3]; \ 46 for (uint32_t it3=0; it3<s3; ++it3) \ 47 { \ 48 var [it1][it2][it3] = new type [s4]; \ 49 } \ 50 } \ 51 } 52 53 #define DELETE1(var,s1) \ 54 delete [] var; 55 56 #define DELETE2(var,s1,s2) \ 57 for (uint32_t it1=0; it1<s1; ++it1) \ 58 { \ 59 delete [] var [it1]; \ 60 } \ 61 delete [] var; 62 63 #define DELETE3(var,s1,s2,s3) \ 64 for (uint32_t it1=0; it1<s1; ++it1) \ 65 { \ 66 for (uint32_t it2=0; it2<s2; ++it2) \ 67 { \ 68 delete [] var [it1][it2]; \ 69 } \ 70 delete [] var [it1]; \ 71 } \ 72 delete [] var; 73 74 #define DELETE4(var,s1,s2,s3,s4) \ 75 for (uint32_t it1=0; it1<s1; ++it1) \ 76 { \ 77 for (uint32_t it2=0; it2<s2; ++it2) \ 78 { \ 79 for (uint32_t it3=0; it3<s3; ++it3) \ 80 { \ 81 delete [] var [it1][it2][it3]; \ 82 } \ 83 delete [] var [it1][it2]; \ 84 } \ 85 delete [] var [it1]; \ 86 } \ 87 delete [] var; 88 89 // ====================================================================== 90 // =====[ ALLOCATION / DELETE of SIGNAL]================================= 91 // ====================================================================== 92 13 93 // Help to allocate interface 14 #define INTERFACE_PRINT(name) log_printf(TRACE,true,"allocation","Interface's creation : %s (%s, %d)",name,__FILE__,__LINE__); 94 #define INTERFACE_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : Interface's creation : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__); 95 #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__); 96 #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); 97 #define TEST_SIGNAL(name,address) PRINT_SIGNAL_ADDRESS(name,address); TEST_PTR(address) 15 98 16 99 // ---------------------------------------------------------------------- … … 18 101 // ---------------------------------------------------------------------- 19 102 20 #define __ALLOC_SIGNAL(sig, name, type) 21 { 22 sig = new type (name); 103 #define __ALLOC_SIGNAL(sig, name, type) \ 104 { \ 105 sig = new type (name); \ 23 106 } 24 107 25 108 #ifdef POSITION 26 #define ALLOC_INTERFACE( name, direction, localisation, str) 27 INTERFACE_PRINT(name); 28 Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str);109 #define ALLOC_INTERFACE( name, direction, localisation, str) \ 110 INTERFACE_PRINT(name); \ 111 morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str); 29 112 #else 30 #define ALLOC_INTERFACE( name, direction, localisation, str) 31 INTERFACE_PRINT(name); 32 Interface_fifo * interface = _interfaces->set_interface( name);113 #define ALLOC_INTERFACE( name, direction, localisation, str) \ 114 INTERFACE_PRINT(name); \ 115 morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name); 33 116 #endif 34 117 35 #define ALLOC_VAL_ACK_IN( sig, name, type) 36 { 37 sig = interface->set_signal_valack_in (name, type); 38 } 39 #define ALLOC_VAL_ACK_OUT( sig, name, type) 40 { 41 sig = interface->set_signal_valack_out(name, type); 42 } 43 #define ALLOC_VALACK_IN( sig, type) 44 { 45 sig = interface->set_signal_valack_in (type); 46 } 47 #define ALLOC_VALACK_OUT( sig, type) 48 { 49 sig = interface->set_signal_valack_out(type); 50 } 51 #define ALLOC_SIGNAL_IN( sig, name, type, size) 52 if (size > 0) 53 { 54 sig = interface->set_signal_in <type> (name, size); 55 } 56 else 57 { 58 log_printf(INFO,true,FUNCTION,_("%s %s.%s.%s : size is nul."),MSG_INFORMATION,_component->get_name().c_str(),interface->get_name().c_str(),name);\118 #define ALLOC_VAL_ACK_IN( sig, name, type) \ 119 { \ 120 sig = interface->set_signal_valack_in (name, type); \ 121 } 122 #define ALLOC_VAL_ACK_OUT( sig, name, type) \ 123 { \ 124 sig = interface->set_signal_valack_out(name, type); \ 125 } 126 #define ALLOC_VALACK_IN( sig, type) \ 127 { \ 128 sig = interface->set_signal_valack_in (type); \ 129 } 130 #define ALLOC_VALACK_OUT( sig, type) \ 131 { \ 132 sig = interface->set_signal_valack_out(type); \ 133 } 134 #define ALLOC_SIGNAL_IN( sig, name, type, size) \ 135 if (size > 0) \ 136 { \ 137 sig = interface->set_signal_in <type> (name, size); \ 138 } \ 139 else \ 140 { \ 141 PRINT_SIZE_NUL(_component,interface,name); \ 59 142 } 60 143 61 #define ALLOC_SIGNAL_OUT( sig, name, type, size) 62 if (size > 0) 63 { 64 sig = interface->set_signal_out<type> (name, size); 65 } 66 else 67 { 68 log_printf(INFO,true,FUNCTION,_("%s %s.%s.%s : size is nul."),MSG_INFORMATION,_component->get_name().c_str(),interface->get_name().c_str(),name); \144 #define ALLOC_SIGNAL_OUT( sig, name, type, size) \ 145 if (size > 0) \ 146 { \ 147 sig = interface->set_signal_out<type> (name, size); \ 148 } \ 149 else \ 150 { \ 151 PRINT_SIZE_NUL(_component,interface,name); \ 69 152 } 70 153 71 #define DELETE_SIGNAL( sig, size) 72 if (size > 0) 73 { 74 delete sig; 154 #define DELETE_SIGNAL( sig, size) \ 155 if (size > 0) \ 156 { \ 157 delete sig; \ 75 158 } 76 159 77 #define ALLOC_SC_SIGNAL( sig, name, type) \ 78 sc_signal<type> * sig = new sc_signal<type> (name); 79 80 #define INSTANCE_SC_SIGNAL(component, sig) \ 81 { \ 82 TEST_PTR(component->sig); \ 83 TEST_PTR(sig); \ 84 (*(component->sig)) (*(sig)); \ 85 } 86 87 #define DELETE_SC_SIGNAL( sig) \ 88 { \ 89 delete sig; \ 90 } 160 #define ALLOC_SC_SIGNAL( sig, name, type) \ 161 sc_signal<type> * sig = new sc_signal<type> (name); \ 162 PRINT_SIGNAL_ADDRESS(name,sig); 163 164 #define INSTANCE_SC_SIGNAL(component, sig) \ 165 { \ 166 TEST_SIGNAL(component->sig->name(),component->sig); \ 167 TEST_SIGNAL(sig ->name(),sig); \ 168 (*(component->sig)) (*(sig)); \ 169 } 170 171 #define _INSTANCE_SC_SIGNAL(component, sig1,sig2) \ 172 { \ 173 TEST_SIGNAL(component->sig1->name(),component->sig1); \ 174 TEST_SIGNAL(sig2 ->name(),sig2); \ 175 (*(component->sig1)) (*(sig2)); \ 176 } 177 178 #define DELETE_SC_SIGNAL( sig) \ 179 { \ 180 delete sig; \ 181 } 182 183 184 #define __ALLOC0_SIGNAL(sig, name, type) __ALLOC_SIGNAL(sig, name, type) 185 186 #define ALLOC0_INTERFACE( name, direction, localisation, str) ALLOC_INTERFACE( name, direction, localisation, str) 187 188 #define ALLOC0_VAL_ACK_IN( sig, name, type) ALLOC_VAL_ACK_IN( sig, name, type) 189 #define ALLOC0_VAL_ACK_OUT( sig, name, type) ALLOC_VAL_ACK_OUT( sig, name, type) 190 #define ALLOC0_VALACK_IN( sig, type) ALLOC_VALACK_IN( sig, type) 191 #define ALLOC0_VALACK_OUT( sig, type) ALLOC_VALACK_OUT( sig, type) 192 #define ALLOC0_SIGNAL_IN( sig, name, type, size) ALLOC_SIGNAL_IN( sig, name, type, size) 193 #define ALLOC0_SIGNAL_OUT( sig, name, type, size) ALLOC_SIGNAL_OUT( sig, name, type, size) 194 #define DELETE0_SIGNAL( sig, size) DELETE_SIGNAL( sig, size) 195 196 #define ALLOC0_SC_SIGNAL( sig, name, type) ALLOC_SC_SIGNAL( sig, name, type) 197 #define INSTANCE0_SC_SIGNAL(component, sig) INSTANCE_SC_SIGNAL(component, sig) 198 #define _INSTANCE0_SC_SIGNAL(component, sig) _INSTANCE_SC_SIGNAL(component, sig) 199 #define DELETE0_SC_SIGNAL( sig) DELETE_SC_SIGNAL( sig) 91 200 92 201 // ---------------------------------------------------------------------- … … 94 203 // ---------------------------------------------------------------------- 95 204 96 #define __ALLOC1_INTERFACE(name, it1)\97 INTERFACE_PRINT(name); 98 const std::string interface_name = name; 99 const uint32_t iterator_1 = it1;100 101 #define __ALLOC1_SIGNAL_IN( sig, name, type) 102 { 103 sig = new SC_IN(type) * [iterator_1]; 104 std::string separator="_"; 105 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++)\106 { 107 std::string str = "in_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \108 sig [alloc_signal_it1] = new SC_IN(type) (str.c_str());\109 } 110 } 111 112 #define __ALLOC1_SIGNAL_OUT( sig, name, type) 113 { 114 sig = new SC_OUT(type) * [iterator_1]; 115 std::string separator="_"; 116 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++)\117 { 118 std::string str = "out_"+interface_name+separator+toString(alloc_signal_it1)+separator+name; \119 sig [alloc_signal_it1] = new SC_OUT(type) (str.c_str());\120 } 205 #define __ALLOC1_INTERFACE(name, x1) \ 206 INTERFACE_PRINT(name); \ 207 const std::string interface_name = name; \ 208 const uint32_t iterator_1 = x1; 209 210 #define __ALLOC1_SIGNAL_IN( sig, name, type) \ 211 { \ 212 sig = new SC_IN(type) * [iterator_1]; \ 213 std::string separator="_"; \ 214 for (uint32_t it1=0; it1<iterator_1; it1++) \ 215 { \ 216 std::string str = "in_"+interface_name+separator+toString(it1)+separator+name; \ 217 sig [it1] = new SC_IN(type) (str.c_str()); \ 218 } \ 219 } 220 221 #define __ALLOC1_SIGNAL_OUT( sig, name, type) \ 222 { \ 223 sig = new SC_OUT(type) * [iterator_1]; \ 224 std::string separator="_"; \ 225 for (uint32_t it1=0; it1<iterator_1; it1++) \ 226 { \ 227 std::string str = "out_"+interface_name+separator+toString(it1)+separator+name; \ 228 sig [it1] = new SC_OUT(type) (str.c_str()); \ 229 } \ 121 230 } 122 231 123 232 #ifdef POSITION 124 #define ALLOC1_INTERFACE( name, direction, localisation, str, it1)\125 INTERFACE_PRINT(name); 126 const uint32_t iterator_1 = it1;\127 Interface_fifo * interface [iterator_1];\128 { 129 std::string separator="_"; 130 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++)\131 { 132 interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1), direction, localisation, str); \133 } 233 #define ALLOC1_INTERFACE( name, direction, localisation, str, x1) \ 234 INTERFACE_PRINT(name); \ 235 const uint32_t iterator_1 = x1; \ 236 morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ 237 { \ 238 std::string separator="_"; \ 239 for (uint32_t it1=0; it1<iterator_1; it1++) \ 240 { \ 241 interface [it1] = _interfaces->set_interface( name+separator+toString(it1), direction, localisation, str); \ 242 } \ 134 243 } 135 244 #else 136 #define ALLOC1_INTERFACE( name, direction, localisation, str, it1)\137 INTERFACE_PRINT(name); 138 const uint32_t iterator_1 = it1;\139 Interface_fifo * interface [iterator_1];\140 { 141 std::string separator="_"; 142 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++)\143 { 144 interface [alloc_interface_it1] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)); \145 } 245 #define ALLOC1_INTERFACE( name, direction, localisation, str, x1) \ 246 INTERFACE_PRINT(name); \ 247 const uint32_t iterator_1 = x1; \ 248 morpheo::behavioural::Interface_fifo * interface [iterator_1]; \ 249 { \ 250 std::string separator="_"; \ 251 for (uint32_t it1=0; it1<iterator_1; it1++) \ 252 { \ 253 interface [it1] = _interfaces->set_interface( name+separator+toString(it1)); \ 254 } \ 146 255 } 147 256 #endif 148 257 149 #define ALLOC1_VAL_ACK_IN( sig, name, type) \ 150 { \ 151 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 152 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 153 { \ 154 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (name, type); \ 155 } \ 156 } 157 #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ 158 { \ 159 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 160 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 161 { \ 162 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(name, type); \ 163 } \ 164 } 165 #define ALLOC1_VALACK_IN( sig, type) \ 166 { \ 167 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 168 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 169 { \ 170 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_in (type); \ 171 } \ 172 } 173 #define ALLOC1_VALACK_OUT( sig, type) \ 174 { \ 175 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 176 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 177 { \ 178 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_valack_out(type); \ 179 } \ 180 } 181 #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ 182 { \ 183 sig = new SC_IN (type) * [iterator_1]; \ 184 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 185 { \ 186 if (size > 0) \ 187 { \ 188 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_in <type> (name, size); \ 189 } \ 190 else \ 191 { \ 192 log_printf(INFO,true,FUNCTION,_("%s %s.%s.%s : size is nul."),MSG_INFORMATION,_component->get_name().c_str(),interface[alloc_signal_it1]->get_name().c_str(),name); \ 193 } \ 194 } \ 195 } 196 197 #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ 198 { \ 199 sig = new SC_OUT(type) * [iterator_1]; \ 200 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<iterator_1; alloc_signal_it1++) \ 201 { \ 202 if (size > 0) \ 203 { \ 204 sig [alloc_signal_it1] = interface[alloc_signal_it1]->set_signal_out<type> (name, size); \ 205 } \ 206 else \ 207 { \ 208 log_printf(INFO,true,FUNCTION,_("%s %s.%s.%s : size is nul."),MSG_INFORMATION,_component->get_name().c_str(),interface[alloc_signal_it1]->get_name().c_str(),name); \ 209 } \ 210 } \ 211 } 212 213 #define DELETE1_SIGNAL(sig, it1, size) \ 214 { \ 215 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 216 { \ 217 if (size > 0) \ 218 { \ 219 delete sig[alloc_signal_it1]; \ 220 } \ 221 } \ 222 delete [] sig; \ 223 } 224 225 #define ALLOC1_SC_SIGNAL( sig, name, type, it1) \ 226 sc_signal<type> ** sig = new sc_signal<type> * [it1]; \ 227 { \ 228 std::string separator="_"; \ 229 std::string str; \ 230 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 231 { \ 232 str = name+separator+toString(alloc_signal_it1); \ 233 sig [alloc_signal_it1] = new sc_signal<type> (str.c_str()); \ 234 } \ 235 } 236 237 #define INSTANCE1_SC_SIGNAL(component, sig, it1) \ 238 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 239 { \ 240 TEST_PTR(component->sig [alloc_signal_it1]); \ 241 TEST_PTR(sig [alloc_signal_it1]); \ 242 (*(component->sig[alloc_signal_it1])) (*(sig[alloc_signal_it1])); \ 258 #define ALLOC1_VAL_ACK_IN( sig, name, type) \ 259 { \ 260 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 261 for (uint32_t it1=0; it1<iterator_1; it1++) \ 262 { \ 263 sig [it1] = interface[it1]->set_signal_valack_in (name, type); \ 264 } \ 265 } 266 #define ALLOC1_VAL_ACK_OUT(sig, name, type) \ 267 { \ 268 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 269 for (uint32_t it1=0; it1<iterator_1; it1++) \ 270 { \ 271 sig [it1] = interface[it1]->set_signal_valack_out(name, type); \ 272 } \ 273 } 274 #define ALLOC1_VALACK_IN( sig, type) \ 275 { \ 276 sig = new SC_IN (Tcontrol_t) * [iterator_1]; \ 277 for (uint32_t it1=0; it1<iterator_1; it1++) \ 278 { \ 279 sig [it1] = interface[it1]->set_signal_valack_in (type); \ 280 } \ 281 } 282 #define ALLOC1_VALACK_OUT( sig, type) \ 283 { \ 284 sig = new SC_OUT(Tcontrol_t) * [iterator_1]; \ 285 for (uint32_t it1=0; it1<iterator_1; it1++) \ 286 { \ 287 sig [it1] = interface[it1]->set_signal_valack_out(type); \ 288 } \ 289 } 290 #define ALLOC1_SIGNAL_IN( sig, name, type, size) \ 291 { \ 292 sig = new SC_IN (type) * [iterator_1]; \ 293 for (uint32_t it1=0; it1<iterator_1; it1++) \ 294 { \ 295 if (size > 0) \ 296 { \ 297 sig [it1] = interface[it1]->set_signal_in <type> (name, size); \ 298 } \ 299 else \ 300 { \ 301 PRINT_SIZE_NUL(_component,interface[it1],name); \ 302 } \ 303 } \ 304 } 305 306 #define ALLOC1_SIGNAL_OUT(sig, name, type, size) \ 307 { \ 308 sig = new SC_OUT(type) * [iterator_1]; \ 309 for (uint32_t it1=0; it1<iterator_1; it1++) \ 310 { \ 311 if (size > 0) \ 312 { \ 313 sig [it1] = interface[it1]->set_signal_out<type> (name, size); \ 314 } \ 315 else \ 316 { \ 317 PRINT_SIZE_NUL(_component,interface[it1],name); \ 318 } \ 319 } \ 320 } 321 322 #define DELETE1_SIGNAL(sig, x1, size) \ 323 { \ 324 for (uint32_t it1=0; it1<x1; it1++) \ 325 { \ 326 if (size > 0) \ 327 { \ 328 delete sig[it1]; \ 329 } \ 330 } \ 331 delete [] sig; \ 332 } 333 334 #define ALLOC1_SC_SIGNAL( sig, name, type, x1) \ 335 sc_signal<type> ** sig = new sc_signal<type> * [x1]; \ 336 { \ 337 std::string separator="_"; \ 338 std::string str; \ 339 for (uint32_t it1=0; it1<x1; it1++) \ 340 { \ 341 str = name+separator+toString(it1); \ 342 sig [it1] = new sc_signal<type> (str.c_str()); \ 343 PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1]); \ 344 } \ 345 } 346 347 #define INSTANCE1_SC_SIGNAL(component, sig, x1) \ 348 for (uint32_t it1=0; it1<x1; it1++) \ 349 { \ 350 TEST_SIGNAL(component->sig [it1]->name(),component->sig [it1]); \ 351 TEST_SIGNAL(sig [it1]->name(),sig [it1]); \ 352 (*(component->sig[it1])) (*(sig[it1])); \ 243 353 } 244 354 245 #define DELETE1_SC_SIGNAL(sig, it1) \ 246 { \ 247 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 248 { \ 249 delete sig[alloc_signal_it1]; \ 250 } \ 251 delete [] sig; \ 355 #define _INSTANCE1_SC_SIGNAL(component, sig1, sig2, x1) \ 356 for (uint32_t it1=0; it1<x1; it1++) \ 357 { \ 358 TEST_SIGNAL(component->sig1 [it1]->name(),component->sig1 [it1]); \ 359 TEST_SIGNAL(sig2 [it1]->name(),sig2 [it1]); \ 360 (*(component->sig1[it1])) (*(sig2[it1])); \ 361 } 362 363 #define DELETE1_SC_SIGNAL(sig, x1) \ 364 { \ 365 for (uint32_t it1=0; it1<x1; it1++) \ 366 { \ 367 delete sig[it1]; \ 368 } \ 369 delete [] sig; \ 252 370 } 253 371 … … 257 375 258 376 #ifdef POSITION 259 #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2)\260 INTERFACE_PRINT(name); 261 uint32_t iterator_1 = 0; 262 uint32_t iterator_2 = 0; 263 Interface_fifo *** interface;\264 { 265 std::string separator="_"; 266 iterator_1 = it1;\267 interface = new Interface_fifo ** [iterator_1];\268 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++)\269 { 270 iterator_2 = it2;\271 interface [alloc_interface_it1] = newInterface_fifo * [iterator_2]; \272 for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++)\273 {\274 interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2), direction, localisation, str); \275 }\276 } 377 #define ALLOC2_INTERFACE( name, direction, localisation, str, x1, x2) \ 378 INTERFACE_PRINT(name); \ 379 uint32_t iterator_1 = 0; \ 380 uint32_t iterator_2 = 0; \ 381 morpheo::behavioural::Interface_fifo *** interface; \ 382 { \ 383 std::string separator="_"; \ 384 iterator_1 = x1; \ 385 interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ 386 for (uint32_t it1=0; it1<iterator_1; it1++) \ 387 { \ 388 iterator_2 = x2; \ 389 interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ 390 for (uint32_t it2=0; it2<iterator_2; it2++) \ 391 { \ 392 interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2), direction, localisation, str); \ 393 } \ 394 } \ 277 395 } 278 396 #else 279 #define ALLOC2_INTERFACE( name, direction, localisation, str, it1, it2)\280 INTERFACE_PRINT(name); 281 uint32_t iterator_1 = 0; 282 uint32_t iterator_2 = 0; 283 Interface_fifo *** interface;\284 { 285 std::string separator="_"; 286 iterator_1 = it1;\287 interface = new Interface_fifo ** [iterator_1];\288 for (uint32_t alloc_interface_it1=0; alloc_interface_it1<iterator_1; alloc_interface_it1++)\289 { 290 iterator_2 = it2;\291 interface [alloc_interface_it1] = newInterface_fifo * [iterator_2]; \292 for (uint32_t alloc_interface_it2=0; alloc_interface_it2<iterator_2; alloc_interface_it2++)\293 {\294 interface [alloc_interface_it1][alloc_interface_it2] = _interfaces->set_interface( name+separator+toString(alloc_interface_it1)+separator+toString(alloc_interface_it2)); \295 }\296 } 397 #define ALLOC2_INTERFACE( name, direction, localisation, str, x1, x2) \ 398 INTERFACE_PRINT(name); \ 399 uint32_t iterator_1 = 0; \ 400 uint32_t iterator_2 = 0; \ 401 morpheo::behavioural::Interface_fifo *** interface; \ 402 { \ 403 std::string separator="_"; \ 404 iterator_1 = x1; \ 405 interface = new morpheo::behavioural::Interface_fifo ** [iterator_1]; \ 406 for (uint32_t it1=0; it1<iterator_1; it1++) \ 407 { \ 408 iterator_2 = x2; \ 409 interface [it1] = new morpheo::behavioural::Interface_fifo * [iterator_2]; \ 410 for (uint32_t it2=0; it2<iterator_2; it2++) \ 411 { \ 412 interface [it1][it2] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)); \ 413 } \ 414 } \ 297 415 } 298 416 #endif 299 417 300 #define _ALLOC2_VAL_ACK_IN( sig, name, type, it1, it2)\301 { 302 sig = new SC_IN (Tcontrol_t) ** [ it1];\303 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++)\304 { 305 sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2];\306 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++)\307 {\308 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (name, type); \309 }\310 } 311 } 312 313 #define _ALLOC2_VAL_ACK_OUT( sig, name, type, it1, it2)\314 { 315 sig = new SC_OUT (Tcontrol_t) ** [ it1];\316 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++)\317 { 318 sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2];\319 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++)\320 {\321 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (name, type); \322 }\323 } 324 } 325 326 #define _ALLOC2_VALACK_IN( sig,type, it1, it2)\327 { 328 sig = new SC_IN (Tcontrol_t) ** [ it1];\329 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++)\330 { 331 sig [alloc_signal_it1] = new SC_IN (Tcontrol_t) * [it2];\332 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++)\333 {\334 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_in (type); \335 }\336 } 337 } 338 339 #define _ALLOC2_VALACK_OUT( sig,type, it1, it2)\340 { 341 sig = new SC_OUT (Tcontrol_t) ** [ it1];\342 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++)\343 { 344 sig [alloc_signal_it1] = new SC_OUT (Tcontrol_t) * [it2];\345 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++)\346 {\347 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_valack_out (type); \348 }\349 } 350 } 351 352 #define _ALLOC2_SIGNAL_IN( sig, name, type, size, it1, it2)\353 { 354 sig = new SC_IN (type) ** [ it1];\355 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++)\356 { 357 sig [alloc_signal_it1] = new SC_IN (type) * [it2];\358 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++)\359 {\360 if (size > 0)\361 {\362 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_in <type> (name, size); \363 }\364 else\365 {\366 log_printf(INFO,true,FUNCTION,_("%s %s.%s.%s : size is nul."),MSG_INFORMATION,_component->get_name().c_str(),interface[alloc_signal_it1][alloc_signal_it2]->get_name().c_str(),name);\367 }\368 }\369 } 370 } 371 372 #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, it1, it2)\373 { 374 sig = new SC_OUT (type) ** [ it1];\375 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++)\376 { 377 sig [alloc_signal_it1] = new SC_OUT (type) * [it2];\378 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++)\379 {\380 if (size > 0)\381 {\382 sig [alloc_signal_it1][alloc_signal_it2] = interface[alloc_signal_it1][alloc_signal_it2]->set_signal_out <type> (name, size); \383 }\384 else\385 {\386 log_printf(INFO,true,FUNCTION,_("%s %s.%s.%s : size is nul."),MSG_INFORMATION,_component->get_name().c_str(),interface[alloc_signal_it1][alloc_signal_it2]->get_name().c_str(),name);\387 }\388 }\389 } 418 #define _ALLOC2_VAL_ACK_IN( sig, name, type, x1, x2) \ 419 { \ 420 sig = new SC_IN (Tcontrol_t) ** [x1]; \ 421 for (uint32_t it1=0; it1<x1; it1++) \ 422 { \ 423 sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ 424 for (uint32_t it2=0; it2<x2; it2++) \ 425 { \ 426 sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (name, type); \ 427 } \ 428 } \ 429 } 430 431 #define _ALLOC2_VAL_ACK_OUT( sig, name, type, x1, x2) \ 432 { \ 433 sig = new SC_OUT (Tcontrol_t) ** [x1]; \ 434 for (uint32_t it1=0; it1<x1; it1++) \ 435 { \ 436 sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ 437 for (uint32_t it2=0; it2<x2; it2++) \ 438 { \ 439 sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (name, type); \ 440 } \ 441 } \ 442 } 443 444 #define _ALLOC2_VALACK_IN( sig,type, x1, x2) \ 445 { \ 446 sig = new SC_IN (Tcontrol_t) ** [x1]; \ 447 for (uint32_t it1=0; it1<x1; it1++) \ 448 { \ 449 sig [it1] = new SC_IN (Tcontrol_t) * [x2]; \ 450 for (uint32_t it2=0; it2<x2; it2++) \ 451 { \ 452 sig [it1][it2] = interface[it1][it2]->set_signal_valack_in (type); \ 453 } \ 454 } \ 455 } 456 457 #define _ALLOC2_VALACK_OUT( sig,type, x1, x2) \ 458 { \ 459 sig = new SC_OUT (Tcontrol_t) ** [x1]; \ 460 for (uint32_t it1=0; it1<x1; it1++) \ 461 { \ 462 sig [it1] = new SC_OUT (Tcontrol_t) * [x2]; \ 463 for (uint32_t it2=0; it2<x2; it2++) \ 464 { \ 465 sig [it1][it2] = interface[it1][it2]->set_signal_valack_out (type); \ 466 } \ 467 } \ 468 } 469 470 #define _ALLOC2_SIGNAL_IN( sig, name, type, size, x1, x2) \ 471 { \ 472 sig = new SC_IN (type) ** [x1]; \ 473 for (uint32_t it1=0; it1<x1; it1++) \ 474 { \ 475 sig [it1] = new SC_IN (type) * [x2]; \ 476 for (uint32_t it2=0; it2<x2; it2++) \ 477 { \ 478 if (size > 0) \ 479 { \ 480 sig [it1][it2] = interface[it1][it2]->set_signal_in <type> (name, size); \ 481 } \ 482 else \ 483 { \ 484 PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ 485 } \ 486 } \ 487 } \ 488 } 489 490 #define _ALLOC2_SIGNAL_OUT( sig, name, type, size, x1, x2) \ 491 { \ 492 sig = new SC_OUT (type) ** [x1]; \ 493 for (uint32_t it1=0; it1<x1; it1++) \ 494 { \ 495 sig [it1] = new SC_OUT (type) * [x2]; \ 496 for (uint32_t it2=0; it2<x2; it2++) \ 497 { \ 498 if (size > 0) \ 499 { \ 500 sig [it1][it2] = interface[it1][it2]->set_signal_out <type> (name, size); \ 501 } \ 502 else \ 503 { \ 504 PRINT_SIZE_NUL(_component,interface[it1][it2],name); \ 505 } \ 506 } \ 507 } \ 390 508 } 391 509 … … 397 515 #define ALLOC2_SIGNAL_OUT( sig, name, type, size) _ALLOC2_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2) 398 516 399 #define DELETE2_SIGNAL(sig, it1,it2, size) \ 400 { \ 401 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 402 { \ 403 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 404 { \ 405 if (size > 0) \ 406 { \ 407 delete sig[alloc_signal_it1][alloc_signal_it2]; \ 408 } \ 409 } \ 410 delete [] sig[alloc_signal_it1]; \ 411 } \ 412 delete [] sig; \ 413 } 414 415 #define ALLOC2_SC_SIGNAL( sig, name, type, it1, it2) \ 416 sc_signal<type> *** sig = new sc_signal<type> ** [it1]; \ 417 { \ 418 std::string separator="_"; \ 419 std::string str; \ 420 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 421 { \ 422 sig [alloc_signal_it1] = new sc_signal<type> * [it2]; \ 423 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 424 { \ 425 str = name+separator+toString(alloc_signal_it1)+separator+toString(alloc_signal_it2); \ 426 sig [alloc_signal_it1][alloc_signal_it2] = new sc_signal<type> (str.c_str()); \ 427 } \ 428 } \ 429 } 430 431 #define INSTANCE2_SC_SIGNAL(component, sig, it1, it2) \ 432 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 433 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 434 { \ 435 TEST_PTR(component->sig [alloc_signal_it1][alloc_signal_it2]); \ 436 TEST_PTR(sig [alloc_signal_it1][alloc_signal_it2]); \ 437 (*(component->sig[alloc_signal_it1][alloc_signal_it2])) (*(sig[alloc_signal_it1][alloc_signal_it2])); \ 517 #define DELETE2_SIGNAL(sig, x1,x2, size) \ 518 { \ 519 for (uint32_t it1=0; it1<x1; it1++) \ 520 { \ 521 for (uint32_t it2=0; it2<x2; it2++) \ 522 { \ 523 if (size > 0) \ 524 { \ 525 delete sig[it1][it2]; \ 526 } \ 527 } \ 528 delete [] sig[it1]; \ 529 } \ 530 delete [] sig; \ 531 } 532 533 #define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2) \ 534 sc_signal<type> *** sig = new sc_signal<type> ** [x1]; \ 535 { \ 536 std::string separator="_"; \ 537 std::string str; \ 538 for (uint32_t it1=0; it1<x1; it1++) \ 539 { \ 540 sig [it1] = new sc_signal<type> * [x2]; \ 541 for (uint32_t it2=0; it2<x2; it2++) \ 542 { \ 543 str = name+separator+toString(it1)+separator+toString(it2); \ 544 sig [it1][it2] = new sc_signal<type> (str.c_str()); \ 545 PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2]); \ 546 } \ 547 } \ 548 } 549 550 #define INSTANCE2_SC_SIGNAL(component, sig, x1, x2) \ 551 for (uint32_t it1=0; it1<x1; it1++) \ 552 for (uint32_t it2=0; it2<x2; it2++) \ 553 { \ 554 TEST_SIGNAL(component->sig [it1][it2]->name(),component->sig [it1][it2]); \ 555 TEST_SIGNAL(sig [it1][it2]->name(),sig [it1][it2]); \ 556 (*(component->sig[it1][it2])) (*(sig[it1][it2])); \ 438 557 } 439 558 440 #define DELETE2_SC_SIGNAL(sig,it1,it2) \ 441 { \ 442 for (uint32_t alloc_signal_it1=0; alloc_signal_it1<it1; alloc_signal_it1++) \ 443 { \ 444 for (uint32_t alloc_signal_it2=0; alloc_signal_it2<it2; alloc_signal_it2++) \ 445 { \ 446 delete sig[alloc_signal_it1][alloc_signal_it2]; \ 447 } \ 448 delete [] sig[alloc_signal_it1]; \ 449 } \ 450 delete [] sig; \ 451 } 452 559 #define _INSTANCE2_SC_SIGNAL(component, sig1, sig2, x1, x2) \ 560 for (uint32_t it1=0; it1<x1; it1++) \ 561 for (uint32_t it2=0; it2<x2; it2++) \ 562 { \ 563 TEST_SIGNAL(component->sig1 [it1][it2]->name(),component->sig1 [it1][it2]); \ 564 TEST_SIGNAL(sig2 [it1][it2]->name(),sig2 [it1][it2]); \ 565 (*(component->sig1[it1][it2])) (*(sig2[it1][it2])); \ 566 } 567 568 #define DELETE2_SC_SIGNAL(sig,x1,x2) \ 569 { \ 570 for (uint32_t it1=0; it1<x1; it1++) \ 571 { \ 572 for (uint32_t it2=0; it2<x2; it2++) \ 573 { \ 574 delete sig[it1][it2]; \ 575 } \ 576 delete [] sig[it1]; \ 577 } \ 578 delete [] sig; \ 579 } 580 581 // ---------------------------------------------------------------------- 582 // -----[ ITERATION 3 ]-------------------------------------------------- 583 // ---------------------------------------------------------------------- 584 585 #ifdef POSITION 586 #define ALLOC3_INTERFACE( name, direction, localisation, str, x1, x2, x3) \ 587 INTERFACE_PRINT(name); \ 588 uint32_t iterator_1 = 0; \ 589 uint32_t iterator_2 = 0; \ 590 uint32_t iterator_3 = 0; \ 591 morpheo::behavioural::Interface_fifo **** interface; \ 592 { \ 593 std::string separator="_"; \ 594 iterator_1 = x1; \ 595 interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ 596 for (uint32_t it1=0; it1<iterator_1; it1++) \ 597 { \ 598 iterator_2 = x2; \ 599 interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ 600 for (uint32_t it2=0; it2<iterator_2; it2++) \ 601 { \ 602 iterator_3 = x3; \ 603 interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ 604 for (uint32_t it3=0; it3<iterator_3; it3++) \ 605 { \ 606 interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3), direction, localisation, str); \ 607 } \ 608 } \ 609 } \ 610 } 611 #else 612 #define ALLOC3_INTERFACE( name, direction, localisation, str, x1, x2, x3) \ 613 INTERFACE_PRINT(name); \ 614 uint32_t iterator_1 = 0; \ 615 uint32_t iterator_2 = 0; \ 616 uint32_t iterator_3 = 0; \ 617 morpheo::behavioural::Interface_fifo **** interface; \ 618 { \ 619 std::string separator="_"; \ 620 iterator_1 = x1; \ 621 interface = new morpheo::behavioural::Interface_fifo *** [iterator_1]; \ 622 for (uint32_t it1=0; it1<iterator_1; it1++) \ 623 { \ 624 iterator_2 = x2; \ 625 interface [it1] = new morpheo::behavioural::Interface_fifo ** [iterator_2]; \ 626 for (uint32_t it2=0; it2<iterator_2; it2++) \ 627 { \ 628 iterator_3 = x3; \ 629 interface [it1][it2] = new morpheo::behavioural::Interface_fifo * [iterator_3]; \ 630 for (uint32_t it3=0; it3<iterator_3; it3++) \ 631 { \ 632 interface [it1][it2][it3] = _interfaces->set_interface( name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3)); \ 633 } \ 634 } \ 635 } \ 636 } 453 637 #endif 638 639 // #define _ALLOC3_VAL_ACK_IN( sig, name, type, x1, x2, x3) 640 // #define _ALLOC3_VAL_ACK_OUT( sig, name, type, x1, x2, x3) 641 642 #define _ALLOC3_VALACK_IN( sig,type, x1, x2, x3) \ 643 { \ 644 sig = new SC_IN (Tcontrol_t) *** [x1]; \ 645 for (uint32_t it1=0; it1<x1; it1++) \ 646 { \ 647 sig [it1] = new SC_IN (Tcontrol_t) ** [x2]; \ 648 for (uint32_t it2=0; it2<x2; it2++) \ 649 { \ 650 sig [it1][it2] = new SC_IN (Tcontrol_t) * [x3]; \ 651 for (uint32_t it3=0; it3<x3; it3++) \ 652 { \ 653 sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_in (type); \ 654 } \ 655 } \ 656 } \ 657 } 658 659 #define _ALLOC3_VALACK_OUT( sig,type, x1, x2, x3) \ 660 { \ 661 sig = new SC_OUT (Tcontrol_t) *** [x1]; \ 662 for (uint32_t it1=0; it1<x1; it1++) \ 663 { \ 664 sig [it1] = new SC_OUT (Tcontrol_t) ** [x2]; \ 665 for (uint32_t it2=0; it2<x2; it2++) \ 666 { \ 667 sig [it1][it2] = new SC_OUT (Tcontrol_t) * [x3]; \ 668 for (uint32_t it3=0; it3<x3; it3++) \ 669 { \ 670 sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_valack_out (type); \ 671 } \ 672 } \ 673 } \ 674 } 675 676 677 #define _ALLOC3_SIGNAL_IN( sig, name, type, size, x1, x2,x3) \ 678 { \ 679 sig = new SC_IN (type) *** [x1]; \ 680 for (uint32_t it1=0; it1<x1; it1++) \ 681 { \ 682 sig [it1] = new SC_IN (type) ** [x2]; \ 683 for (uint32_t it2=0; it2<x2; it2++) \ 684 { \ 685 sig [it1][it2] = new SC_IN (type) * [x3]; \ 686 for (uint32_t it3=0; it3<x3; it3++) \ 687 { \ 688 if (size > 0) \ 689 { \ 690 sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_in <type> (name, size); \ 691 } \ 692 else \ 693 { \ 694 PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ 695 } \ 696 } \ 697 } \ 698 } \ 699 } 700 701 #define _ALLOC3_SIGNAL_OUT( sig, name, type, size, x1, x2,x3) \ 702 { \ 703 sig = new SC_OUT (type) *** [x1]; \ 704 for (uint32_t it1=0; it1<x1; it1++) \ 705 { \ 706 sig [it1] = new SC_OUT (type) ** [x2]; \ 707 for (uint32_t it2=0; it2<x2; it2++) \ 708 { \ 709 sig [it1][it2] = new SC_OUT (type) * [x3]; \ 710 for (uint32_t it3=0; it3<x3; it3++) \ 711 { \ 712 if (size > 0) \ 713 { \ 714 sig [it1][it2][it3] = interface[it1][it2][it3]->set_signal_out <type> (name, size); \ 715 } \ 716 else \ 717 { \ 718 PRINT_SIZE_NUL(_component,interface[it1][it2][it3],name); \ 719 } \ 720 } \ 721 } \ 722 } \ 723 } 724 725 // #define ALLOC3_VAL_ACK_IN( sig, name, type ) _ALLOC3_VAL_ACK_IN( sig, name, type , iterator_1, iterator_2, iterator_3) 726 // #define ALLOC3_VAL_ACK_OUT(sig, name, type ) _ALLOC3_VAL_ACK_OUT(sig, name, type , iterator_1, iterator_2, iterator_3) 727 #define ALLOC3_VALACK_IN( sig, type ) _ALLOC3_VALACK_IN( sig, type , iterator_1, iterator_2, iterator_3) 728 #define ALLOC3_VALACK_OUT( sig, type ) _ALLOC3_VALACK_OUT( sig, type , iterator_1, iterator_2, iterator_3) 729 #define ALLOC3_SIGNAL_IN( sig, name, type, size) _ALLOC3_SIGNAL_IN( sig, name, type, size, iterator_1, iterator_2, iterator_3) 730 #define ALLOC3_SIGNAL_OUT( sig, name, type, size) _ALLOC3_SIGNAL_OUT( sig, name, type, size, iterator_1, iterator_2, iterator_3) 731 732 #define DELETE3_SIGNAL(sig, x1, x2, x3, size) \ 733 { \ 734 for (uint32_t it1=0; it1<x1; it1++) \ 735 { \ 736 for (uint32_t it2=0; it2<x2; it2++) \ 737 { \ 738 for (uint32_t it3=0; it3<x3; it3++) \ 739 { \ 740 if (size > 0) \ 741 { \ 742 delete sig[it1][it2][it3]; \ 743 } \ 744 } \ 745 delete [] sig[it1][it2]; \ 746 } \ 747 delete [] sig[it1]; \ 748 } \ 749 delete [] sig; \ 750 } 751 752 #define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3) \ 753 sc_signal<type> **** sig = new sc_signal<type> *** [x1]; \ 754 { \ 755 std::string separator="_"; \ 756 std::string str; \ 757 for (uint32_t it1=0; it1<x1; it1++) \ 758 { \ 759 sig [it1] = new sc_signal<type> ** [x2]; \ 760 for (uint32_t it2=0; it2<x2; it2++) \ 761 { \ 762 sig [it1][it2] = new sc_signal<type> * [x3]; \ 763 for (uint32_t it3=0; it3<x3; it3++) \ 764 { \ 765 str = name+separator+toString(it1)+separator+toString(it2)+separator+toString(it3); \ 766 sig [it1][it2][it3] = new sc_signal<type> (str.c_str()); \ 767 PRINT_SIGNAL_ADDRESS(str.c_str(),sig[it1][it2][it3]); \ 768 } \ 769 } \ 770 } \ 771 } 772 773 #define INSTANCE3_SC_SIGNAL(component, sig, x1, x2, x3) \ 774 for (uint32_t it1=0; it1<x1; it1++) \ 775 for (uint32_t it2=0; it2<x2; it2++) \ 776 for (uint32_t it3=0; it3<x3; it3++) \ 777 { \ 778 TEST_SIGNAL(component->sig [it1][it2][it3]->name(),component->sig [it1][it2][it3]); \ 779 TEST_SIGNAL(sig [it1][it2][it3]->name(),sig [it1][it2][it3]); \ 780 (*(component->sig[it1][it2][it3])) (*(sig[it1][it2][it3])); \ 781 } 782 783 #define _INSTANCE3_SC_SIGNAL(component, sig1, sig2, x1, x2, x3) \ 784 for (uint32_t it1=0; it1<x1; it1++) \ 785 for (uint32_t it2=0; it2<x2; it2++) \ 786 for (uint32_t it3=0; it3<x3; it3++) \ 787 { \ 788 TEST_SIGNAL(component->sig1 [it1][it2][it3]->name(),component->sig1 [it1][it2][it3]); \ 789 TEST_SIGNAL(sig2 [it1][it2][it3]->name(),sig2 [it1][it2][it3]); \ 790 (*(component->sig1[it1][it2][it3])) (*(sig2[it1][it2][it3])); \ 791 } 792 793 #define DELETE3_SC_SIGNAL(sig,x1,x2,x3) \ 794 { \ 795 for (uint32_t it1=0; it1<x1; it1++) \ 796 { \ 797 for (uint32_t it2=0; it2<x2; it2++) \ 798 { \ 799 for (uint32_t it3=0; it3<x3; it3++) \ 800 { \ 801 delete sig[it1][it2][it3]; \ 802 } \ 803 delete [] sig[it1][it2]; \ 804 } \ 805 delete [] sig[it1]; \ 806 } \ 807 delete [] sig; \ 808 } 809 810 #endif
Note: See TracChangeset
for help on using the changeset viewer.