[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 123 2009-06-08 20:43:30Z 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 | { |
---|
[109] | 23 | EVENT_SOURCE_UFPT, |
---|
| 24 | EVENT_SOURCE_UPT |
---|
| 25 | } event_source_t; |
---|
| 26 | |
---|
[122] | 27 | // typedef enum |
---|
| 28 | // { |
---|
| 29 | // EVENT_STATE_OK , // Can predict |
---|
| 30 | // EVENT_STATE_MISS_FLUSH_UFPT , // in decod stage, detect a miss , continue to execute but flush ufpt |
---|
| 31 | // EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT , // in commit stage, detect a miss , stop context and flush ufpt and upt |
---|
| 32 | // EVENT_STATE_MISS_FLUSH_UPT , // in commit stage, detect a miss , context is stop and ufpt is flush, update RAS |
---|
| 33 | // EVENT_STATE_EVENT_FLUSH_UFPT , // in commit stage, detect an event, continue to execute but flush ufpt |
---|
| 34 | // EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT, // in commit stage, detect an event, stop context and flush ufpt and upt |
---|
| 35 | // EVENT_STATE_EVENT_FLUSH_UPT , // in commit stage, detect an event, context is stop and ufpt is flush, update RAS |
---|
| 36 | // EVENT_STATE_UPDATE_CONTEXT , // prediction unit is update, send signal to context manager |
---|
| 37 | // EVENT_STATE_WAIT_END_EVENT // prediction unit is ok, wait the end of event (send by Context State) |
---|
| 38 | // } event_state_t; |
---|
| 39 | |
---|
[109] | 40 | typedef enum |
---|
| 41 | { |
---|
[122] | 42 | UFPT_EVENT_STATE_OK , // Can predict |
---|
| 43 | UFPT_EVENT_STATE_KO_FLUSH // Can't predict, flush ufpt |
---|
| 44 | } ufpt_event_state_t; |
---|
[78] | 45 | |
---|
[88] | 46 | typedef enum |
---|
| 47 | { |
---|
[122] | 48 | UPT_EVENT_STATE_OK , // Can predict |
---|
| 49 | UPT_EVENT_STATE_KO_MISS_WAIT_UFPT , // in decod stage, detect a miss , continue to execute but flush ufpt |
---|
| 50 | UPT_EVENT_STATE_KO_MISS_FLUSH_UPT , // in commit stage, detect a miss , context is stop and ufpt is flush, update RAS |
---|
| 51 | UPT_EVENT_STATE_KO_EVENT_WAIT_UFPT , // in commit stage, detect an event, continue to execute but flush ufpt |
---|
| 52 | UPT_EVENT_STATE_KO_EVENT_FLUSH_UPT , // in commit stage, detect an event, context is stop and ufpt is flush, update RAS |
---|
| 53 | UPT_EVENT_STATE_KO_DECODE_UPDATE_CONTEXT , // prediction unit is update, send signal to context manager |
---|
| 54 | UPT_EVENT_STATE_KO_DECODE_WAIT_END_EVENT , // prediction unit is ok, wait the end of event (send by Context State) |
---|
| 55 | UPT_EVENT_STATE_KO_COMMIT_UPDATE_CONTEXT , // prediction unit is update, send signal to context manager |
---|
[123] | 56 | UPT_EVENT_STATE_KO_COMMIT_WAIT_END_EVENT , // prediction unit is ok, wait the end of event (send by Context State) |
---|
| 57 | UPT_EVENT_STATE_KO_COMMIT_WAIT_END_UPDATE // prediction unit is ok, wait the end of event (send by Context State) |
---|
[122] | 58 | } upt_event_state_t; |
---|
| 59 | |
---|
| 60 | typedef enum |
---|
| 61 | { |
---|
[88] | 62 | UPDATE_FETCH_PREDICTION_STATE_EMPTY , // Slot is empty |
---|
| 63 | UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD , // Have make a prediction, wait decod |
---|
| 64 | UPDATE_FETCH_PREDICTION_STATE_EVENT , // previous branch is a miss prediction |
---|
| 65 | UPDATE_FETCH_PREDICTION_STATE_END // branch is updated |
---|
| 66 | } ufpt_state_t; |
---|
| 67 | |
---|
| 68 | typedef enum |
---|
| 69 | { |
---|
| 70 | UPDATE_PREDICTION_STATE_EMPTY , // Slot is empty |
---|
| 71 | UPDATE_PREDICTION_STATE_WAIT_END , // Have make a prediction, wait branch_complete |
---|
| 72 | UPDATE_PREDICTION_STATE_OK , // this branch is a hit prediction |
---|
| 73 | UPDATE_PREDICTION_STATE_KO , // this branch is a miss prediction |
---|
| 74 | UPDATE_PREDICTION_STATE_EVENT , // previous branch is a miss prediction |
---|
[106] | 75 | UPDATE_PREDICTION_STATE_END , // update pointer |
---|
| 76 | // UPDATE_PREDICTION_STATE_END_OK , // branch is updated, update pointer |
---|
| 77 | // UPDATE_PREDICTION_STATE_END_KO_WAIT_END , // branch is updated, don't update pointer |
---|
[95] | 78 | UPDATE_PREDICTION_STATE_END_KO // branch is updated, don't update pointer |
---|
[88] | 79 | } upt_state_t; |
---|
| 80 | |
---|
| 81 | class ufpt_entry_t |
---|
[81] | 82 | { |
---|
[88] | 83 | public : ufpt_state_t _state ; |
---|
| 84 | public : Tbranch_condition_t _condition ; |
---|
| 85 | public : Taddress_t _address_src ; |
---|
| 86 | public : Taddress_t _address_dest ; |
---|
| 87 | public : Tcontrol_t _last_take ; |
---|
| 88 | //public : Tcontrol_t _good_take ; |
---|
| 89 | public : Tcontrol_t _is_accurate ; |
---|
| 90 | public : Thistory_t _history ; |
---|
| 91 | public : Taddress_t _address_ras ; |
---|
| 92 | public : Tptr_t _index_ras ; |
---|
| 93 | //public : Tcontrol_t _ifetch_prediction; |
---|
[119] | 94 | //public : Tcontrol_t _miss_commit ; |
---|
[81] | 95 | }; |
---|
| 96 | |
---|
[88] | 97 | class upt_entry_t |
---|
| 98 | { |
---|
| 99 | public : upt_state_t _state ; |
---|
| 100 | public : Tbranch_condition_t _condition ; |
---|
| 101 | public : Taddress_t _address_src ; |
---|
| 102 | public : Taddress_t _address_dest ; |
---|
| 103 | public : Tcontrol_t _last_take ; |
---|
| 104 | public : Tcontrol_t _good_take ; // not in ufpt |
---|
| 105 | public : Tcontrol_t _is_accurate ; |
---|
| 106 | public : Thistory_t _history ; |
---|
| 107 | public : Taddress_t _address_ras ; |
---|
| 108 | public : Tptr_t _index_ras ; |
---|
| 109 | public : Tcontrol_t _ifetch_prediction; // not in ufpt |
---|
[119] | 110 | public : Tcontrol_t _miss_commit ; // not in ufpt |
---|
[111] | 111 | |
---|
[112] | 112 | // to branchement_log_file |
---|
[111] | 113 | public : bool _retire_ok ; |
---|
[112] | 114 | public : bool _miss_prediction ; |
---|
[88] | 115 | }; |
---|
| 116 | |
---|
| 117 | |
---|
| 118 | // BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK |
---|
| 119 | // BRANCH_CONDITION_NONE_WITH_WRITE_STACK |
---|
| 120 | // BRANCH_CONDITION_FLAG_UNSET |
---|
| 121 | // BRANCH_CONDITION_FLAG_SET |
---|
| 122 | // BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK |
---|
| 123 | // BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK |
---|
| 124 | // BRANCH_CONDITION_READ_STACK |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | #define update_btb(cond) true |
---|
| 128 | |
---|
| 129 | #define update_dir(cond) ((cond == BRANCH_CONDITION_FLAG_UNSET) or \ |
---|
| 130 | (cond == BRANCH_CONDITION_FLAG_SET)) |
---|
| 131 | |
---|
| 132 | #define update_ras(cond) ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK ) or \ |
---|
| 133 | (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK) or \ |
---|
| 134 | (cond == BRANCH_CONDITION_READ_STACK )) |
---|
| 135 | |
---|
| 136 | #define push_ras(cond) ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK ) or \ |
---|
| 137 | (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK)) |
---|
| 138 | |
---|
| 139 | #define pop_ras(cond) ((cond == BRANCH_CONDITION_READ_STACK )) |
---|
| 140 | |
---|
[112] | 141 | #define need_update(cond) (update_ras(cond) or update_dir(cond)) |
---|
[88] | 142 | |
---|
[78] | 143 | }; // end namespace update_prediction_table |
---|
| 144 | }; // end namespace prediction_unit |
---|
| 145 | }; // end namespace front_end |
---|
| 146 | }; // end namespace multi_front_end |
---|
| 147 | }; // end namespace core |
---|
[81] | 148 | }; // end namespace behavioural |
---|
[109] | 149 | |
---|
| 150 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::event_source_t>(const morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::event_source_t& x) |
---|
| 151 | { |
---|
| 152 | switch (x) |
---|
| 153 | { |
---|
| 154 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_SOURCE_UFPT : return "ufpt"; break; |
---|
| 155 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_SOURCE_UPT : return "upt" ; break; |
---|
| 156 | default : return ""; break; |
---|
| 157 | } |
---|
| 158 | }; |
---|
| 159 | |
---|
[122] | 160 | // 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) |
---|
| 161 | // { |
---|
| 162 | // switch (x) |
---|
| 163 | // { |
---|
| 164 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_OK : return "ok" ; break; |
---|
| 165 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_MISS_FLUSH_UFPT : return "miss_flush_ufpt" ; break; |
---|
| 166 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT : return "miss_flush_ufpt_and_upt" ; break; |
---|
| 167 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_MISS_FLUSH_UPT : return "miss_flush_upt" ; break; |
---|
| 168 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_EVENT_FLUSH_UPT : return "event_flush_upt" ; break; |
---|
| 169 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_EVENT_FLUSH_UFPT : return "event_flush_ufpt" ; break; |
---|
| 170 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT: return "event_flush_ufpt_and_upt"; break; |
---|
| 171 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_UPDATE_CONTEXT : return "update_context" ; break; |
---|
| 172 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_WAIT_END_EVENT : return "wait_end_event" ; break; |
---|
| 173 | // default : return ""; break; |
---|
| 174 | // } |
---|
| 175 | // }; |
---|
[109] | 176 | |
---|
[88] | 177 | 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] | 178 | { |
---|
| 179 | switch (x) |
---|
| 180 | { |
---|
[88] | 181 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_EMPTY : return "empty" ; break; |
---|
| 182 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD : return "wait_decod"; break; |
---|
| 183 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_EVENT : return "event" ; break; |
---|
| 184 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_END : return "end" ; break; |
---|
| 185 | default : return "" ; break; |
---|
| 186 | } |
---|
| 187 | }; |
---|
| 188 | |
---|
| 189 | 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) |
---|
| 190 | { |
---|
| 191 | switch (x) |
---|
| 192 | { |
---|
[81] | 193 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_EMPTY : return "empty" ; break; |
---|
[88] | 194 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_WAIT_END : return "wait_end" ; break; |
---|
[81] | 195 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_OK : return "ok" ; break; |
---|
| 196 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_KO : return "ko" ; break; |
---|
[88] | 197 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_EVENT : return "event" ; break; |
---|
[106] | 198 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END : return "end" ; break; |
---|
| 199 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END_OK : return "end_ok" ; break; |
---|
| 200 | // case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END_KO_WAIT_END: return "end_ko_wait_end" ; break; |
---|
[95] | 201 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END_KO : return "end_ko" ; break; |
---|
[81] | 202 | default : return "" ; break; |
---|
| 203 | } |
---|
| 204 | }; |
---|
| 205 | |
---|
[122] | 206 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::ufpt_event_state_t>(const morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::ufpt_event_state_t& x) |
---|
| 207 | { |
---|
| 208 | switch (x) |
---|
| 209 | { |
---|
| 210 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UFPT_EVENT_STATE_OK : return "UFPT_EVENT_STATE_OK" ; break; |
---|
| 211 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UFPT_EVENT_STATE_KO_FLUSH : return "UFPT_EVENT_STATE_KO_FLUSH" ; break; |
---|
| 212 | default : return ""; break; |
---|
| 213 | } |
---|
| 214 | }; |
---|
| 215 | |
---|
| 216 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::upt_event_state_t>(const morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::upt_event_state_t& x) |
---|
| 217 | { |
---|
| 218 | switch (x) |
---|
| 219 | { |
---|
| 220 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_OK : return "UPT_EVENT_STATE_OK" ; break; |
---|
| 221 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_MISS_WAIT_UFPT : return "UPT_EVENT_STATE_KO_MISS_WAIT_UFPT" ; break; |
---|
| 222 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_MISS_FLUSH_UPT : return "UPT_EVENT_STATE_KO_MISS_FLUSH_UPT" ; break; |
---|
| 223 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_EVENT_WAIT_UFPT : return "UPT_EVENT_STATE_KO_EVENT_WAIT_UFPT" ; break; |
---|
| 224 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_EVENT_FLUSH_UPT : return "UPT_EVENT_STATE_KO_EVENT_FLUSH_UPT" ; break; |
---|
| 225 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_DECODE_UPDATE_CONTEXT : return "UPT_EVENT_STATE_KO_DECODE_UPDATE_CONTEXT" ; break; |
---|
| 226 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_DECODE_WAIT_END_EVENT : return "UPT_EVENT_STATE_KO_DECODE_WAIT_END_EVENT" ; break; |
---|
| 227 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_COMMIT_UPDATE_CONTEXT : return "UPT_EVENT_STATE_KO_COMMIT_UPDATE_CONTEXT" ; break; |
---|
| 228 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_COMMIT_WAIT_END_EVENT : return "UPT_EVENT_STATE_KO_COMMIT_WAIT_END_EVENT" ; break; |
---|
[123] | 229 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPT_EVENT_STATE_KO_COMMIT_WAIT_END_UPDATE : return "UPT_EVENT_STATE_KO_COMMIT_WAIT_END_UPDATE" ; break; |
---|
[122] | 230 | default : return ""; break; |
---|
| 231 | } |
---|
| 232 | }; |
---|
| 233 | |
---|
[78] | 234 | }; // end namespace morpheo |
---|
| 235 | |
---|
| 236 | #endif |
---|