[59] | 1 | #ifndef morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Types_h |
---|
| 2 | #define morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Types_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Types.h 122 2009-06-03 08:15:51Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #include "Behavioural/include/Types.h" |
---|
| 12 | #include "Common/include/ToString.h" |
---|
| 13 | #include "Common/include/FromString.h" |
---|
| 14 | #include "Common/include/ErrorMorpheo.h" |
---|
[71] | 15 | #include <ostream> |
---|
[59] | 16 | |
---|
| 17 | namespace morpheo { |
---|
| 18 | namespace behavioural { |
---|
| 19 | namespace core { |
---|
| 20 | namespace multi_execute_loop { |
---|
| 21 | namespace execute_loop { |
---|
| 22 | namespace multi_execute_unit { |
---|
| 23 | namespace execute_unit { |
---|
| 24 | namespace load_store_unit { |
---|
| 25 | |
---|
[71] | 26 | #define DCACHE_REQ_IS_LOAD(x) (x<<1) |
---|
| 27 | #define DCACHE_REQ_IS_STORE(x) ((x<<1)|1) |
---|
| 28 | |
---|
| 29 | #define DCACHE_RSP_IS_LOAD(x) ((x&1)==0) |
---|
| 30 | #define DCACHE_RSP_IS_STORE(x) ((x&1)==1) |
---|
| 31 | |
---|
| 32 | |
---|
[59] | 33 | typedef enum |
---|
| 34 | { |
---|
[78] | 35 | NO_SPECULATIVE_LOAD //each load wait all previous store before the data cache access |
---|
| 36 | ,SPECULATIVE_LOAD_ACCESS //each load wait all previous store before the commiting |
---|
| 37 | ,SPECULATIVE_LOAD_COMMIT //each load commit the result before the end of dependence's check |
---|
| 38 | //,SPECULATIVE_LOAD_BYPASS //each load bypass the result before the end of dependence's check |
---|
[59] | 39 | } Tspeculative_load_t; |
---|
| 40 | |
---|
| 41 | typedef enum |
---|
| 42 | { |
---|
| 43 | SELECT_STORE_QUEUE, |
---|
| 44 | SELECT_LOAD_QUEUE , |
---|
| 45 | SELECT_LOAD_QUEUE_SPECULATIVE |
---|
| 46 | } Tselect_queue_t; |
---|
| 47 | |
---|
| 48 | // ---------------------------------------------------------- |
---|
| 49 | // Store Queue |
---|
| 50 | // ---------------------------------------------------------- |
---|
| 51 | |
---|
| 52 | typedef enum |
---|
| 53 | { |
---|
[71] | 54 | STORE_QUEUE_EMPTY //entry is empty |
---|
[59] | 55 | ,STORE_QUEUE_NO_VALID_NO_SPECULATIVE //entry is the top of rob, and operation isn't arrive |
---|
| 56 | ,STORE_QUEUE_VALID_SPECULATIVE //entry is arrive and wait the top of rob |
---|
| 57 | ,STORE_QUEUE_VALID_NO_SPECULATIVE //entry is ok, can be access at a dcache port. |
---|
| 58 | ,STORE_QUEUE_COMMIT //entry have access at dcache |
---|
| 59 | } Tstore_queue_state_t; |
---|
| 60 | |
---|
| 61 | class Tstore_queue_entry_t |
---|
| 62 | { |
---|
| 63 | public : Tstore_queue_state_t _state ; |
---|
| 64 | public : Tcontext_t _context_id ; |
---|
[71] | 65 | public : Tcontext_t _front_end_id ; |
---|
| 66 | public : Tcontext_t _ooo_engine_id ; |
---|
[59] | 67 | public : Tpacket_t _packet_id ; |
---|
[71] | 68 | public : Toperation_t _operation ; |
---|
[59] | 69 | public : Tlsq_ptr_t _load_queue_ptr_write; |
---|
[71] | 70 | public : Tdcache_address_t _address ; |
---|
[59] | 71 | public : Tgeneral_data_t _wdata ; |
---|
| 72 | //public : Tcontrol_t _write_rd ; |
---|
| 73 | //public : Tgeneral_address_t _num_reg_rd ; |
---|
| 74 | public : Texception_t _exception ; |
---|
[122] | 75 | public : bool _send_commit ; |
---|
[62] | 76 | |
---|
[71] | 77 | friend std::ostream & operator << (std::ostream& os, const Tstore_queue_entry_t & x) |
---|
[62] | 78 | { |
---|
[71] | 79 | return os << " * state : " << x._state << std::endl |
---|
| 80 | << " * packet : " << toString(x._packet_id) << std::endl |
---|
| 81 | << " * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl |
---|
| 82 | << " * operation : " << toString(x._operation) << std::endl |
---|
| 83 | << " * load_ptr : " << toString(x._load_queue_ptr_write) << std::endl |
---|
| 84 | << " * exception : " << toString(x._exception) << std::endl |
---|
| 85 | << std::hex |
---|
| 86 | << " * address : " << toString(x._address)<< std::endl |
---|
| 87 | << " * wdata : " << toString(x._wdata) << std::endl |
---|
| 88 | << std::dec; |
---|
[62] | 89 | } |
---|
[59] | 90 | }; |
---|
[62] | 91 | |
---|
| 92 | |
---|
[59] | 93 | |
---|
| 94 | // ---------------------------------------------------------- |
---|
| 95 | // Speculative_Access Queue |
---|
| 96 | // ---------------------------------------------------------- |
---|
| 97 | |
---|
| 98 | typedef enum |
---|
| 99 | { |
---|
| 100 | SPECULATIVE_ACCESS_QUEUE_EMPTY //entry is empty |
---|
| 101 | ,SPECULATIVE_ACCESS_QUEUE_WAIT_CACHE //entry is valid and can access at the dcache |
---|
| 102 | ,SPECULATIVE_ACCESS_QUEUE_WAIT_LOAD_QUEUE //entry wait an empty slot in load queue |
---|
| 103 | } Tspeculative_access_queue_state_t; |
---|
| 104 | |
---|
| 105 | class Tspeculative_access_queue_entry_t |
---|
| 106 | { |
---|
| 107 | public : Tspeculative_access_queue_state_t _state ; |
---|
| 108 | public : Tcontext_t _context_id ; |
---|
[71] | 109 | public : Tcontext_t _front_end_id ; |
---|
| 110 | public : Tcontext_t _ooo_engine_id ; |
---|
[59] | 111 | public : Tpacket_t _packet_id ; |
---|
[71] | 112 | public : Toperation_t _operation ; |
---|
[59] | 113 | public : Tlsq_ptr_t _load_queue_ptr_write ; |
---|
| 114 | public : Tlsq_ptr_t _store_queue_ptr_write; |
---|
[122] | 115 | public : Tlsq_ptr_t _store_queue_ptr_read ; |
---|
| 116 | public : Tcontrol_t _store_queue_empty ; |
---|
[59] | 117 | public : Tdcache_address_t _address ; |
---|
| 118 | public : Tcontrol_t _write_rd ; |
---|
| 119 | public : Tgeneral_address_t _num_reg_rd ; |
---|
| 120 | public : Texception_t _exception ; |
---|
[71] | 121 | |
---|
| 122 | friend std::ostream & operator << (std::ostream& os, const Tspeculative_access_queue_entry_t & x) |
---|
| 123 | { |
---|
| 124 | return os << " * state : " << x._state << std::endl |
---|
| 125 | << " * packet : " << toString(x._packet_id) << std::endl |
---|
| 126 | << " * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl |
---|
| 127 | << " * operation : " << toString(x._operation) << std::endl |
---|
[122] | 128 | << " * load, store ptr_(write/read) empty: " << toString(x._load_queue_ptr_write) << " - " << toString(x._store_queue_ptr_write) << " - " << toString(x._store_queue_ptr_read) << " - " << toString(x._store_queue_empty) << std::endl |
---|
[71] | 129 | << " * exception : " << toString(x._exception) << std::endl |
---|
| 130 | << std::hex |
---|
| 131 | << " * address : " << toString(x._address)<< std::endl |
---|
| 132 | << std::dec |
---|
| 133 | << " * write_rd, num_reg_rd : " << toString(x._write_rd) << " - " << toString(x._num_reg_rd)<< std::endl; |
---|
| 134 | } |
---|
[59] | 135 | }; |
---|
| 136 | |
---|
| 137 | // ---------------------------------------------------------- |
---|
| 138 | // Load Queue |
---|
| 139 | // ---------------------------------------------------------- |
---|
| 140 | |
---|
[119] | 141 | // HAVE_DCACHE_RSP MUST_CHECK DECOD_BARRIER |
---|
[71] | 142 | // OPERATION_MEMORY_LOAD X X - |
---|
| 143 | // OPERATION_MEMORY_LOCK - - - |
---|
[119] | 144 | // OPERATION_MEMORY_INVALIDATE - - X (mtspr) |
---|
[71] | 145 | // OPERATION_MEMORY_PREFETCH - - - |
---|
[119] | 146 | // OPERATION_MEMORY_FLUSH - - X (mtspr) |
---|
| 147 | // OPERATION_MEMORY_SYNCHRONIZATION X - X (msync, psync, csync) |
---|
[71] | 148 | |
---|
| 149 | #define have_dcache_rsp(x) (is_operation_memory_load(x) or (x==OPERATION_MEMORY_SYNCHRONIZATION)) |
---|
| 150 | #define must_check(x) (is_operation_memory_load(x)) |
---|
| 151 | |
---|
[59] | 152 | typedef enum |
---|
| 153 | { |
---|
| 154 | LOAD_QUEUE_EMPTY //entry is empty |
---|
| 155 | ,LOAD_QUEUE_WAIT_CHECK //entry must wait the respons and check dependence with store |
---|
| 156 | ,LOAD_QUEUE_WAIT //entry must wait the respons |
---|
| 157 | ,LOAD_QUEUE_COMMIT_CHECK //entry must check dependence and can commit speculative |
---|
| 158 | ,LOAD_QUEUE_CHECK //entry must check dependence with store |
---|
| 159 | ,LOAD_QUEUE_COMMIT //entry must commit the instruction |
---|
| 160 | } Tload_queue_state_t; |
---|
| 161 | |
---|
| 162 | class Tload_queue_entry_t |
---|
| 163 | { |
---|
[71] | 164 | public : Tload_queue_state_t _state ; |
---|
| 165 | public : Tcontext_t _context_id ; |
---|
| 166 | public : Tcontext_t _front_end_id ; |
---|
| 167 | public : Tcontext_t _ooo_engine_id ; |
---|
| 168 | public : Tpacket_t _packet_id ; |
---|
| 169 | public : Toperation_t _operation ; |
---|
[59] | 170 | public : Tlsq_ptr_t _store_queue_ptr_write; |
---|
[122] | 171 | public : Tlsq_ptr_t _store_queue_ptr_read ; |
---|
| 172 | public : Tcontrol_t _store_queue_empty ; |
---|
[71] | 173 | public : Tdcache_address_t _address ; |
---|
| 174 | public : Tdcache_address_t _check_hit_byte ; |
---|
| 175 | public : Tcontrol_t _check_hit ; |
---|
| 176 | public : Tdcache_address_t _shift ; |
---|
| 177 | public : Tcontrol_t _is_load_signed ; |
---|
| 178 | public : Taccess_t _access_size ; |
---|
| 179 | public : Tgeneral_data_t _rdata ; |
---|
| 180 | public : Tcontrol_t _write_rd ; |
---|
| 181 | public : Tgeneral_address_t _num_reg_rd ; |
---|
| 182 | public : Texception_t _exception ; |
---|
| 183 | |
---|
| 184 | friend std::ostream & operator << (std::ostream& os, const Tload_queue_entry_t & x) |
---|
| 185 | { |
---|
| 186 | return os << " * state : " << x._state << std::endl |
---|
| 187 | << " * packet : " << toString(x._packet_id) << std::endl |
---|
| 188 | << " * context, front_end, ooo_engine_id : " << toString(x._context_id) << " - " << toString(x._front_end_id) << " - " << toString(x._ooo_engine_id) << std::endl |
---|
| 189 | << " * operation : " << toString(x._operation) << std::endl |
---|
[122] | 190 | << " * store_queue ptr_(write,read) empty: " << toString(x._store_queue_ptr_write) << " - " << toString(x._store_queue_ptr_read) << " - " << toString(x._store_queue_empty) <<std::endl |
---|
[71] | 191 | << " * exception : " << toString(x._exception) << std::endl |
---|
| 192 | << " * check_hit, check_hit_byte : " << toString(x._check_hit) << " - " << toString(x._check_hit_byte) << std::endl |
---|
| 193 | << std::hex |
---|
| 194 | << " * address : " << toString(x._address)<< std::endl |
---|
| 195 | << " * rdata : " << toString(x._rdata) << std::endl |
---|
| 196 | << std::dec |
---|
| 197 | << " * write_rd, num_reg_rd : " << toString(x._write_rd) << " - " << toString(x._num_reg_rd)<< std::endl; |
---|
| 198 | } |
---|
| 199 | |
---|
[59] | 200 | }; |
---|
| 201 | |
---|
| 202 | }; // end namespace load_store_unit |
---|
| 203 | }; // end namespace execute_unit |
---|
| 204 | }; // end namespace multi_execute_unit |
---|
| 205 | }; // end namespace execute_loop |
---|
| 206 | }; // end namespace multi_execute_loop |
---|
| 207 | }; // end namespace core |
---|
| 208 | }; // end namespace behavioural |
---|
| 209 | |
---|
| 210 | template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t& x) |
---|
| 211 | { |
---|
| 212 | switch (x) |
---|
| 213 | { |
---|
| 214 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD : return "no_speculative_load" ; break; |
---|
| 215 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS : return "speculative_load_access"; break; |
---|
| 216 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT : return "speculative_load_commit"; break; |
---|
[78] | 217 | // case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS : return "speculative_load_bypass"; break; |
---|
[59] | 218 | default : return "" ; break; |
---|
| 219 | } |
---|
| 220 | }; |
---|
| 221 | |
---|
| 222 | template<> inline morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t fromString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_load_t>(const std::string& x) |
---|
| 223 | { |
---|
[111] | 224 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD ))) == 0) or |
---|
[59] | 225 | (x.compare("no_speculative_load") == 0)) |
---|
| 226 | return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::NO_SPECULATIVE_LOAD; |
---|
[111] | 227 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS))) == 0) or |
---|
[59] | 228 | (x.compare("speculative_load_access") == 0)) |
---|
| 229 | return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_ACCESS; |
---|
[111] | 230 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT))) == 0) or |
---|
[59] | 231 | (x.compare("speculative_load_commit") == 0)) |
---|
| 232 | return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_COMMIT; |
---|
[111] | 233 | // if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS)))) or |
---|
[78] | 234 | // (x.compare("speculative_load_bypass") == 0)) |
---|
| 235 | // return morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_LOAD_BYPASS; |
---|
[59] | 236 | |
---|
| 237 | throw (ErrorMorpheo ("<fromString> : Unknow string : \""+x+"\"")); |
---|
| 238 | }; |
---|
| 239 | |
---|
[97] | 240 | |
---|
| 241 | template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tstore_queue_state_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tstore_queue_state_t& x) |
---|
| 242 | { |
---|
| 243 | switch (x) |
---|
| 244 | { |
---|
| 245 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_EMPTY : return "empty" ; break; |
---|
| 246 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_NO_VALID_NO_SPECULATIVE : return "no_valid_no_speculative"; break; |
---|
| 247 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_VALID_SPECULATIVE : return "valid_speculative" ; break; |
---|
| 248 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_VALID_NO_SPECULATIVE : return "valid_no_speculative" ; break; |
---|
| 249 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::STORE_QUEUE_COMMIT : return "commit" ; break; |
---|
| 250 | default : return "" ; break; |
---|
| 251 | } |
---|
| 252 | }; |
---|
| 253 | |
---|
| 254 | template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_access_queue_state_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tspeculative_access_queue_state_t& x) |
---|
| 255 | { |
---|
| 256 | switch (x) |
---|
| 257 | { |
---|
| 258 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_EMPTY : return "empty" ; break; |
---|
| 259 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_WAIT_CACHE : return "wait_cache" ; break; |
---|
| 260 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::SPECULATIVE_ACCESS_QUEUE_WAIT_LOAD_QUEUE : return "wait_load_queue"; break; |
---|
| 261 | default : return "" ; break; |
---|
| 262 | } |
---|
| 263 | }; |
---|
| 264 | |
---|
| 265 | template<> inline std::string toString<morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tload_queue_state_t>(const morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Tload_queue_state_t& x) |
---|
| 266 | { |
---|
| 267 | switch (x) |
---|
| 268 | { |
---|
| 269 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_EMPTY : return "empty" ; break; |
---|
| 270 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_WAIT_CHECK : return "wait_check" ; break; |
---|
| 271 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_WAIT : return "wait" ; break; |
---|
| 272 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_COMMIT_CHECK : return "commit_check"; break; |
---|
| 273 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_CHECK : return "check" ; break; |
---|
| 274 | case morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::LOAD_QUEUE_COMMIT : return "commit" ; break; |
---|
| 275 | default : return "" ; break; |
---|
| 276 | } |
---|
| 277 | }; |
---|
| 278 | |
---|
[59] | 279 | }; // end namespace morpheo |
---|
| 280 | |
---|
| 281 | #endif |
---|