[81] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.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 update_prediction_table { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Update_Prediction_Table::genMealy_predict" |
---|
| 22 | void Update_Prediction_Table::genMealy_predict (void) |
---|
| 23 | { |
---|
[88] | 24 | log_begin(Update_Prediction_Table,FUNCTION); |
---|
| 25 | log_function(Update_Prediction_Table,FUNCTION,_name.c_str()); |
---|
| 26 | |
---|
| 27 | if (PORT_READ(in_NRESET) != 0) |
---|
| 28 | { |
---|
| 29 | |
---|
[81] | 30 | for (uint32_t i=0; i<_param->_nb_inst_predict; i++) |
---|
| 31 | { |
---|
| 32 | Tcontext_t context = (_param->_have_port_context_id)?PORT_READ(in_PREDICT_CONTEXT_ID [i]):0; |
---|
[88] | 33 | uint32_t top = reg_UFPT_TOP[context]; |
---|
[81] | 34 | |
---|
[88] | 35 | log_printf(TRACE,Update_Prediction_Table,FUNCTION,"PREDICT [%d] (genMealy)",i); |
---|
| 36 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * context : %d",context); |
---|
| 37 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * top : %d",top); |
---|
| 38 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * state : %s",toString(reg_UPDATE_FETCH_PREDICTION_TABLE [context][top]._state).c_str()); |
---|
| 39 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * is accurate : %d",PORT_READ(in_PREDICT_BTB_IS_ACCURATE [i])); |
---|
[81] | 40 | // log_printf(TRACE,Update_Prediction_Table,FUNCTION," * need update : %d",reg_NB_ELT_NEED_UPDATE [context]); |
---|
| 41 | |
---|
[88] | 42 | internal_PREDICT_UPDATE_PREDICTION_ID [i] = top; |
---|
[81] | 43 | |
---|
[88] | 44 | if (_param->_have_port_depth) |
---|
| 45 | PORT_WRITE(out_PREDICT_UPDATE_PREDICTION_ID [i], internal_PREDICT_UPDATE_PREDICTION_ID [i]); |
---|
[81] | 46 | |
---|
[88] | 47 | bool is_accurate = not _param->_not_accurate_block_predict or reg_IS_ACCURATE[context]; |
---|
| 48 | |
---|
| 49 | // Ack if : |
---|
| 50 | // * slot is empty |
---|
| 51 | // * no previous miss |
---|
| 52 | // * is_accurate |
---|
| 53 | internal_PREDICT_ACK [i] = ((reg_UPDATE_FETCH_PREDICTION_TABLE [context][top]._state == UPDATE_FETCH_PREDICTION_STATE_EMPTY) and |
---|
| 54 | // PORT_READ(in_PREDICT_BTB_IS_ACCURATE [i]) and |
---|
| 55 | (reg_EVENT_STATE [context] == EVENT_STATE_OK) and |
---|
| 56 | is_accurate); |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | log_printf(TRACE,Update_Prediction_Table,FUNCTION," * ACK : %d",internal_PREDICT_ACK [i]); |
---|
[81] | 60 | PORT_WRITE(out_PREDICT_ACK [i], internal_PREDICT_ACK [i]); |
---|
| 61 | } |
---|
| 62 | |
---|
[88] | 63 | }//don't reset |
---|
| 64 | |
---|
| 65 | log_end(Update_Prediction_Table,FUNCTION); |
---|
[81] | 66 | }; |
---|
| 67 | |
---|
| 68 | }; // end namespace update_prediction_table |
---|
| 69 | }; // end namespace prediction_unit |
---|
| 70 | }; // end namespace front_end |
---|
| 71 | }; // end namespace multi_front_end |
---|
| 72 | }; // end namespace core |
---|
| 73 | |
---|
| 74 | }; // end namespace behavioural |
---|
| 75 | }; // end namespace morpheo |
---|
| 76 | #endif |
---|