[78] | 1 | #ifndef morpheo_behavioural_core_multi_front_end_front_end_ifetch_unit_ifetch_queue_Types_h |
---|
| 2 | #define morpheo_behavioural_core_multi_front_end_front_end_ifetch_unit_ifetch_queue_Types_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Types.h 136 2009-10-20 18:52:15Z 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 ifetch_unit { |
---|
| 19 | namespace ifetch_queue { |
---|
| 20 | |
---|
[136] | 21 | typedef enum |
---|
| 22 | { |
---|
| 23 | IFETCH_QUEUE_SCHEME_NO_ASSOC // Read only head |
---|
| 24 | ,IFETCH_QUEUE_SCHEME_FULL_ASSOC // Scan all slot |
---|
| 25 | } Tifetch_queue_scheme_t; |
---|
| 26 | |
---|
[78] | 27 | typedef enum |
---|
| 28 | { |
---|
| 29 | IFETCH_QUEUE_STATE_EMPTY , // slot is empty |
---|
[101] | 30 | // IFETCH_QUEUE_STATE_WAIT_REQ , // slot is allocated - wait request to cache |
---|
[78] | 31 | IFETCH_QUEUE_STATE_WAIT_RSP , // slot have send a request - wait respons from cache |
---|
| 32 | IFETCH_QUEUE_STATE_HAVE_RSP , // slot have a bloc of instruction - wait accept by decod |
---|
| 33 | IFETCH_QUEUE_STATE_ERROR_WAIT_RSP // A event occure -> flush the queue but, ack rsp |
---|
| 34 | } ifetch_queue_state_t; |
---|
| 35 | |
---|
[135] | 36 | #define IFETCH_QUEUE_STATE_SIZE 2 |
---|
| 37 | |
---|
[78] | 38 | class ifetch_queue_entry_t |
---|
| 39 | { |
---|
| 40 | public : ifetch_queue_state_t _state ; |
---|
| 41 | public : Tinstruction_t * _instruction ; |
---|
| 42 | public : Tcontrol_t * _instruction_enable ; |
---|
| 43 | public : Tgeneral_address_t _address ; |
---|
| 44 | public : Tinst_ifetch_ptr_t _inst_ifetch_ptr ; |
---|
| 45 | public : Tbranch_state_t _branch_state ; |
---|
| 46 | public : Tprediction_ptr_t _branch_update_prediction_id; |
---|
| 47 | public : Texception_t _exception ; |
---|
| 48 | |
---|
| 49 | public : ifetch_queue_entry_t (uint32_t nb_instruction) |
---|
| 50 | { |
---|
| 51 | _instruction = new Tinstruction_t [nb_instruction]; |
---|
| 52 | _instruction_enable = new Tcontrol_t [nb_instruction]; |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | public : ~ifetch_queue_entry_t (void) |
---|
| 56 | { |
---|
[128] | 57 | delete [] _instruction ; |
---|
| 58 | delete [] _instruction_enable; |
---|
[78] | 59 | } |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | }; // end namespace ifetch_queue |
---|
| 63 | }; // end namespace ifetch_unit |
---|
| 64 | }; // end namespace front_end |
---|
| 65 | }; // end namespace multi_front_end |
---|
| 66 | }; // end namespace core |
---|
| 67 | }; // end namespace behavioural |
---|
[136] | 68 | |
---|
| 69 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::Tifetch_queue_scheme_t>(const morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::Tifetch_queue_scheme_t& x) |
---|
| 70 | { |
---|
| 71 | switch (x) |
---|
| 72 | { |
---|
| 73 | case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_SCHEME_NO_ASSOC : return "no_assoc" ; break; |
---|
| 74 | case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_SCHEME_FULL_ASSOC : return "full_assoc"; break; |
---|
| 75 | default : return ""; break; |
---|
| 76 | } |
---|
| 77 | }; |
---|
| 78 | |
---|
| 79 | template<> inline morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::Tifetch_queue_scheme_t fromString<morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::Tifetch_queue_scheme_t>(const std::string& x) |
---|
| 80 | { |
---|
| 81 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_SCHEME_NO_ASSOC ))) == 0) or |
---|
| 82 | (x.compare("no_assoc") == 0)) |
---|
| 83 | return morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_SCHEME_NO_ASSOC; |
---|
| 84 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_SCHEME_FULL_ASSOC))) == 0) or |
---|
| 85 | (x.compare("full_assoc") == 0)) |
---|
| 86 | return morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_SCHEME_FULL_ASSOC; |
---|
| 87 | |
---|
| 88 | throw (ErrorMorpheo ("<fromString> : Unknow string : \""+x+"\"")); |
---|
| 89 | }; |
---|
[85] | 90 | |
---|
| 91 | template<> inline std::string toString<morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::ifetch_queue_state_t>(const morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::ifetch_queue_state_t& x) |
---|
| 92 | { |
---|
| 93 | switch (x) |
---|
| 94 | { |
---|
| 95 | case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_STATE_EMPTY : return "empty" ; break; |
---|
| 96 | // case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_STATE_WAIT_REQ : return "wait_req" ; break; |
---|
| 97 | case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_STATE_WAIT_RSP : return "wait_rsp" ; break; |
---|
| 98 | case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_STATE_HAVE_RSP : return "have_rsp" ; break; |
---|
| 99 | case morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::ifetch_queue::IFETCH_QUEUE_STATE_ERROR_WAIT_RSP : return "error_wait_rsp"; break; |
---|
| 100 | default : return "" ; break; |
---|
| 101 | } |
---|
| 102 | }; |
---|
| 103 | |
---|
| 104 | |
---|
[78] | 105 | }; // end namespace morpheo |
---|
| 106 | #endif |
---|