[88] | 1 | /* |
---|
| 2 | * $Id: Core.cpp 146 2011-02-01 20:57:54Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/include/Core.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace core { |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | #undef FUNCTION |
---|
| 16 | #define FUNCTION "Core::Core" |
---|
| 17 | Core::Core |
---|
| 18 | ( |
---|
| 19 | #ifdef SYSTEMC |
---|
| 20 | sc_module_name name, |
---|
| 21 | #else |
---|
| 22 | string name, |
---|
| 23 | #endif |
---|
| 24 | #ifdef STATISTICS |
---|
| 25 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 26 | #endif |
---|
[145] | 27 | Parameters * param, |
---|
| 28 | morpheo::behavioural::Tusage_t usage// , |
---|
| 29 | // morpheo::behavioural::Function_pointer * function_pointer |
---|
[88] | 30 | ): |
---|
| 31 | _name (name) |
---|
| 32 | ,_param (param) |
---|
| 33 | ,_usage (usage) |
---|
| 34 | { |
---|
| 35 | log_begin(Core,FUNCTION); |
---|
| 36 | |
---|
| 37 | usage_environment(_usage); |
---|
| 38 | |
---|
[123] | 39 | // #if DEBUG_Core == true |
---|
| 40 | // log_printf(INFO,Core,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 41 | |
---|
[123] | 42 | // std::cout << *param << std::endl; |
---|
| 43 | // #endif |
---|
[88] | 44 | |
---|
| 45 | log_printf(INFO,Core,FUNCTION,_("<%s> Allocation"),_name.c_str()); |
---|
| 46 | |
---|
| 47 | allocation ( |
---|
| 48 | #ifdef STATISTICS |
---|
| 49 | param_statistics |
---|
| 50 | #endif |
---|
[145] | 51 | // function_pointer |
---|
[88] | 52 | ); |
---|
| 53 | |
---|
| 54 | #ifdef STATISTICS |
---|
| 55 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 56 | { |
---|
| 57 | log_printf(INFO,Core,FUNCTION,_("<%s> Allocation of statistics"),_name.c_str()); |
---|
| 58 | |
---|
| 59 | statistics_allocation(param_statistics); |
---|
| 60 | } |
---|
| 61 | #endif |
---|
| 62 | |
---|
| 63 | #ifdef VHDL |
---|
| 64 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 65 | { |
---|
| 66 | // generate the vhdl |
---|
| 67 | log_printf(INFO,Core,FUNCTION,_("<%s> Generate the vhdl"),_name.c_str()); |
---|
| 68 | |
---|
| 69 | vhdl(); |
---|
| 70 | } |
---|
| 71 | #endif |
---|
| 72 | |
---|
| 73 | #ifdef SYSTEMC |
---|
[146] | 74 | # if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
[88] | 75 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 76 | { |
---|
[145] | 77 | |
---|
| 78 | // if (function_pointer==NULL) |
---|
| 79 | // { |
---|
[88] | 80 | log_printf(INFO,Core,FUNCTION,_("<%s> Method - transition"),_name.c_str()); |
---|
| 81 | |
---|
| 82 | SC_METHOD (transition); |
---|
| 83 | dont_initialize (); |
---|
| 84 | sensitive << (*(in_CLOCK)).pos(); |
---|
[145] | 85 | |
---|
[88] | 86 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 87 | // List dependency information |
---|
| 88 | # endif |
---|
[145] | 89 | // } |
---|
| 90 | // else |
---|
| 91 | // { |
---|
| 92 | // function_pointer->transition_add(static_cast<f_t>(&morpheo::behavioural::core::Core::transition)); |
---|
| 93 | // } |
---|
| 94 | |
---|
[88] | 95 | } |
---|
[146] | 96 | # endif |
---|
[88] | 97 | #endif |
---|
| 98 | log_end(Core,FUNCTION); |
---|
| 99 | }; |
---|
| 100 | |
---|
| 101 | #undef FUNCTION |
---|
| 102 | #define FUNCTION "Core::~Core" |
---|
| 103 | Core::~Core (void) |
---|
| 104 | { |
---|
| 105 | log_begin(Core,FUNCTION); |
---|
| 106 | |
---|
| 107 | #ifdef STATISTICS |
---|
| 108 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 109 | { |
---|
| 110 | statistics_deallocation(); |
---|
| 111 | } |
---|
| 112 | #endif |
---|
| 113 | |
---|
| 114 | log_printf(INFO,Core,FUNCTION,_("<%s> Deallocation"),_name.c_str()); |
---|
| 115 | deallocation (); |
---|
| 116 | |
---|
| 117 | log_end(Core,FUNCTION); |
---|
| 118 | }; |
---|
| 119 | |
---|
| 120 | }; // end namespace core |
---|
| 121 | }; // end namespace behavioural |
---|
| 122 | }; // end namespace morpheo |
---|