[2] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
[48] | 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue/include/Two_Level_Branch_Predictor_Glue.h" |
---|
[2] | 9 | |
---|
| 10 | namespace morpheo { |
---|
| 11 | namespace behavioural { |
---|
[48] | 12 | namespace core { |
---|
| 13 | namespace multi_front_end { |
---|
| 14 | namespace front_end { |
---|
| 15 | namespace prediction_unit { |
---|
| 16 | namespace direction { |
---|
| 17 | |
---|
[2] | 18 | namespace meta_predictor { |
---|
| 19 | namespace two_level_branch_predictor { |
---|
| 20 | namespace two_level_branch_predictor_glue { |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | #ifdef SYSTEMC |
---|
| 24 | Two_Level_Branch_Predictor_Glue::Two_Level_Branch_Predictor_Glue (sc_module_name name, |
---|
| 25 | #else |
---|
| 26 | Two_Level_Branch_Predictor_Glue::Two_Level_Branch_Predictor_Glue (string name, |
---|
| 27 | #endif |
---|
| 28 | #ifdef STATISTICS |
---|
| 29 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
| 30 | #endif |
---|
[48] | 31 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Parameters param ): |
---|
[2] | 32 | _name (name) |
---|
| 33 | ,_param (param) |
---|
| 34 | // #ifdef STATISTICS |
---|
| 35 | // ,_param_statistics (param_statistics) |
---|
| 36 | // #endif |
---|
| 37 | { |
---|
| 38 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"Two_Level_Branch_Predictor_Glue","Begin"); |
---|
| 39 | |
---|
[42] | 40 | allocation (); |
---|
| 41 | |
---|
[2] | 42 | #ifdef STATISTICS |
---|
| 43 | // Allocation of statistics |
---|
| 44 | _stat = new Statistics (static_cast<string>(_name), |
---|
| 45 | param_statistics , |
---|
| 46 | param); |
---|
| 47 | #endif |
---|
| 48 | |
---|
| 49 | #ifdef VHDL |
---|
| 50 | // generate the vhdl |
---|
| 51 | vhdl(); |
---|
| 52 | #endif |
---|
| 53 | |
---|
| 54 | #ifdef SYSTEMC |
---|
| 55 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 56 | SC_METHOD (transition); |
---|
| 57 | dont_initialize (); |
---|
| 58 | sensitive_pos << *(in_CLOCK); |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | SC_METHOD (genMealy_predict_ack); |
---|
| 62 | dont_initialize (); |
---|
| 63 | sensitive_neg << *(in_CLOCK); |
---|
| 64 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 65 | { |
---|
| 66 | if (_param._have_bht) |
---|
| 67 | sensitive << (*(in_PREDICT_BHT_ACK [i])); |
---|
| 68 | if (_param._have_pht) |
---|
| 69 | sensitive << (*(in_PREDICT_PHT_ACK [i])); |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 73 | // List dependency information |
---|
| 74 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 75 | { |
---|
| 76 | if (_param._have_bht) |
---|
| 77 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_BHT_ACK [i])); |
---|
| 78 | if (_param._have_pht) |
---|
| 79 | (*(out_PREDICT_ACK [i])) (*(in_PREDICT_PHT_ACK [i])); |
---|
| 80 | } |
---|
| 81 | #endif |
---|
| 82 | |
---|
| 83 | if (_param._have_bht) |
---|
| 84 | { |
---|
| 85 | SC_METHOD (genMealy_predict_bht_address); |
---|
| 86 | dont_initialize (); |
---|
| 87 | sensitive_neg << *(in_CLOCK); |
---|
| 88 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 89 | sensitive << (*(in_PREDICT_ADDRESS [i])); |
---|
| 90 | |
---|
| 91 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 92 | // List dependency information |
---|
| 93 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 94 | (*(out_PREDICT_BHT_ADDRESS [i])) (*(in_PREDICT_ADDRESS [i])); |
---|
| 95 | #endif |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | if (_param._have_pht) |
---|
| 99 | { |
---|
| 100 | SC_METHOD (genMealy_predict_pht_address); |
---|
| 101 | dont_initialize (); |
---|
| 102 | sensitive_neg << *(in_CLOCK); |
---|
| 103 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 104 | { |
---|
| 105 | if (_param._have_bht) |
---|
| 106 | sensitive << (*(in_PREDICT_BHT_HISTORY [i])); |
---|
| 107 | sensitive << (*(in_PREDICT_ADDRESS [i])); |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 111 | // List dependency information |
---|
| 112 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 113 | { |
---|
| 114 | (*(out_PREDICT_PHT_ADDRESS [i])) (*(in_PREDICT_ADDRESS [i])); |
---|
| 115 | if (_param._have_bht) |
---|
| 116 | (*(out_PREDICT_PHT_ADDRESS [i])) (*(in_PREDICT_BHT_HISTORY [i])); |
---|
| 117 | } |
---|
| 118 | #endif |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | SC_METHOD (genMealy_branch_complete_ack); |
---|
| 122 | dont_initialize (); |
---|
| 123 | sensitive_neg << *(in_CLOCK); |
---|
| 124 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 125 | { |
---|
| 126 | if (_param._have_bht) |
---|
| 127 | sensitive << (*(in_BRANCH_COMPLETE_BHT_ACK [i])); |
---|
| 128 | if (_param._have_pht) |
---|
| 129 | sensitive << (*(in_BRANCH_COMPLETE_PHT_ACK [i])); |
---|
| 130 | } |
---|
| 131 | |
---|
| 132 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 133 | // List dependency information |
---|
| 134 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 135 | { |
---|
| 136 | if (_param._have_bht) |
---|
| 137 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_BHT_ACK [i])); |
---|
| 138 | if (_param._have_pht) |
---|
| 139 | (*(out_BRANCH_COMPLETE_ACK [i])) (*(in_BRANCH_COMPLETE_PHT_ACK [i])); |
---|
| 140 | } |
---|
| 141 | #endif |
---|
| 142 | |
---|
| 143 | if (_param._have_bht) |
---|
| 144 | { |
---|
| 145 | SC_METHOD (genMealy_branch_complete_bht_address); |
---|
| 146 | dont_initialize (); |
---|
| 147 | sensitive_neg << *(in_CLOCK); |
---|
| 148 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 149 | sensitive << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 150 | |
---|
| 151 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 152 | // List dependency information |
---|
| 153 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 154 | (*(out_BRANCH_COMPLETE_BHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 155 | #endif |
---|
| 156 | } |
---|
| 157 | |
---|
| 158 | if (_param._have_pht) |
---|
| 159 | { |
---|
| 160 | SC_METHOD (genMealy_branch_complete_pht_address); |
---|
| 161 | dont_initialize (); |
---|
| 162 | sensitive_neg << *(in_CLOCK); |
---|
| 163 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 164 | { |
---|
| 165 | if (_param._have_bht) |
---|
| 166 | sensitive << (*(in_BRANCH_COMPLETE_BHT_HISTORY [i])); |
---|
| 167 | sensitive << (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 168 | } |
---|
| 169 | |
---|
| 170 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 171 | // List dependency information |
---|
| 172 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 173 | { |
---|
| 174 | (*(out_BRANCH_COMPLETE_PHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 175 | if (_param._have_bht) |
---|
| 176 | (*(out_BRANCH_COMPLETE_PHT_ADDRESS [i])) (*(in_BRANCH_COMPLETE_BHT_HISTORY [i])); |
---|
| 177 | } |
---|
| 178 | #endif |
---|
| 179 | } |
---|
| 180 | |
---|
| 181 | #endif |
---|
| 182 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"Two_Level_Branch_Predictor_Glue","End"); |
---|
| 183 | }; |
---|
| 184 | |
---|
| 185 | Two_Level_Branch_Predictor_Glue::~Two_Level_Branch_Predictor_Glue (void) |
---|
| 186 | { |
---|
| 187 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"~Two_Level_Branch_Predictor_Glue","Begin"); |
---|
| 188 | |
---|
| 189 | #ifdef STATISTICS |
---|
| 190 | _stat->generate_file(statistics(0)); |
---|
| 191 | |
---|
| 192 | delete _stat; |
---|
| 193 | #endif |
---|
| 194 | |
---|
| 195 | #ifdef SYSTEMC |
---|
| 196 | deallocation (); |
---|
| 197 | #endif |
---|
| 198 | |
---|
| 199 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"~Two_Level_Branch_Predictor_Glue","End"); |
---|
| 200 | }; |
---|
| 201 | |
---|
| 202 | }; // end namespace two_level_branch_predictor_glue |
---|
| 203 | }; // end namespace two_level_branch_predictor |
---|
| 204 | }; // end namespace meta_predictor |
---|
| 205 | |
---|
[48] | 206 | }; // end namespace core |
---|
| 207 | }; // end namespace multi_front_end |
---|
| 208 | }; // end namespace front_end |
---|
| 209 | }; // end namespace prediction_unit |
---|
| 210 | }; // end namespace direction |
---|
| 211 | |
---|
| 212 | |
---|
[2] | 213 | }; // end namespace behavioural |
---|
| 214 | }; // end namespace morpheo |
---|