[78] | 1 | #ifndef morpheo_behavioural_core_multi_front_end_front_end_prediction_unit_update_prediction_table_Types_h |
---|
| 2 | #define morpheo_behavioural_core_multi_front_end_front_end_prediction_unit_update_prediction_table_Types_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Types.h 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #include "Behavioural/include/Types.h" |
---|
| 12 | |
---|
| 13 | namespace morpheo { |
---|
| 14 | namespace behavioural { |
---|
| 15 | namespace core { |
---|
| 16 | namespace multi_front_end { |
---|
| 17 | namespace front_end { |
---|
| 18 | namespace prediction_unit { |
---|
| 19 | namespace update_prediction_table { |
---|
| 20 | |
---|
[81] | 21 | typedef enum |
---|
| 22 | { |
---|
[88] | 23 | EVENT_STATE_OK , // Can predict |
---|
| 24 | EVENT_STATE_FLUSH_UFPT , // in decod stage, detect a miss, continue to execute but flush ufpt |
---|
| 25 | EVENT_STATE_FLUSH_UFPT_AND_UPT , // in commit stage, detect a miss, stop context and flush ufpt and upt |
---|
| 26 | EVENT_STATE_FLUSH_UPT_RAS , // in commit stage, detect a miss, context is stop and ufpt is flush, update RAS |
---|
| 27 | EVENT_STATE_FLUSH_UPT , // in commit stage, detect a miss, context is stop and ufpt is flush |
---|
| 28 | EVENT_STATE_UPDATE_CONTEXT // prediction unit is update, send signal to context manager |
---|
| 29 | } event_state_t; |
---|
[78] | 30 | |
---|
[88] | 31 | typedef enum |
---|
| 32 | { |
---|
| 33 | UPDATE_FETCH_PREDICTION_STATE_EMPTY , // Slot is empty |
---|
| 34 | UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD , // Have make a prediction, wait decod |
---|
| 35 | UPDATE_FETCH_PREDICTION_STATE_EVENT , // previous branch is a miss prediction |
---|
| 36 | UPDATE_FETCH_PREDICTION_STATE_END // branch is updated |
---|
| 37 | } ufpt_state_t; |
---|
| 38 | |
---|
| 39 | typedef enum |
---|
| 40 | { |
---|
| 41 | UPDATE_PREDICTION_STATE_EMPTY , // Slot is empty |
---|
| 42 | UPDATE_PREDICTION_STATE_WAIT_END , // Have make a prediction, wait branch_complete |
---|
| 43 | UPDATE_PREDICTION_STATE_OK , // this branch is a hit prediction |
---|
| 44 | UPDATE_PREDICTION_STATE_KO , // this branch is a miss prediction |
---|
| 45 | UPDATE_PREDICTION_STATE_EVENT , // previous branch is a miss prediction |
---|
| 46 | UPDATE_PREDICTION_STATE_END // branch is updated |
---|
| 47 | } upt_state_t; |
---|
| 48 | |
---|
| 49 | class ufpt_entry_t |
---|
[81] | 50 | { |
---|
[88] | 51 | public : ufpt_state_t _state ; |
---|
| 52 | public : Tbranch_condition_t _condition ; |
---|
| 53 | public : Taddress_t _address_src ; |
---|
| 54 | public : Taddress_t _address_dest ; |
---|
| 55 | public : Tcontrol_t _last_take ; |
---|
| 56 | //public : Tcontrol_t _good_take ; |
---|
| 57 | public : Tcontrol_t _is_accurate ; |
---|
| 58 | public : Thistory_t _history ; |
---|
| 59 | public : Taddress_t _address_ras ; |
---|
| 60 | public : Tptr_t _index_ras ; |
---|
| 61 | //public : Tcontrol_t _ifetch_prediction; |
---|
[81] | 62 | }; |
---|
| 63 | |
---|
[88] | 64 | class upt_entry_t |
---|
| 65 | { |
---|
| 66 | public : upt_state_t _state ; |
---|
| 67 | public : Tbranch_condition_t _condition ; |
---|
| 68 | public : Taddress_t _address_src ; |
---|
| 69 | public : Taddress_t _address_dest ; |
---|
| 70 | public : Tcontrol_t _last_take ; |
---|
| 71 | public : Tcontrol_t _good_take ; // not in ufpt |
---|
| 72 | public : Tcontrol_t _is_accurate ; |
---|
| 73 | public : Thistory_t _history ; |
---|
| 74 | public : Taddress_t _address_ras ; |
---|
| 75 | public : Tptr_t _index_ras ; |
---|
| 76 | public : Tcontrol_t _ifetch_prediction; // not in ufpt |
---|
| 77 | }; |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | // BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK |
---|
| 81 | // BRANCH_CONDITION_NONE_WITH_WRITE_STACK |
---|
| 82 | // BRANCH_CONDITION_FLAG_UNSET |
---|
| 83 | // BRANCH_CONDITION_FLAG_SET |
---|
| 84 | // BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK |
---|
| 85 | // BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK |
---|
| 86 | // BRANCH_CONDITION_READ_STACK |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | #define update_btb(cond) true |
---|
| 90 | |
---|
| 91 | #define update_dir(cond) ((cond == BRANCH_CONDITION_FLAG_UNSET) or \ |
---|
| 92 | (cond == BRANCH_CONDITION_FLAG_SET)) |
---|
| 93 | |
---|
| 94 | #define update_ras(cond) ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK ) or \ |
---|
| 95 | (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK) or \ |
---|
| 96 | (cond == BRANCH_CONDITION_READ_STACK )) |
---|
| 97 | |
---|
| 98 | #define push_ras(cond) ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK ) or \ |
---|
| 99 | (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK)) |
---|
| 100 | |
---|
| 101 | #define pop_ras(cond) ((cond == BRANCH_CONDITION_READ_STACK )) |
---|
| 102 | |
---|
| 103 | #define need_update(cond) update_ras(cond) |
---|
| 104 | |
---|
[78] | 105 | }; // end namespace update_prediction_table |
---|
| 106 | }; // end namespace prediction_unit |
---|
| 107 | }; // end namespace front_end |
---|
| 108 | }; // end namespace multi_front_end |
---|
| 109 | }; // end namespace core |
---|
[81] | 110 | }; // end namespace behavioural |
---|
| 111 | |
---|
[88] | 112 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::event_state_t>(const morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::event_state_t& x) |
---|
| 113 | { |
---|
| 114 | switch (x) |
---|
| 115 | { |
---|
| 116 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_OK : return "ok" ; break; |
---|
| 117 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_FLUSH_UFPT : return "flush_ufpt" ; break; |
---|
| 118 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_FLUSH_UFPT_AND_UPT : return "flush_ufpt_and_upt" ; break; |
---|
| 119 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_FLUSH_UPT_RAS : return "flush_upt_ras" ; break; |
---|
| 120 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_FLUSH_UPT : return "flush_upt" ; break; |
---|
| 121 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_UPDATE_CONTEXT : return "update_context" ; break; |
---|
| 122 | default : return "" ; break; |
---|
| 123 | } |
---|
| 124 | }; |
---|
[78] | 125 | |
---|
[88] | 126 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::ufpt_state_t>(const morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::ufpt_state_t& x) |
---|
[81] | 127 | { |
---|
| 128 | switch (x) |
---|
| 129 | { |
---|
[88] | 130 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_EMPTY : return "empty" ; break; |
---|
| 131 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD : return "wait_decod"; break; |
---|
| 132 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_EVENT : return "event" ; break; |
---|
| 133 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_END : return "end" ; break; |
---|
| 134 | default : return "" ; break; |
---|
| 135 | } |
---|
| 136 | }; |
---|
| 137 | |
---|
| 138 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::upt_state_t>(const morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::upt_state_t& x) |
---|
| 139 | { |
---|
| 140 | switch (x) |
---|
| 141 | { |
---|
[81] | 142 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_EMPTY : return "empty" ; break; |
---|
[88] | 143 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_WAIT_END : return "wait_end" ; break; |
---|
[81] | 144 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_OK : return "ok" ; break; |
---|
| 145 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_KO : return "ko" ; break; |
---|
[88] | 146 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_EVENT : return "event" ; break; |
---|
[81] | 147 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END : return "end" ; break; |
---|
| 148 | default : return "" ; break; |
---|
| 149 | } |
---|
| 150 | }; |
---|
| 151 | |
---|
[78] | 152 | }; // end namespace morpheo |
---|
| 153 | |
---|
| 154 | #endif |
---|