[78] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Direction_Glue_genMealy_predict.cpp 123 2009-06-08 20:43:30Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Direction_Glue/include/Direction_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 direction_glue { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Direction_Glue::genMealy_predict" |
---|
| 23 | void Direction_Glue::genMealy_predict (void) |
---|
| 24 | { |
---|
[107] | 25 | log_begin(Direction_Glue,FUNCTION); |
---|
| 26 | log_function(Direction_Glue,FUNCTION,_name.c_str()); |
---|
[78] | 27 | |
---|
[123] | 28 | if (PORT_READ(in_NRESET)) |
---|
| 29 | { |
---|
| 30 | // std::cout << "Kane (before) " << std::endl; |
---|
| 31 | // std::cout << _param << std::endl; |
---|
| 32 | // std::cout << _param->_nb_inst_update << std::endl; |
---|
| 33 | // std::cout << _param->_nb_inst_predict<< std::endl; |
---|
| 34 | // std::cout << "Kane (end) " << std::endl; |
---|
| 35 | |
---|
| 36 | |
---|
[78] | 37 | // constant direction : never / always |
---|
[107] | 38 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
[78] | 39 | { |
---|
[107] | 40 | log_printf(TRACE,Direction_Glue,FUNCTION," * PREDICT [%d]",i); |
---|
[78] | 41 | |
---|
[123] | 42 | Tcontrol_t direction = false; |
---|
[78] | 43 | |
---|
[107] | 44 | switch (_param->_predictor_scheme) |
---|
| 45 | { |
---|
| 46 | // defined as constant in Direction_Glue.cpp |
---|
| 47 | // case PREDICTOR_NEVER_TAKE : |
---|
| 48 | // { |
---|
| 49 | // direction = 0; |
---|
| 50 | // break; |
---|
| 51 | // } |
---|
| 52 | // case PREDICTOR_ALWAYS_TAKE : |
---|
| 53 | // { |
---|
| 54 | // direction = 1; |
---|
| 55 | // break; |
---|
| 56 | // } |
---|
| 57 | case PREDICTOR_STATIC : |
---|
| 58 | { |
---|
| 59 | direction = PORT_READ(in_PREDICT_STATIC [i]); |
---|
| 60 | break; |
---|
| 61 | } |
---|
| 62 | case PREDICTOR_LAST_TAKE : |
---|
| 63 | { |
---|
| 64 | direction = PORT_READ(in_PREDICT_LAST_TAKE [i]); |
---|
| 65 | break; |
---|
| 66 | } |
---|
| 67 | case PREDICTOR_COUNTER : |
---|
| 68 | case PREDICTOR_LOCAL : |
---|
| 69 | case PREDICTOR_GLOBAL : |
---|
| 70 | case PREDICTOR_META : |
---|
| 71 | case PREDICTOR_CUSTOM : |
---|
| 72 | { |
---|
| 73 | // not use : |
---|
| 74 | // in_PREDICT_LAST_TAKE |
---|
| 75 | // in_PREDICT_STATIC |
---|
| 76 | |
---|
| 77 | direction = PORT_READ(in_PREDICT_PREDICTOR_DIRECTION [i]); |
---|
| 78 | |
---|
[78] | 79 | PORT_WRITE(out_PREDICT_PREDICTOR_VAL [i], PORT_READ(in_PREDICT_VAL [i])); |
---|
| 80 | PORT_WRITE(out_PREDICT_ACK [i], PORT_READ(in_PREDICT_PREDICTOR_ACK [i])); |
---|
| 81 | PORT_WRITE(out_PREDICT_PREDICTOR_ADDRESS_SRC [i], PORT_READ(in_PREDICT_ADDRESS_SRC [i])); |
---|
| 82 | PORT_WRITE(out_PREDICT_HISTORY [i], PORT_READ(in_PREDICT_PREDICTOR_HISTORY [i])); |
---|
[107] | 83 | |
---|
| 84 | break; |
---|
| 85 | } |
---|
| 86 | default : |
---|
| 87 | { |
---|
| 88 | ERRORMORPHEO(FUNCTION,"No valid predictor scheme"); |
---|
| 89 | break; |
---|
| 90 | } |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | log_printf(TRACE,Direction_Glue,FUNCTION," * direction : %d",direction); |
---|
[78] | 94 | |
---|
[107] | 95 | PORT_WRITE(out_PREDICT_DIRECTION [i], direction); |
---|
[78] | 96 | } |
---|
[123] | 97 | } |
---|
| 98 | else |
---|
| 99 | { |
---|
| 100 | //RESET |
---|
| 101 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 102 | { |
---|
| 103 | if (_param->_have_component_meta_predictor) |
---|
| 104 | { |
---|
| 105 | PORT_WRITE(out_PREDICT_PREDICTOR_VAL [i], 0); |
---|
| 106 | PORT_WRITE(out_PREDICT_ACK [i], 0); |
---|
| 107 | } |
---|
| 108 | } |
---|
| 109 | } |
---|
[78] | 110 | |
---|
[107] | 111 | log_end(Direction_Glue,FUNCTION); |
---|
[78] | 112 | }; |
---|
| 113 | |
---|
| 114 | }; // end namespace direction_glue |
---|
| 115 | }; // end namespace direction |
---|
| 116 | }; // end namespace prediction_unit |
---|
| 117 | }; // end namespace front_end |
---|
| 118 | }; // end namespace multi_front_end |
---|
| 119 | }; // end namespace core |
---|
| 120 | }; // end namespace behavioural |
---|
| 121 | }; // end namespace morpheo |
---|
| 122 | #endif |
---|