[78] | 1 | /* |
---|
| 2 | * $Id: Update_Prediction_Table.cpp 88 2008-12-10 18:31:39Z 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 | |
---|
[88] | 42 | #if DEBUG_Update_Prediction_Table == true |
---|
| 43 | log_printf(INFO,Update_Prediction_Table,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
| 44 | |
---|
| 45 | std::cout << *param << std::endl; |
---|
| 46 | #endif |
---|
| 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 | { |
---|
[81] | 78 | |
---|
| 79 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
| 80 | { |
---|
| 81 | internal_BRANCH_COMPLETE_ACK [i] = 1; |
---|
| 82 | PORT_WRITE(out_BRANCH_COMPLETE_ACK [i], internal_BRANCH_COMPLETE_ACK [i]); |
---|
| 83 | } |
---|
| 84 | |
---|
[78] | 85 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - transition"); |
---|
| 86 | |
---|
| 87 | SC_METHOD (transition); |
---|
| 88 | dont_initialize (); |
---|
| 89 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 90 | |
---|
| 91 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 92 | // List dependency information |
---|
| 93 | # endif |
---|
[81] | 94 | |
---|
| 95 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMoore"); |
---|
| 96 | |
---|
| 97 | SC_METHOD (genMoore); |
---|
| 98 | dont_initialize (); |
---|
[88] | 99 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
[78] | 100 | |
---|
[81] | 101 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 102 | // List dependency information |
---|
| 103 | # endif |
---|
| 104 | |
---|
| 105 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_predict"); |
---|
| 106 | |
---|
| 107 | SC_METHOD (genMealy_predict); |
---|
| 108 | dont_initialize (); |
---|
| 109 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
| 110 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 111 | { |
---|
| 112 | if (_param->_have_port_context_id) |
---|
| 113 | sensitive << (*(in_PREDICT_CONTEXT_ID [i])); |
---|
[88] | 114 | // sensitive << (*(in_PREDICT_BTB_IS_ACCURATE [i])); |
---|
[81] | 115 | } |
---|
| 116 | |
---|
| 117 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 118 | // List dependency information |
---|
| 119 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 120 | { |
---|
| 121 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_BTB_IS_ACCURATE [i])); |
---|
| 122 | if (_param->_have_port_context_id) |
---|
| 123 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_CONTEXT_ID [i])); |
---|
| 124 | } |
---|
| 125 | # endif |
---|
| 126 | |
---|
| 127 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_decod"); |
---|
| 128 | |
---|
| 129 | SC_METHOD (genMealy_decod); |
---|
| 130 | dont_initialize (); |
---|
| 131 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
| 132 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 133 | { |
---|
| 134 | if (_param->_have_port_context_id) |
---|
| 135 | sensitive << (*(in_DECOD_CONTEXT_ID [i])); |
---|
| 136 | } |
---|
| 137 | |
---|
| 138 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 139 | // List dependency information |
---|
| 140 | for (uint32_t i=0; i<_param->_nb_inst_decod; i++) |
---|
| 141 | { |
---|
| 142 | if (_param->_have_port_context_id) |
---|
[82] | 143 | (*(out_DECOD_ACK [i])) (*(in_DECOD_CONTEXT_ID [i])); |
---|
[81] | 144 | } |
---|
| 145 | # endif |
---|
| 146 | |
---|
| 147 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Method - genMealy_branch_complete"); |
---|
| 148 | |
---|
| 149 | SC_METHOD (genMealy_branch_complete); |
---|
| 150 | dont_initialize (); |
---|
| 151 | sensitive << (*(in_CLOCK)).neg(); // use internal register |
---|
| 152 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
| 153 | { |
---|
| 154 | if (_param->_have_port_context_id) |
---|
| 155 | sensitive << (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
[88] | 156 | if (_param->_have_port_depth) |
---|
[81] | 157 | sensitive << (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 158 | sensitive << (*(in_BRANCH_COMPLETE_FLAG [i])) |
---|
| 159 | << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 160 | } |
---|
| 161 | |
---|
| 162 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 163 | // List dependency information |
---|
| 164 | for (uint32_t i=0; i<_param->_nb_inst_branch_complete; i++) |
---|
| 165 | { |
---|
| 166 | if (_param->_have_port_context_id) |
---|
| 167 | (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
[88] | 168 | if (_param->_have_port_depth) |
---|
[81] | 169 | (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 170 | (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_FLAG [i])); |
---|
| 171 | (*(out_BRANCH_COMPLETE_MISS_PREDICTION [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 172 | |
---|
| 173 | if (_param->_have_port_context_id) |
---|
| 174 | (*(out_BRANCH_COMPLETE_TAKE [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
[88] | 175 | if (_param->_have_port_depth) |
---|
[81] | 176 | (*(out_BRANCH_COMPLETE_TAKE [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 177 | (*(out_BRANCH_COMPLETE_TAKE [i])) (*(in_BRANCH_COMPLETE_FLAG [i])); |
---|
| 178 | |
---|
| 179 | if (_param->_have_port_context_id) |
---|
| 180 | (*(out_BRANCH_COMPLETE_ADDRESS_SRC [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
[88] | 181 | if (_param->_have_port_depth) |
---|
[81] | 182 | (*(out_BRANCH_COMPLETE_ADDRESS_SRC [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 183 | |
---|
| 184 | if (_param->_have_port_context_id) |
---|
| 185 | (*(out_BRANCH_COMPLETE_ADDRESS_DEST [i])) (*(in_BRANCH_COMPLETE_CONTEXT_ID [i])); |
---|
[88] | 186 | if (_param->_have_port_depth) |
---|
[81] | 187 | (*(out_BRANCH_COMPLETE_ADDRESS_DEST [i])) (*(in_BRANCH_COMPLETE_DEPTH [i])); |
---|
| 188 | (*(out_BRANCH_COMPLETE_ADDRESS_DEST [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 189 | } |
---|
| 190 | # endif |
---|
| 191 | |
---|
[78] | 192 | #endif |
---|
| 193 | } |
---|
| 194 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 195 | }; |
---|
| 196 | |
---|
| 197 | #undef FUNCTION |
---|
| 198 | #define FUNCTION "Update_Prediction_Table::~Update_Prediction_Table" |
---|
| 199 | Update_Prediction_Table::~Update_Prediction_Table (void) |
---|
| 200 | { |
---|
| 201 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
| 202 | |
---|
| 203 | #ifdef STATISTICS |
---|
[88] | 204 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[78] | 205 | { |
---|
| 206 | statistics_deallocation(); |
---|
| 207 | } |
---|
| 208 | #endif |
---|
| 209 | |
---|
| 210 | log_printf(INFO,Update_Prediction_Table,FUNCTION,"Deallocation"); |
---|
| 211 | deallocation (); |
---|
| 212 | |
---|
| 213 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
| 214 | }; |
---|
| 215 | |
---|
| 216 | }; // end namespace update_prediction_table |
---|
| 217 | }; // end namespace prediction_unit |
---|
| 218 | }; // end namespace front_end |
---|
| 219 | }; // end namespace multi_front_end |
---|
| 220 | }; // end namespace core |
---|
| 221 | |
---|
| 222 | }; // end namespace behavioural |
---|
| 223 | }; // end namespace morpheo |
---|