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