[111] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Meta_Predictor_Glue_genMealy_predict.cpp 111 2009-02-27 18:37:40Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace prediction_unit { |
---|
| 17 | namespace direction { |
---|
| 18 | namespace meta_predictor { |
---|
| 19 | namespace meta_predictor_glue { |
---|
| 20 | |
---|
| 21 | |
---|
| 22 | #undef FUNCTION |
---|
| 23 | #define FUNCTION "Meta_Predictor_Glue::genMealy_predict" |
---|
| 24 | void Meta_Predictor_Glue::genMealy_predict (void) |
---|
| 25 | { |
---|
| 26 | log_begin(Meta_Predictor_Glue,FUNCTION); |
---|
| 27 | log_function(Meta_Predictor_Glue,FUNCTION,_name.c_str()); |
---|
| 28 | |
---|
| 29 | for (uint32_t i=0; i<_param->_nb_inst_predict; ++i) |
---|
| 30 | { |
---|
| 31 | Thistory_t history ; |
---|
| 32 | Tcontrol_t direction; |
---|
| 33 | |
---|
| 34 | switch (_param->_nb_predictor) |
---|
| 35 | { |
---|
| 36 | case 1 : |
---|
| 37 | { |
---|
| 38 | history = PORT_READ(in_PREDICT_PREDICTOR_HISTORY [0][i]); |
---|
| 39 | direction = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [0][i]); |
---|
| 40 | |
---|
| 41 | if (_param->_predictor_update_on_prediction [0]) |
---|
| 42 | { |
---|
| 43 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [0][i],true ); |
---|
| 44 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION [0][i],direction); |
---|
| 45 | } |
---|
| 46 | break; |
---|
| 47 | } |
---|
| 48 | case 3 : |
---|
| 49 | { |
---|
| 50 | Thistory_t history_0 = PORT_READ(in_PREDICT_PREDICTOR_HISTORY [0][i]); |
---|
| 51 | Thistory_t history_1 = PORT_READ(in_PREDICT_PREDICTOR_HISTORY [1][i]); |
---|
| 52 | Thistory_t history_2 = PORT_READ(in_PREDICT_PREDICTOR_HISTORY [2][i]); |
---|
| 53 | Tcontrol_t direction_0 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [0][i]); |
---|
| 54 | Tcontrol_t direction_1 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [1][i]); |
---|
| 55 | Tcontrol_t direction_2 = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [2][i]); |
---|
| 56 | |
---|
| 57 | history = ((history_0 <<_param->_predictor_history_shift [0]) | |
---|
| 58 | (history_1 <<_param->_predictor_history_shift [1]) | |
---|
| 59 | (history_2 <<_param->_predictor_history_shift [2])); |
---|
| 60 | |
---|
| 61 | direction = (( direction_2 and direction_1) or |
---|
| 62 | (not direction_2 and direction_0)); |
---|
| 63 | |
---|
| 64 | if (_param->_predictor_update_on_prediction [0]) |
---|
| 65 | { |
---|
| 66 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [0][i],direction_2 == 0); |
---|
| 67 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION [0][i],direction); |
---|
| 68 | } |
---|
| 69 | if (_param->_predictor_update_on_prediction [1]) |
---|
| 70 | { |
---|
| 71 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [1][i],direction_2 == 1); |
---|
| 72 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION [1][i],direction); |
---|
| 73 | } |
---|
| 74 | if (_param->_predictor_update_on_prediction [2]) |
---|
| 75 | { |
---|
| 76 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION_VAL [2][i],true); |
---|
| 77 | PORT_WRITE(out_PREDICT_PREDICTOR_DIRECTION [2][i],direction_2); |
---|
| 78 | } |
---|
| 79 | |
---|
| 80 | break; |
---|
| 81 | } |
---|
| 82 | default : |
---|
| 83 | { |
---|
| 84 | break; |
---|
| 85 | } |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | PORT_WRITE(out_PREDICT_HISTORY [i],history ); |
---|
| 89 | PORT_WRITE(out_PREDICT_DIRECTION [i],direction); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | log_end(Meta_Predictor_Glue,FUNCTION); |
---|
| 93 | }; |
---|
| 94 | |
---|
| 95 | }; // end namespace meta_predictor_glue |
---|
| 96 | }; // end namespace meta_predictor |
---|
| 97 | }; // end namespace direction |
---|
| 98 | }; // end namespace prediction_unit |
---|
| 99 | }; // end namespace front_end |
---|
| 100 | }; // end namespace multi_front_end |
---|
| 101 | }; // end namespace core |
---|
| 102 | |
---|
| 103 | }; // end namespace behavioural |
---|
| 104 | }; // end namespace morpheo |
---|
| 105 | #endif |
---|