[110] | 1 | /* |
---|
| 2 | * $Id: Two_Level_Branch_Predictor.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/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.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 direction { |
---|
| 17 | namespace meta_predictor { |
---|
| 18 | namespace two_level_branch_predictor { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Two_Level_Branch_Predictor::Two_Level_Branch_Predictor" |
---|
| 23 | Two_Level_Branch_Predictor::Two_Level_Branch_Predictor |
---|
| 24 | ( |
---|
| 25 | #ifdef SYSTEMC |
---|
| 26 | sc_module_name name, |
---|
| 27 | #else |
---|
| 28 | string name, |
---|
| 29 | #endif |
---|
| 30 | #ifdef STATISTICS |
---|
| 31 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 32 | #endif |
---|
| 33 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters * param, |
---|
| 34 | morpheo::behavioural::Tusage_t usage |
---|
| 35 | ): |
---|
| 36 | _name (name) |
---|
| 37 | ,_param (param) |
---|
| 38 | ,_usage (usage) |
---|
| 39 | { |
---|
| 40 | log_begin(Two_Level_Branch_Predictor,FUNCTION); |
---|
| 41 | |
---|
| 42 | usage_environment(_usage); |
---|
| 43 | |
---|
| 44 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Allocation"),_name.c_str()); |
---|
| 45 | |
---|
| 46 | allocation ( |
---|
| 47 | #ifdef STATISTICS |
---|
| 48 | param_statistics |
---|
| 49 | #endif |
---|
| 50 | ); |
---|
| 51 | |
---|
| 52 | #ifdef STATISTICS |
---|
| 53 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 54 | { |
---|
| 55 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Allocation of statistics"),_name.c_str()); |
---|
| 56 | |
---|
| 57 | statistics_allocation(param_statistics); |
---|
| 58 | } |
---|
| 59 | #endif |
---|
| 60 | |
---|
| 61 | #ifdef VHDL |
---|
| 62 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 63 | { |
---|
| 64 | // generate the vhdl |
---|
| 65 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Generate the vhdl"),_name.c_str()); |
---|
| 66 | |
---|
| 67 | vhdl(); |
---|
| 68 | } |
---|
| 69 | #endif |
---|
| 70 | |
---|
| 71 | #ifdef SYSTEMC |
---|
| 72 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 73 | { |
---|
[131] | 74 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 75 | constant(); |
---|
| 76 | #else |
---|
| 77 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - constant"),_name.c_str()); |
---|
[111] | 78 | |
---|
[131] | 79 | SC_METHOD (constant); |
---|
| 80 | // dont_initialize (); |
---|
| 81 | |
---|
| 82 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 83 | // List dependency information |
---|
| 84 | # endif |
---|
| 85 | #endif |
---|
| 86 | |
---|
[110] | 87 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - transition"),_name.c_str()); |
---|
| 88 | |
---|
| 89 | SC_METHOD (transition); |
---|
| 90 | dont_initialize (); |
---|
| 91 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 92 | |
---|
| 93 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 94 | // List dependency information |
---|
| 95 | # endif |
---|
| 96 | |
---|
[111] | 97 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Method - genMealy_predict"),_name.c_str()); |
---|
[110] | 98 | |
---|
[111] | 99 | SC_METHOD (genMealy_predict); |
---|
| 100 | dont_initialize (); |
---|
[132] | 101 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 102 | << (*(in_NRESET)); |
---|
[111] | 103 | |
---|
| 104 | for (uint32_t i=0; i<_param->_nb_inst_predict; ++i) |
---|
| 105 | sensitive |
---|
| 106 | // << (*(in_PREDICT_VAL [i])) |
---|
| 107 | << (*(in_PREDICT_ADDRESS [i])); |
---|
| 108 | |
---|
| 109 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 110 | // List dependency information |
---|
| 111 | # endif |
---|
[110] | 112 | |
---|
| 113 | #endif |
---|
| 114 | } |
---|
| 115 | log_end(Two_Level_Branch_Predictor,FUNCTION); |
---|
| 116 | }; |
---|
| 117 | |
---|
| 118 | #undef FUNCTION |
---|
| 119 | #define FUNCTION "Two_Level_Branch_Predictor::~Two_Level_Branch_Predictor" |
---|
| 120 | Two_Level_Branch_Predictor::~Two_Level_Branch_Predictor (void) |
---|
| 121 | { |
---|
| 122 | log_begin(Two_Level_Branch_Predictor,FUNCTION); |
---|
| 123 | |
---|
| 124 | #ifdef STATISTICS |
---|
| 125 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 126 | { |
---|
| 127 | statistics_deallocation(); |
---|
| 128 | } |
---|
| 129 | #endif |
---|
| 130 | |
---|
| 131 | log_printf(INFO,Two_Level_Branch_Predictor,FUNCTION,_("<%s> : Deallocation"),_name.c_str()); |
---|
| 132 | deallocation (); |
---|
| 133 | |
---|
| 134 | log_end(Two_Level_Branch_Predictor,FUNCTION); |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | }; // end namespace two_level_branch_predictor |
---|
| 138 | }; // end namespace meta_predictor |
---|
| 139 | }; // end namespace direction |
---|
| 140 | }; // end namespace prediction_unit |
---|
| 141 | }; // end namespace front_end |
---|
| 142 | }; // end namespace multi_front_end |
---|
| 143 | }; // end namespace core |
---|
| 144 | |
---|
| 145 | }; // end namespace behavioural |
---|
| 146 | }; // end namespace morpheo |
---|