[83] | 1 | /* |
---|
| 2 | * $Id: Context_State.cpp 88 2008-12-10 18:31:39Z 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 | |
---|
[88] | 41 | #if DEBUG_Context_State == true |
---|
| 42 | log_printf(INFO,Context_State,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
| 43 | |
---|
| 44 | std::cout << *param << std::endl; |
---|
| 45 | #endif |
---|
| 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 | { |
---|
[88] | 77 | // Constant |
---|
| 78 | for (uint32_t i=0; i<_param->_nb_context; i++) |
---|
| 79 | { |
---|
| 80 | internal_BRANCH_EVENT_ACK [i] = 1; |
---|
| 81 | PORT_WRITE(out_BRANCH_EVENT_ACK [i], internal_BRANCH_EVENT_ACK [i]); |
---|
| 82 | } |
---|
| 83 | |
---|
[83] | 84 | for (uint32_t i=0; i<_param->_nb_decod_unit; i++) |
---|
| 85 | { |
---|
| 86 | internal_DECOD_EVENT_ACK [i] = 1; |
---|
| 87 | PORT_WRITE(out_DECOD_EVENT_ACK [i], internal_DECOD_EVENT_ACK [i]); |
---|
| 88 | } |
---|
| 89 | |
---|
[88] | 90 | internal_COMMIT_EVENT_ACK = 1; |
---|
| 91 | PORT_WRITE(out_COMMIT_EVENT_ACK, internal_COMMIT_EVENT_ACK); |
---|
[83] | 92 | |
---|
| 93 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
| 94 | { |
---|
| 95 | internal_BRANCH_COMPLETE_ACK [i] = 1; |
---|
| 96 | PORT_WRITE(out_BRANCH_COMPLETE_ACK [i], internal_BRANCH_COMPLETE_ACK [i]); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | log_printf(INFO,Context_State,FUNCTION,_("Method - transition")); |
---|
| 100 | |
---|
| 101 | SC_METHOD (transition); |
---|
| 102 | dont_initialize (); |
---|
| 103 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 104 | |
---|
| 105 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 106 | // List dependency information |
---|
| 107 | # endif |
---|
| 108 | |
---|
| 109 | log_printf(INFO,Context_State,FUNCTION,_("Method - genMoore")); |
---|
| 110 | |
---|
| 111 | SC_METHOD (genMoore); |
---|
| 112 | dont_initialize (); |
---|
| 113 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
| 114 | |
---|
| 115 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 116 | // List dependency information |
---|
| 117 | # endif |
---|
| 118 | |
---|
| 119 | #endif |
---|
| 120 | } |
---|
| 121 | log_end(Context_State,FUNCTION); |
---|
| 122 | }; |
---|
| 123 | |
---|
| 124 | #undef FUNCTION |
---|
| 125 | #define FUNCTION "Context_State::~Context_State" |
---|
| 126 | Context_State::~Context_State (void) |
---|
| 127 | { |
---|
| 128 | log_begin(Context_State,FUNCTION); |
---|
| 129 | |
---|
| 130 | #ifdef STATISTICS |
---|
| 131 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 132 | { |
---|
| 133 | statistics_deallocation(); |
---|
| 134 | } |
---|
| 135 | #endif |
---|
| 136 | |
---|
| 137 | log_printf(INFO,Context_State,FUNCTION,_("Deallocation")); |
---|
| 138 | deallocation (); |
---|
| 139 | |
---|
| 140 | log_end(Context_State,FUNCTION); |
---|
| 141 | }; |
---|
| 142 | |
---|
| 143 | }; // end namespace context_state |
---|
| 144 | }; // end namespace front_end |
---|
| 145 | }; // end namespace multi_front_end |
---|
| 146 | }; // end namespace core |
---|
| 147 | |
---|
| 148 | }; // end namespace behavioural |
---|
| 149 | }; // end namespace morpheo |
---|