[83] | 1 | /* |
---|
| 2 | * $Id: Context_State.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Context_State/include/Context_State.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace core { |
---|
| 13 | namespace multi_front_end { |
---|
| 14 | namespace front_end { |
---|
| 15 | namespace context_state { |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | #undef FUNCTION |
---|
| 19 | #define FUNCTION "Context_State::Context_State" |
---|
| 20 | Context_State::Context_State |
---|
| 21 | ( |
---|
| 22 | #ifdef SYSTEMC |
---|
| 23 | sc_module_name name, |
---|
| 24 | #else |
---|
| 25 | string name, |
---|
| 26 | #endif |
---|
| 27 | #ifdef STATISTICS |
---|
| 28 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 29 | #endif |
---|
| 30 | morpheo::behavioural::core::multi_front_end::front_end::context_state::Parameters * param, |
---|
| 31 | morpheo::behavioural::Tusage_t usage |
---|
| 32 | ): |
---|
| 33 | _name (name) |
---|
| 34 | ,_param (param) |
---|
| 35 | ,_usage (usage) |
---|
| 36 | { |
---|
| 37 | log_begin(Context_State,FUNCTION); |
---|
| 38 | |
---|
| 39 | usage_environment(_usage); |
---|
| 40 | |
---|
[123] | 41 | // #if DEBUG_Context_State == true |
---|
| 42 | // log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 43 | |
---|
[123] | 44 | // std::cout << *param << std::endl; |
---|
| 45 | // #endif |
---|
[88] | 46 | |
---|
[83] | 47 | log_printf(INFO,Context_State,FUNCTION,_("Allocation")); |
---|
| 48 | |
---|
| 49 | allocation ( |
---|
| 50 | #ifdef STATISTICS |
---|
| 51 | param_statistics |
---|
| 52 | #endif |
---|
| 53 | ); |
---|
| 54 | |
---|
| 55 | #ifdef STATISTICS |
---|
| 56 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 57 | { |
---|
| 58 | log_printf(INFO,Context_State,FUNCTION,_("Allocation of statistics")); |
---|
| 59 | |
---|
| 60 | statistics_allocation(param_statistics); |
---|
| 61 | } |
---|
| 62 | #endif |
---|
| 63 | |
---|
| 64 | #ifdef VHDL |
---|
| 65 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 66 | { |
---|
| 67 | // generate the vhdl |
---|
| 68 | log_printf(INFO,Context_State,FUNCTION,_("Generate the vhdl")); |
---|
| 69 | |
---|
| 70 | vhdl(); |
---|
| 71 | } |
---|
| 72 | #endif |
---|
| 73 | |
---|
| 74 | #ifdef SYSTEMC |
---|
| 75 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 76 | { |
---|
[131] | 77 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 78 | constant(); |
---|
| 79 | #else |
---|
| 80 | log_printf(INFO,Context_State,FUNCTION,_("Method - constant")); |
---|
[88] | 81 | |
---|
[131] | 82 | SC_METHOD (constant); |
---|
| 83 | // dont_initialize (); |
---|
| 84 | |
---|
| 85 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 86 | // List dependency information |
---|
| 87 | # endif |
---|
| 88 | #endif |
---|
[83] | 89 | |
---|
| 90 | log_printf(INFO,Context_State,FUNCTION,_("Method - transition")); |
---|
| 91 | |
---|
| 92 | SC_METHOD (transition); |
---|
| 93 | dont_initialize (); |
---|
| 94 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 95 | |
---|
| 96 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 97 | // List dependency information |
---|
| 98 | # endif |
---|
| 99 | |
---|
| 100 | log_printf(INFO,Context_State,FUNCTION,_("Method - genMoore")); |
---|
| 101 | |
---|
| 102 | SC_METHOD (genMoore); |
---|
| 103 | dont_initialize (); |
---|
| 104 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
| 105 | |
---|
| 106 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 107 | // List dependency information |
---|
| 108 | # endif |
---|
[101] | 109 | |
---|
| 110 | log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_decod_event")); |
---|
| 111 | |
---|
| 112 | SC_METHOD (genMealy_decod_event); |
---|
| 113 | dont_initialize (); |
---|
[132] | 114 | sensitive << (*(in_CLOCK)).neg() // use internal register |
---|
| 115 | << (*(in_NRESET)); |
---|
| 116 | |
---|
[101] | 117 | for (uint32_t i=0; i<_param->_nb_decod_unit; ++i) |
---|
| 118 | { |
---|
| 119 | sensitive << (*(in_DECOD_EVENT_VAL [i])) // not necessary |
---|
| 120 | << (*(in_DECOD_EVENT_TYPE [i])); |
---|
| 121 | if (_param->_have_port_context_id) |
---|
| 122 | sensitive << (*(in_DECOD_EVENT_CONTEXT_ID [i])); |
---|
| 123 | } |
---|
| 124 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
| 125 | { |
---|
| 126 | sensitive << (*(in_NB_INST_DECOD_ALL [i])) |
---|
| 127 | << (*(in_NB_INST_COMMIT_ALL [i])) |
---|
| 128 | << (*(in_NB_INST_COMMIT_MEM [i])); |
---|
| 129 | } |
---|
[83] | 130 | |
---|
[101] | 131 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 132 | // List dependency information |
---|
| 133 | # endif |
---|
[123] | 134 | |
---|
| 135 | log_printf(INFO,Context_State,FUNCTION,_("Method - genMealy_context_event")); |
---|
| 136 | |
---|
| 137 | SC_METHOD (genMealy_context_event); |
---|
| 138 | dont_initialize (); |
---|
| 139 | // sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
[132] | 140 | sensitive << (*(in_NRESET)) |
---|
| 141 | << (*(in_COMMIT_EVENT_VAL )); |
---|
[123] | 142 | if (_param->_have_port_context_id) |
---|
| 143 | sensitive << (*(in_COMMIT_EVENT_CONTEXT_ID )); |
---|
| 144 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; ++i) |
---|
| 145 | { |
---|
| 146 | sensitive << (*(in_BRANCH_COMPLETE_VAL [i])) |
---|
| 147 | << (*(in_BRANCH_COMPLETE_MISS_PREDICTION [i])); |
---|
| 148 | if (_param->_have_port_context_id) |
---|
| 149 | sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
| 150 | } |
---|
[101] | 151 | |
---|
[123] | 152 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 153 | // List dependency information |
---|
| 154 | # endif |
---|
| 155 | |
---|
[83] | 156 | #endif |
---|
| 157 | } |
---|
| 158 | log_end(Context_State,FUNCTION); |
---|
| 159 | }; |
---|
| 160 | |
---|
| 161 | #undef FUNCTION |
---|
| 162 | #define FUNCTION "Context_State::~Context_State" |
---|
| 163 | Context_State::~Context_State (void) |
---|
| 164 | { |
---|
| 165 | log_begin(Context_State,FUNCTION); |
---|
| 166 | |
---|
| 167 | #ifdef STATISTICS |
---|
| 168 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 169 | { |
---|
| 170 | statistics_deallocation(); |
---|
| 171 | } |
---|
| 172 | #endif |
---|
| 173 | |
---|
| 174 | log_printf(INFO,Context_State,FUNCTION,_("Deallocation")); |
---|
| 175 | deallocation (); |
---|
| 176 | |
---|
| 177 | log_end(Context_State,FUNCTION); |
---|
| 178 | }; |
---|
| 179 | |
---|
| 180 | }; // end namespace context_state |
---|
| 181 | }; // end namespace front_end |
---|
| 182 | }; // end namespace multi_front_end |
---|
| 183 | }; // end namespace core |
---|
| 184 | |
---|
| 185 | }; // end namespace behavioural |
---|
| 186 | }; // end namespace morpheo |
---|