- Timestamp:
- Apr 14, 2009, 8:39:12 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/include/Allocation.h
r112 r113 101 101 #define PRINT_SIZE_NUL(component,interface,signal) log_printf(TRACE,Allocation,FUNCTION,_("<%s> %s.%s.%s : size is nul."),_name.c_str(),component->get_name().c_str(),interface->get_name().c_str(),signal); 102 102 #define TEST_SIGNAL(name,address) PRINT_SIGNAL_ADDRESS(name,address); TEST_PTR(address) 103 #define INSTANCE_FOREIGN_PRINT(name) log_printf(TRACE,Allocation,FUNCTION,"<%s> : %s (%s, %d)",_name.c_str(),name,__FILE__,__LINE__); 103 104 104 105 // ---------------------------------------------------------------------- … … 106 107 // ---------------------------------------------------------------------- 107 108 108 109 #define __ALLOC0_SIGNAL(sig, name, type) \ 109 #define __ALLOC0_SIGNAL(sig, name, type) \ 110 110 { \ 111 111 sig = new type (name); \ … … 113 113 114 114 #ifdef POSITION 115 #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) 115 #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) \ 116 116 INTERFACE_PRINT(name); \ 117 117 morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name, direction, localisation, str); 118 118 #else 119 #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) 119 #define ALLOC0_INTERFACE_BEGIN( name, direction, localisation, str) \ 120 120 INTERFACE_PRINT(name); \ 121 121 morpheo::behavioural::Interface_fifo * interface = _interfaces->set_interface( name); … … 124 124 #define ALLOC0_INTERFACE_END() 125 125 126 #define ALLOC0_VAL_ACK_IN( sig, name, type) 126 #define ALLOC0_VAL_ACK_IN( sig, name, type) \ 127 127 { \ 128 128 sig = interface->set_signal_valack_in (name, type); \ 129 129 } 130 #define ALLOC0_VAL_ACK_OUT( sig, name, type) 130 #define ALLOC0_VAL_ACK_OUT( sig, name, type) \ 131 131 { \ 132 132 sig = interface->set_signal_valack_out(name, type); \ 133 133 } 134 #define ALLOC0_VALACK_IN( sig, type) 134 #define ALLOC0_VALACK_IN( sig, type) \ 135 135 { \ 136 136 sig = interface->set_signal_valack_in (type); \ … … 160 160 } 161 161 162 #define DELETE0_SIGNAL( sig, size) 162 #define DELETE0_SIGNAL( sig, size) \ 163 163 if (size > 0) \ 164 164 { \ … … 166 166 } 167 167 168 #define ALLOC0_SC_SIGNAL( sig, name, type) \ 169 sc_signal<type> * sig = new sc_signal<type> (name); \ 168 #define ALLOC0_FOREIGN_SIGNAL_IN( sig, interface, name, type, size) \ 169 if (size > 0) \ 170 { \ 171 std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \ 172 sig = new SC_IN (type) (str.c_str()); \ 173 } 174 175 #define ALLOC0_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size) \ 176 if (size > 0) \ 177 { \ 178 std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(name)); \ 179 sig = new SC_OUT (type) (str.c_str()); \ 180 } 181 182 #define DELETE0_FOREIGN_SIGNAL( sig, size) \ 183 { \ 184 DELETE0_SIGNAL(sig,size); \ 185 } 186 187 #define INSTANCE0_FOREIGN_SIGNAL(component, sig, type, name, size) \ 188 if (size > 0) \ 189 { \ 190 INSTANCE_FOREIGN_PRINT(name); \ 191 _component->set_sc_signal<type>(_name,name,static_cast<void*>(component->sig)); \ 192 } 193 194 #define ALLOC0_SC_SIGNAL( sig, name, type) \ 195 sig = new sc_signal<type> (name); \ 170 196 PRINT_SIGNAL_ADDRESS(name,sig); 171 197 172 #define INSTANCE0_SC_SIGNAL(component, sig) 198 #define INSTANCE0_SC_SIGNAL(component, sig) \ 173 199 { \ 174 200 TEST_SIGNAL(component->sig->name(),component->sig); \ … … 177 203 } 178 204 179 #define _INSTANCE0_SC_SIGNAL(component, sig1,sig2) 205 #define _INSTANCE0_SC_SIGNAL(component, sig1,sig2) \ 180 206 { \ 181 207 TEST_SIGNAL(component->sig1->name(),component->sig1); \ … … 185 211 186 212 #define DELETE0_SC_SIGNAL( sig) \ 187 { \ 188 delete sig; \ 213 { \ 214 PRINT_SIGNAL_ADDRESS("",sig); \ 215 delete sig; \ 189 216 } 190 217 … … 326 353 } 327 354 355 #define ALLOC1_FOREIGN_SIGNAL_IN(sig, interface, name, type, size,x1) \ 356 { \ 357 sig = new SC_IN (type) * [x1]; \ 358 for (uint32_t it1=0; it1<x1; it1++) \ 359 if (size > 0) \ 360 { \ 361 std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ 362 sig [it1] = new SC_IN (type) (str.c_str()); \ 363 } \ 364 } 365 366 #define ALLOC1_FOREIGN_SIGNAL_OUT(sig, interface, name, type, size,x1) \ 367 { \ 368 sig = new SC_OUT (type) * [x1]; \ 369 for (uint32_t it1=0; it1<x1; it1++) \ 370 if (size > 0) \ 371 { \ 372 std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(name)); \ 373 sig [it1] = new SC_OUT (type) (str.c_str()); \ 374 } \ 375 } 376 377 #define DELETE1_FOREIGN_SIGNAL( sig, size,x1) \ 378 { \ 379 DELETE1_SIGNAL(sig,x1,size); \ 380 } 381 328 382 #define ALLOC1_SC_SIGNAL( sig, name, type, x1) \ 329 s c_signal<type> ** sig = new sc_signal<type> * [x1];\383 sig = new sc_signal<type> * [x1]; \ 330 384 { \ 331 385 std::string separator="_"; \ … … 359 413 for (uint32_t it1=0; it1<x1; it1++) \ 360 414 { \ 415 PRINT_SIGNAL_ADDRESS("",sig[it1]); \ 361 416 delete sig[it1]; \ 362 417 } \ … … 530 585 } 531 586 587 588 #define ALLOC2_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2) \ 589 { \ 590 sig = new SC_IN (type) ** [x1]; \ 591 for (uint32_t it1=0; it1<x1; it1++) \ 592 { \ 593 sig [it1] = new SC_IN (type) * [x2]; \ 594 for (uint32_t it2=0; it2<x2; it2++) \ 595 if (size > 0) \ 596 { \ 597 std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ 598 sig [it1][it2] = new SC_IN (type) (str.c_str()); \ 599 } \ 600 } \ 601 } 602 603 #define ALLOC2_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2) \ 604 { \ 605 sig = new SC_OUT (type) ** [x1]; \ 606 for (uint32_t it1=0; it1<x1; it1++) \ 607 { \ 608 sig [it1] = new SC_OUT (type) * [x2]; \ 609 for (uint32_t it2=0; it2<x2; it2++) \ 610 if (size > 0) \ 611 { \ 612 std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(name)); \ 613 sig [it1][it2] = new SC_IN (type) (str.c_str()); \ 614 } \ 615 } \ 616 } 617 618 #define DELETE2_FOREIGN_SIGNAL( sig, size,x1,x2) \ 619 { \ 620 DELETE2_SIGNAL(sig,x1,x2,size); \ 621 } 622 532 623 #define ALLOC2_SC_SIGNAL( sig, name, type, x1, x2) \ 533 s c_signal<type> *** sig = new sc_signal<type> ** [x1];\624 sig = new sc_signal<type> ** [x1]; \ 534 625 { \ 535 626 std::string separator="_"; \ … … 571 662 for (uint32_t it2=0; it2<x2; it2++) \ 572 663 { \ 664 PRINT_SIGNAL_ADDRESS("",sig[it1][it2]); \ 573 665 delete sig[it1][it2]; \ 574 666 } \ … … 758 850 } 759 851 852 #define ALLOC3_FOREIGN_SIGNAL_IN( sig, interface, name, type, size, x1, x2,x3) \ 853 { \ 854 sig = new SC_IN (type) *** [x1]; \ 855 for (uint32_t it1=0; it1<x1; it1++) \ 856 { \ 857 sig [it1] = new SC_IN (type) ** [x2]; \ 858 for (uint32_t it2=0; it2<x2; it2++) \ 859 { \ 860 sig [it1][it2] = new SC_IN (type) * [x3]; \ 861 for (uint32_t it3=0; it3<x3; it3++) \ 862 if (size > 0) \ 863 { \ 864 std::string str = (toString("in")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ 865 sig [it1][it2][it3] = new SC_IN (type) (str.c_str()); \ 866 } \ 867 } \ 868 } \ 869 } 870 871 #define ALLOC3_FOREIGN_SIGNAL_OUT( sig, interface, name, type, size, x1, x2,x3) \ 872 { \ 873 sig = new SC_OUT (type) *** [x1]; \ 874 for (uint32_t it1=0; it1<x1; it1++) \ 875 { \ 876 sig [it1] = new SC_OUT (type) ** [x2]; \ 877 for (uint32_t it2=0; it2<x2; it2++) \ 878 { \ 879 sig [it1][it2] = new SC_OUT (type) * [x3]; \ 880 for (uint32_t it3=0; it3<x3; it3++) \ 881 if (size > 0) \ 882 { \ 883 std::string str = (toString("out")+"_"+((interface!="")?(toString(interface)+"_"):toString(""))+toString(it1)+"_"+toString(it2)+"_"+toString(it3)+"_"+toString(name)); \ 884 sig [it1][it2][it3] = new SC_OUT(type) (str.c_str()); \ 885 } \ 886 } \ 887 } \ 888 } 889 890 #define DELETE3_FOREIGN_SIGNAL( sig, size,x1,x2,x3) \ 891 { \ 892 DELETE3_SIGNAL(sig,x1,x2,x3,size); \ 893 } 894 760 895 #define ALLOC3_SC_SIGNAL( sig, name, type, x1, x2, x3) \ 761 s c_signal<type> **** sig = new sc_signal<type> *** [x1];\896 sig = new sc_signal<type> *** [x1]; \ 762 897 { \ 763 898 std::string separator="_"; \ … … 807 942 for (uint32_t it3=0; it3<x3; it3++) \ 808 943 { \ 944 PRINT_SIGNAL_ADDRESS("",sig[it1][it2][it3]); \ 809 945 delete sig[it1][it2][it3]; \ 810 946 } \
Note: See TracChangeset
for help on using the changeset viewer.