[110] | 1 | #ifndef morpheo_behavioural_core_multi_front_end_front_end_prediction_unit_direction_meta_predictor_two_level_branch_predictor_Two_Level_Branch_Predictor_h |
---|
| 2 | #define morpheo_behavioural_core_multi_front_end_front_end_prediction_unit_direction_meta_predictor_two_level_branch_predictor_Two_Level_Branch_Predictor_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Two_Level_Branch_Predictor.h 115 2009-04-20 21:29:17Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #ifdef SYSTEMC |
---|
| 12 | #include "systemc.h" |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h" |
---|
| 17 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Types.h" |
---|
| 18 | #ifdef STATISTICS |
---|
| 19 | #include "Behavioural/include/Stat.h" |
---|
| 20 | #endif |
---|
| 21 | #include "Behavioural/include/Component.h" |
---|
| 22 | #ifdef VHDL |
---|
| 23 | #include "Behavioural/include/Vhdl.h" |
---|
| 24 | #endif |
---|
| 25 | #include "Behavioural/include/Usage.h" |
---|
| 26 | |
---|
| 27 | #include "Common/include/ToString.h" |
---|
| 28 | #include "Common/include/Debug.h" |
---|
| 29 | |
---|
| 30 | #include <iostream> |
---|
| 31 | |
---|
| 32 | namespace morpheo { |
---|
| 33 | namespace behavioural { |
---|
| 34 | |
---|
| 35 | namespace core { |
---|
| 36 | namespace multi_front_end { |
---|
| 37 | namespace front_end { |
---|
| 38 | namespace prediction_unit { |
---|
| 39 | namespace direction { |
---|
| 40 | namespace meta_predictor { |
---|
| 41 | namespace two_level_branch_predictor { |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | class Two_Level_Branch_Predictor |
---|
| 45 | #if SYSTEMC |
---|
| 46 | : public sc_module |
---|
| 47 | #endif |
---|
| 48 | { |
---|
| 49 | // -----[ fields ]---------------------------------------------------- |
---|
| 50 | // Parameters |
---|
| 51 | protected : const std::string _name; |
---|
| 52 | protected : const Parameters * _param; |
---|
| 53 | private : const Tusage_t _usage; |
---|
| 54 | |
---|
| 55 | #ifdef STATISTICS |
---|
| 56 | public : Stat * _stat; |
---|
| 57 | #endif |
---|
| 58 | |
---|
| 59 | public : Component * _component; |
---|
| 60 | private : Interfaces * _interfaces; |
---|
| 61 | |
---|
| 62 | #ifdef SYSTEMC |
---|
| 63 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 64 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 65 | public : SC_CLOCK * in_CLOCK ; |
---|
| 66 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
| 67 | |
---|
[111] | 68 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 69 | public : SC_IN (Tcontrol_t) ** in_PREDICT_VAL ;//[nb_inst_predict] |
---|
| 70 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_ACK ;//[nb_inst_predict] |
---|
| 71 | public : SC_IN (Taddress_t) ** in_PREDICT_ADDRESS ;//[nb_inst_predict] |
---|
| 72 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_DIRECTION ;//[nb_inst_predict] // = MSB[history] |
---|
| 73 | public : SC_OUT(Thistory_t) ** out_PREDICT_HISTORY ;//[nb_inst_predict] |
---|
| 74 | public : SC_IN (Tcontrol_t) ** in_PREDICT_DIRECTION_VAL;//[nb_inst_predict] // if update_on_prediction |
---|
| 75 | public : SC_IN (Tcontrol_t) ** in_PREDICT_DIRECTION ;//[nb_inst_predict] // if update_on_prediction |
---|
| 76 | |
---|
| 77 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 78 | public : SC_IN (Tcontrol_t) ** in_UPDATE_VAL ;//[nb_inst_update] |
---|
| 79 | public : SC_OUT(Tcontrol_t) ** out_UPDATE_ACK ;//[nb_inst_update] |
---|
| 80 | public : SC_IN (Taddress_t) ** in_UPDATE_ADDRESS ;//[nb_inst_update] |
---|
| 81 | public : SC_IN (Thistory_t) ** in_UPDATE_HISTORY ;//[nb_inst_update] |
---|
[112] | 82 | public : SC_IN (Tcontrol_t) ** in_UPDATE_HISTORY_VAL ;//[nb_inst_update] |
---|
[111] | 83 | public : SC_IN (Tcontrol_t) ** in_UPDATE_DIRECTION ;//[nb_inst_update] |
---|
| 84 | public : SC_IN (Tcontrol_t) ** in_UPDATE_MISS ;//[nb_inst_update] // if update_on_prediction |
---|
| 85 | |
---|
[110] | 86 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[111] | 87 | |
---|
[110] | 88 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[111] | 89 | private : Thistory_t * reg_BHT ;//[bht_nb_shifter] |
---|
[115] | 90 | private : Thistory_t ** reg_PHT ;//[pht_nb_bank][pht_size_bank] |
---|
[110] | 91 | |
---|
| 92 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[111] | 93 | private : Tcontrol_t * internal_PREDICT_ACK ;//[nb_inst_predict] |
---|
| 94 | private : Thistory_t * internal_PREDICT_BHT_NUM_REG ;//[nb_inst_predict] // if update_on_prediction |
---|
| 95 | private : Thistory_t * internal_PREDICT_PHT_NUM_BANK ;//[nb_inst_predict] // if update_on_prediction |
---|
| 96 | private : Thistory_t * internal_PREDICT_PHT_NUM_REG ;//[nb_inst_predict] // if update_on_prediction |
---|
| 97 | |
---|
| 98 | private : Tcontrol_t * internal_UPDATE_ACK ;//[nb_inst_update] |
---|
[110] | 99 | #endif |
---|
| 100 | |
---|
| 101 | // -----[ Methods ]--------------------------------------------------- |
---|
| 102 | |
---|
| 103 | #ifdef SYSTEMC |
---|
| 104 | SC_HAS_PROCESS (Two_Level_Branch_Predictor); |
---|
| 105 | #endif |
---|
| 106 | public : Two_Level_Branch_Predictor |
---|
| 107 | ( |
---|
| 108 | #ifdef SYSTEMC |
---|
| 109 | sc_module_name name, |
---|
| 110 | #else |
---|
| 111 | std::string name, |
---|
| 112 | #endif |
---|
| 113 | #ifdef STATISTICS |
---|
| 114 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 115 | #endif |
---|
| 116 | Parameters * param, |
---|
| 117 | morpheo::behavioural::Tusage_t usage |
---|
| 118 | ); |
---|
| 119 | public : ~Two_Level_Branch_Predictor (void); |
---|
| 120 | |
---|
| 121 | private : void allocation ( |
---|
| 122 | #ifdef STATISTICS |
---|
| 123 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
| 124 | #else |
---|
| 125 | void |
---|
| 126 | #endif |
---|
| 127 | ); |
---|
| 128 | private : void deallocation (void); |
---|
| 129 | |
---|
| 130 | #ifdef SYSTEMC |
---|
| 131 | public : void transition (void); |
---|
[111] | 132 | public : void genMealy_predict (void); |
---|
[110] | 133 | #endif |
---|
| 134 | |
---|
| 135 | #if VHDL |
---|
| 136 | public : void vhdl (void); |
---|
| 137 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
| 138 | private : void vhdl_body (Vhdl * & vhdl); |
---|
| 139 | #endif |
---|
| 140 | |
---|
| 141 | #ifdef STATISTICS |
---|
| 142 | public : void statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics); |
---|
| 143 | public : void statistics_deallocation (void); |
---|
| 144 | #endif |
---|
| 145 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 146 | private : void end_cycle (void); |
---|
| 147 | #endif |
---|
| 148 | }; |
---|
| 149 | |
---|
| 150 | }; // end namespace two_level_branch_predictor |
---|
| 151 | }; // end namespace meta_predictor |
---|
| 152 | }; // end namespace direction |
---|
| 153 | }; // end namespace prediction_unit |
---|
| 154 | }; // end namespace front_end |
---|
| 155 | }; // end namespace multi_front_end |
---|
| 156 | }; // end namespace core |
---|
| 157 | |
---|
| 158 | }; // end namespace behavioural |
---|
| 159 | }; // end namespace morpheo |
---|
| 160 | |
---|
| 161 | #endif |
---|