[78] | 1 | /* |
---|
| 2 | * $Id: Update_Prediction_Table.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h" |
---|
| 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
| 12 | namespace core { |
---|
| 13 | namespace multi_front_end { |
---|
| 14 | namespace front_end { |
---|
| 15 | namespace prediction_unit { |
---|
| 16 | namespace update_prediction_table { |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Update_Prediction_Table::Update_Prediction_Table" |
---|
| 21 | Update_Prediction_Table::Update_Prediction_Table |
---|
| 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::prediction_unit::update_prediction_table::Parameters * param, |
---|
| 32 | morpheo::behavioural::Tusage_t usage |
---|
| 33 | ): |
---|
| 34 | _name (name) |
---|
| 35 | ,_param (param) |
---|
| 36 | ,_usage (usage) |
---|
| 37 | { |
---|
| 38 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 39 | |
---|
[81] | 40 | usage_environment(_usage); |
---|
| 41 | |
---|
[123] | 42 | // #if DEBUG_Update_Prediction_Table == true |
---|
| 43 | // log_printf(INFO,Update_Prediction_Table,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 44 | |
---|
[123] | 45 | // std::cout << *param << std::endl; |
---|
| 46 | // #endif |
---|
[88] | 47 | |
---|
[78] | 48 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Allocation"); |
---|
| 49 | |
---|
| 50 | allocation ( |
---|
| 51 | #ifdef STATISTICS |
---|
| 52 | param_statistics |
---|
| 53 | #endif |
---|
| 54 | ); |
---|
| 55 | |
---|
| 56 | #ifdef STATISTICS |
---|
[88] | 57 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[78] | 58 | { |
---|
| 59 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Allocation of statistics"); |
---|
| 60 | |
---|
| 61 | statistics_allocation(param_statistics); |
---|
| 62 | } |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | #ifdef VHDL |
---|
[88] | 66 | if (usage_is_set(_usage,USE_VHDL)) |
---|
[78] | 67 | { |
---|
| 68 | // generate the vhdl |
---|
| 69 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Generate the vhdl"); |
---|
| 70 | |
---|
| 71 | vhdl(); |
---|
| 72 | } |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | #ifdef SYSTEMC |
---|
[88] | 76 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
[78] | 77 | { |
---|
[131] | 78 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 79 | constant(); |
---|
| 80 | #else |
---|
| 81 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - constant"); |
---|
[81] | 82 | |
---|
[131] | 83 | SC_METHOD (constant); |
---|
| 84 | // dont_initialize (); |
---|
| 85 | |
---|
| 86 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 87 | // List dependency information |
---|
| 88 | # endif |
---|
| 89 | #endif |
---|
[78] | 90 | log_printf(INFO,Update_Prediction_Table,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 |
---|
[81] | 99 | |
---|
| 100 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMoore"); |
---|
| 101 | |
---|
| 102 | SC_METHOD (genMoore); |
---|
| 103 | dont_initialize (); |
---|
[88] | 104 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
[78] | 105 | |
---|
[81] | 106 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 107 | // List dependency information |
---|
| 108 | # endif |
---|
| 109 | |
---|
| 110 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_predict"); |
---|
| 111 | |
---|
| 112 | SC_METHOD (genMealy_predict); |
---|
| 113 | dont_initialize (); |
---|
[132] | 114 | sensitive << (*(in_CLOCK)).neg() // use internal register |
---|
| 115 | << (*(in_NRESET)); |
---|
[81] | 116 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 117 | { |
---|
| 118 | if (_param->_have_port_context_id) |
---|
| 119 | sensitive << (*(in_PREDICT_CONTEXT_ID [i])); |
---|
[88] | 120 | // sensitive << (*(in_PREDICT_BTB_IS_ACCURATE [i])); |
---|
[81] | 121 | } |
---|
| 122 | |
---|
| 123 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 124 | // List dependency information |
---|
| 125 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 126 | { |
---|
| 127 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_BTB_IS_ACCURATE [i])); |
---|
| 128 | if (_param->_have_port_context_id) |
---|
| 129 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_CONTEXT_ID [i])); |
---|
| 130 | } |
---|
| 131 | # endif |
---|
| 132 | |
---|
| 133 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_decod"); |
---|
| 134 | |
---|
| 135 | SC_METHOD (genMealy_decod); |
---|
| 136 | dont_initialize (); |
---|
[132] | 137 | sensitive << (*(in_CLOCK)).neg() // use internal register |
---|
| 138 | << (*(in_NRESET)); |
---|
[81] | 139 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 140 | { |
---|
| 141 | if (_param->_have_port_context_id) |
---|
| 142 | sensitive << (*(in_DECOD_CONTEXT_ID [i])); |
---|
| 143 | } |
---|
| 144 | |
---|
[124] | 145 | // # ifdef SYSTEMCASS_SPECIFIC |
---|
| 146 | // // List dependency information |
---|
| 147 | // for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 148 | // { |
---|
| 149 | // if (_param->_have_port_context_id) |
---|
| 150 | // (*(out_DECOD_ACK [i])) (*(in_DECOD_CONTEXT_ID [i])); |
---|
| 151 | // } |
---|
| 152 | // # endif |
---|
[81] | 153 | |
---|
| 154 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_branch_complete"); |
---|
| 155 | |
---|
| 156 | SC_METHOD (genMealy_branch_complete); |
---|
| 157 | dont_initialize (); |
---|
[132] | 158 | sensitive << (*(in_CLOCK)).neg() // use internal register |
---|
| 159 | << (*(in_NRESET)); |
---|
[81] | 160 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
| 161 | { |
---|
| 162 | if (_param->_have_port_context_id) |
---|
| 163 | sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
[88] | 164 | if (_param->_have_port_depth) |
---|
[81] | 165 | sensitive << (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
[132] | 166 | sensitive << (*(in_BRANCH_COMPLETE_VAL [i])) |
---|
| 167 | << (*(in_BRANCH_COMPLETE_NO_SEQUENCE [i])) |
---|
| 168 | << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
[81] | 169 | } |
---|
| 170 | |
---|
| 171 | # ifdef SYSTEMCASS_SPECIFIC |
---|
[111] | 172 | // // List dependency information |
---|
| 173 | // for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
| 174 | // { |
---|
| 175 | // if (_param->_have_port_context_id) |
---|
| 176 | // (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
| 177 | // if (_param->_have_port_depth) |
---|
| 178 | // (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 179 | // (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i])); |
---|
| 180 | // (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
[81] | 181 | |
---|
[111] | 182 | // // if (_param->_have_port_context_id) |
---|
| 183 | // // (*(out_BRANCH_COMPLETE_TAKE [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
| 184 | // // if (_param->_have_port_depth) |
---|
| 185 | // // (*(out_BRANCH_COMPLETE_TAKE [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 186 | // // (*(out_BRANCH_COMPLETE_TAKE [i])) (*(in_BRANCH_COMPLETE_NO_SEQUENCE[i])); |
---|
[81] | 187 | |
---|
[111] | 188 | // // if (_param->_have_port_context_id) |
---|
| 189 | // // (*(out_BRANCH_COMPLETE_ADDRESS_SRC [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
| 190 | // // if (_param->_have_port_depth) |
---|
| 191 | // // (*(out_BRANCH_COMPLETE_ADDRESS_SRC [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
[81] | 192 | |
---|
[111] | 193 | // // if (_param->_have_port_context_id) |
---|
| 194 | // // (*(out_BRANCH_COMPLETE_ADDRESS_DEST [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
| 195 | // // if (_param->_have_port_depth) |
---|
| 196 | // // (*(out_BRANCH_COMPLETE_ADDRESS_DEST [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 197 | // // (*(out_BRANCH_COMPLETE_ADDRESS_DEST [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 198 | // } |
---|
[81] | 199 | # endif |
---|
| 200 | |
---|
[78] | 201 | #endif |
---|
| 202 | } |
---|
| 203 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 204 | }; |
---|
| 205 | |
---|
| 206 | #undef FUNCTION |
---|
| 207 | #define FUNCTION "Update_Prediction_Table::~Update_Prediction_Table" |
---|
| 208 | Update_Prediction_Table::~Update_Prediction_Table (void) |
---|
| 209 | { |
---|
| 210 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 211 | |
---|
| 212 | #ifdef STATISTICS |
---|
[88] | 213 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[78] | 214 | { |
---|
| 215 | statistics_deallocation(); |
---|
| 216 | } |
---|
| 217 | #endif |
---|
| 218 | |
---|
| 219 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Deallocation"); |
---|
| 220 | deallocation (); |
---|
| 221 | |
---|
| 222 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 223 | }; |
---|
| 224 | |
---|
| 225 | }; // end namespace update_prediction_table |
---|
| 226 | }; // end namespace prediction_unit |
---|
| 227 | }; // end namespace front_end |
---|
| 228 | }; // end namespace multi_front_end |
---|
| 229 | }; // end namespace core |
---|
| 230 | |
---|
| 231 | }; // end namespace behavioural |
---|
| 232 | }; // end namespace morpheo |
---|