[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 105 2009-02-05 11:18:31Z 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 | { |
---|
[105] | 23 | EVENT_STATE_OK , // Can predict |
---|
| 24 | EVENT_STATE_MISS_FLUSH_UFPT , // in decod stage, detect a miss , continue to execute but flush ufpt |
---|
| 25 | EVENT_STATE_MISS_FLUSH_UFPT_AND_UPT , // in commit stage, detect a miss , stop context and flush ufpt and upt |
---|
| 26 | EVENT_STATE_MISS_FLUSH_UPT , // in commit stage, detect a miss , context is stop and ufpt is flush, update RAS |
---|
| 27 | EVENT_STATE_EVENT_FLUSH_UFPT , // in commit stage, detect an event, continue to execute but flush ufpt |
---|
| 28 | EVENT_STATE_EVENT_FLUSH_UFPT_AND_UPT, // in commit stage, detect an event, stop context and flush ufpt and upt |
---|
| 29 | EVENT_STATE_EVENT_FLUSH_UPT , // in commit stage, detect an event, context is stop and ufpt is flush, update RAS |
---|
| 30 | EVENT_STATE_UPDATE_CONTEXT , // prediction unit is update, send signal to context manager |
---|
| 31 | EVENT_STATE_WAIT_END_EVENT // prediction unit is ok, wait the end of event (send by Context State) |
---|
[88] | 32 | } event_state_t; |
---|
[78] | 33 | |
---|
[88] | 34 | typedef enum |
---|
| 35 | { |
---|
| 36 | UPDATE_FETCH_PREDICTION_STATE_EMPTY , // Slot is empty |
---|
| 37 | UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD , // Have make a prediction, wait decod |
---|
| 38 | UPDATE_FETCH_PREDICTION_STATE_EVENT , // previous branch is a miss prediction |
---|
| 39 | UPDATE_FETCH_PREDICTION_STATE_END // branch is updated |
---|
| 40 | } ufpt_state_t; |
---|
| 41 | |
---|
| 42 | typedef enum |
---|
| 43 | { |
---|
| 44 | UPDATE_PREDICTION_STATE_EMPTY , // Slot is empty |
---|
| 45 | UPDATE_PREDICTION_STATE_WAIT_END , // Have make a prediction, wait branch_complete |
---|
| 46 | UPDATE_PREDICTION_STATE_OK , // this branch is a hit prediction |
---|
| 47 | UPDATE_PREDICTION_STATE_KO , // this branch is a miss prediction |
---|
| 48 | UPDATE_PREDICTION_STATE_EVENT , // previous branch is a miss prediction |
---|
[95] | 49 | UPDATE_PREDICTION_STATE_END_OK , // branch is updated, update pointer |
---|
[101] | 50 | UPDATE_PREDICTION_STATE_END_KO_WAIT_END , // branch is updated, don't update pointer |
---|
[95] | 51 | UPDATE_PREDICTION_STATE_END_KO // branch is updated, don't update pointer |
---|
[88] | 52 | } upt_state_t; |
---|
| 53 | |
---|
| 54 | class ufpt_entry_t |
---|
[81] | 55 | { |
---|
[88] | 56 | public : ufpt_state_t _state ; |
---|
| 57 | public : Tbranch_condition_t _condition ; |
---|
| 58 | public : Taddress_t _address_src ; |
---|
| 59 | public : Taddress_t _address_dest ; |
---|
| 60 | public : Tcontrol_t _last_take ; |
---|
| 61 | //public : Tcontrol_t _good_take ; |
---|
| 62 | public : Tcontrol_t _is_accurate ; |
---|
| 63 | public : Thistory_t _history ; |
---|
| 64 | public : Taddress_t _address_ras ; |
---|
| 65 | public : Tptr_t _index_ras ; |
---|
| 66 | //public : Tcontrol_t _ifetch_prediction; |
---|
[81] | 67 | }; |
---|
| 68 | |
---|
[88] | 69 | class upt_entry_t |
---|
| 70 | { |
---|
| 71 | public : upt_state_t _state ; |
---|
| 72 | public : Tbranch_condition_t _condition ; |
---|
| 73 | public : Taddress_t _address_src ; |
---|
| 74 | public : Taddress_t _address_dest ; |
---|
| 75 | public : Tcontrol_t _last_take ; |
---|
| 76 | public : Tcontrol_t _good_take ; // not in ufpt |
---|
| 77 | public : Tcontrol_t _is_accurate ; |
---|
| 78 | public : Thistory_t _history ; |
---|
| 79 | public : Taddress_t _address_ras ; |
---|
| 80 | public : Tptr_t _index_ras ; |
---|
| 81 | public : Tcontrol_t _ifetch_prediction; // not in ufpt |
---|
| 82 | }; |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | // BRANCH_CONDITION_NONE_WITHOUT_WRITE_STACK |
---|
| 86 | // BRANCH_CONDITION_NONE_WITH_WRITE_STACK |
---|
| 87 | // BRANCH_CONDITION_FLAG_UNSET |
---|
| 88 | // BRANCH_CONDITION_FLAG_SET |
---|
| 89 | // BRANCH_CONDITION_READ_REGISTER_WITHOUT_WRITE_STACK |
---|
| 90 | // BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK |
---|
| 91 | // BRANCH_CONDITION_READ_STACK |
---|
| 92 | |
---|
| 93 | |
---|
| 94 | #define update_btb(cond) true |
---|
| 95 | |
---|
| 96 | #define update_dir(cond) ((cond == BRANCH_CONDITION_FLAG_UNSET) or \ |
---|
| 97 | (cond == BRANCH_CONDITION_FLAG_SET)) |
---|
| 98 | |
---|
| 99 | #define update_ras(cond) ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK ) or \ |
---|
| 100 | (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK) or \ |
---|
| 101 | (cond == BRANCH_CONDITION_READ_STACK )) |
---|
| 102 | |
---|
| 103 | #define push_ras(cond) ((cond == BRANCH_CONDITION_NONE_WITH_WRITE_STACK ) or \ |
---|
| 104 | (cond == BRANCH_CONDITION_READ_REGISTER_WITH_WRITE_STACK)) |
---|
| 105 | |
---|
| 106 | #define pop_ras(cond) ((cond == BRANCH_CONDITION_READ_STACK )) |
---|
| 107 | |
---|
| 108 | #define need_update(cond) update_ras(cond) |
---|
| 109 | |
---|
[78] | 110 | }; // end namespace update_prediction_table |
---|
| 111 | }; // end namespace prediction_unit |
---|
| 112 | }; // end namespace front_end |
---|
| 113 | }; // end namespace multi_front_end |
---|
| 114 | }; // end namespace core |
---|
[81] | 115 | }; // end namespace behavioural |
---|
| 116 | |
---|
[88] | 117 | 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) |
---|
| 118 | { |
---|
| 119 | switch (x) |
---|
| 120 | { |
---|
[105] | 121 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_OK : return "ok" ; break; |
---|
| 122 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_MISS_FLUSH_UFPT : return "miss_flush_ufpt" ; break; |
---|
| 123 | 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; |
---|
| 124 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_MISS_FLUSH_UPT : return "miss_flush_upt" ; break; |
---|
| 125 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_EVENT_FLUSH_UPT : return "event_flush_upt" ; break; |
---|
| 126 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_EVENT_FLUSH_UFPT : return "event_flush_ufpt" ; break; |
---|
| 127 | 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; |
---|
| 128 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_UPDATE_CONTEXT : return "update_context" ; break; |
---|
| 129 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::EVENT_STATE_WAIT_END_EVENT : return "wait_and_event" ; break; |
---|
| 130 | default : return ""; break; |
---|
[88] | 131 | } |
---|
| 132 | }; |
---|
[78] | 133 | |
---|
[88] | 134 | 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] | 135 | { |
---|
| 136 | switch (x) |
---|
| 137 | { |
---|
[88] | 138 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_EMPTY : return "empty" ; break; |
---|
| 139 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_WAIT_DECOD : return "wait_decod"; break; |
---|
| 140 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_EVENT : return "event" ; break; |
---|
| 141 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_FETCH_PREDICTION_STATE_END : return "end" ; break; |
---|
| 142 | default : return "" ; break; |
---|
| 143 | } |
---|
| 144 | }; |
---|
| 145 | |
---|
| 146 | 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) |
---|
| 147 | { |
---|
| 148 | switch (x) |
---|
| 149 | { |
---|
[81] | 150 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_EMPTY : return "empty" ; break; |
---|
[88] | 151 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_WAIT_END : return "wait_end" ; break; |
---|
[81] | 152 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_OK : return "ok" ; break; |
---|
| 153 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_KO : return "ko" ; break; |
---|
[88] | 154 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_EVENT : return "event" ; break; |
---|
[95] | 155 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END_OK : return "end_ok" ; break; |
---|
[101] | 156 | 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] | 157 | case morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::update_prediction_table::UPDATE_PREDICTION_STATE_END_KO : return "end_ko" ; break; |
---|
[81] | 158 | default : return "" ; break; |
---|
| 159 | } |
---|
| 160 | }; |
---|
| 161 | |
---|
[78] | 162 | }; // end namespace morpheo |
---|
| 163 | |
---|
| 164 | #endif |
---|