[4] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Meta_Predictor_Glue_genMealy_predict_history.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[48] | 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h" |
---|
[4] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
[48] | 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace prediction_unit { |
---|
| 17 | namespace direction { |
---|
| 18 | |
---|
[4] | 19 | namespace meta_predictor { |
---|
| 20 | namespace meta_predictor_glue { |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | void Meta_Predictor_Glue::genMealy_predict_history (void) |
---|
| 24 | { |
---|
| 25 | log_printf(FUNC,Meta_Predictor_Glue,"genMealy_predict_history","Begin"); |
---|
| 26 | |
---|
| 27 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 28 | { |
---|
| 29 | Thistory_t history = 0; |
---|
| 30 | Tpht_history_t predictor_0_pht_history =0, predictor_1_pht_history =0, predictor_2_pht_history =0; |
---|
| 31 | Tbht_history_t predictor_0_bht_history =0, predictor_1_bht_history =0, predictor_2_bht_history =0; |
---|
| 32 | Tcontrol_t predictor_0_pht_direction=0, predictor_1_pht_direction=0, predictor_2_pht_direction=0; |
---|
| 33 | Tcontrol_t predictor_0_bht_direction=0, predictor_1_bht_direction=0, predictor_2_bht_direction=0; |
---|
| 34 | Tcontrol_t predictor_0_direction, predictor_1_direction, predictor_2_direction; |
---|
| 35 | Tcontrol_t predictor_direction; |
---|
| 36 | |
---|
| 37 | if (_param._predictor_2_have_pht) |
---|
| 38 | { |
---|
| 39 | predictor_2_pht_history = PORT_READ(in_PREDICT_PREDICTOR_2_PHT_HISTORY [i]); |
---|
| 40 | predictor_2_pht_direction = predictor_2_pht_history >> (_param._predictor_2_pht_size_counter-1); |
---|
[5] | 41 | history |= (predictor_2_pht_history << _param._shift_5); |
---|
[4] | 42 | } |
---|
| 43 | if (_param._predictor_2_have_bht) |
---|
| 44 | { |
---|
| 45 | predictor_2_bht_history = PORT_READ(in_PREDICT_PREDICTOR_2_BHT_HISTORY [i]); |
---|
| 46 | predictor_2_bht_direction = predictor_2_bht_history >> (_param._predictor_2_bht_size_shifter-1); |
---|
[5] | 47 | history |= (predictor_2_bht_history << _param._shift_4); |
---|
[4] | 48 | } |
---|
| 49 | |
---|
| 50 | predictor_2_direction = (_param._predictor_2_have_pht==true)?predictor_2_pht_direction:predictor_2_bht_direction; |
---|
| 51 | |
---|
| 52 | if (_param._have_meta_predictor) |
---|
| 53 | { |
---|
| 54 | if (_param._predictor_1_have_pht) |
---|
| 55 | { |
---|
| 56 | predictor_1_pht_history = PORT_READ(in_PREDICT_PREDICTOR_1_PHT_HISTORY [i]); |
---|
| 57 | predictor_1_pht_direction = predictor_1_pht_history >> (_param._predictor_1_pht_size_counter-1); |
---|
[5] | 58 | history |= (predictor_1_pht_history << _param._shift_3); |
---|
[4] | 59 | } |
---|
| 60 | if (_param._predictor_1_have_bht) |
---|
| 61 | { |
---|
| 62 | predictor_1_bht_history = PORT_READ(in_PREDICT_PREDICTOR_1_BHT_HISTORY [i]); |
---|
| 63 | predictor_1_bht_direction = predictor_1_bht_history >> (_param._predictor_1_bht_size_shifter-1); |
---|
[5] | 64 | history |= (predictor_1_bht_history << _param._shift_2) ; |
---|
[4] | 65 | } |
---|
| 66 | if (_param._predictor_0_have_pht) |
---|
| 67 | { |
---|
| 68 | predictor_0_pht_history = PORT_READ(in_PREDICT_PREDICTOR_0_PHT_HISTORY [i]); |
---|
| 69 | predictor_0_pht_direction = predictor_0_pht_history >> (_param._predictor_0_pht_size_counter-1); |
---|
[5] | 70 | history |= (predictor_0_pht_history << _param._shift_1); |
---|
[4] | 71 | } |
---|
| 72 | if (_param._predictor_0_have_bht) |
---|
| 73 | { |
---|
| 74 | predictor_0_bht_history = PORT_READ(in_PREDICT_PREDICTOR_0_BHT_HISTORY [i]); |
---|
| 75 | predictor_0_bht_direction = predictor_0_bht_history >> (_param._predictor_0_bht_size_shifter-1); |
---|
[5] | 76 | history |= (predictor_0_bht_history << _param._shift_0); |
---|
[4] | 77 | } |
---|
| 78 | |
---|
| 79 | predictor_0_direction = (_param._predictor_0_have_pht==true)?predictor_0_pht_direction:predictor_0_bht_direction; |
---|
| 80 | predictor_1_direction = (_param._predictor_1_have_pht==true)?predictor_1_pht_direction:predictor_1_bht_direction; |
---|
| 81 | |
---|
| 82 | // Meta predictor : take direction of prediction_2 and select the good predictor. |
---|
| 83 | predictor_direction = (predictor_2_direction==0)?predictor_0_direction:predictor_1_direction; |
---|
| 84 | |
---|
| 85 | log_printf(TRACE,Meta_Predictor_Glue,"genMealy_predict_history","predict_direction = %d - predictor(_0 %d, _1 %d, _2 %d)",predictor_direction,predictor_0_direction,predictor_1_direction,predictor_2_direction); |
---|
| 86 | } |
---|
| 87 | else |
---|
| 88 | { |
---|
| 89 | predictor_direction = predictor_2_direction; |
---|
| 90 | log_printf(TRACE,Meta_Predictor_Glue,"genMealy_predict_history","predict_direction = %d - predictor_2 %d",predictor_direction,predictor_2_direction); |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | PORT_WRITE(out_PREDICT_DIRECTION [i], predictor_direction); |
---|
| 94 | PORT_WRITE(out_PREDICT_HISTORY [i], history ); |
---|
| 95 | } |
---|
| 96 | |
---|
| 97 | log_printf(FUNC,Meta_Predictor_Glue,"genMealy_predict_history","End"); |
---|
| 98 | }; |
---|
| 99 | |
---|
| 100 | }; // end namespace meta_predictor_glue |
---|
| 101 | }; // end namespace meta_predictor |
---|
[48] | 102 | |
---|
| 103 | }; // end namespace core |
---|
| 104 | }; // end namespace multi_front_end |
---|
| 105 | }; // end namespace front_end |
---|
| 106 | }; // end namespace prediction_unit |
---|
| 107 | }; // end namespace direction |
---|
| 108 | |
---|
[4] | 109 | }; // end namespace behavioural |
---|
| 110 | }; // end namespace morpheo |
---|
| 111 | #endif |
---|