[59] | 1 | #ifndef morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Load_store_unit_h |
---|
| 2 | #define morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_execute_unit_execute_unit_load_store_unit_Load_store_unit_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id$ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #ifdef SYSTEMC |
---|
| 12 | #include "systemc.h" |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | #define HAVE_MEMORY_OUT_OPERATION |
---|
| 16 | #define HAVE_MEMORY_OUT_TYPE |
---|
| 17 | |
---|
| 18 | #include <iostream> |
---|
| 19 | #include "Common/include/ToString.h" |
---|
| 20 | #include "Common/include/Debug.h" |
---|
| 21 | |
---|
| 22 | #include "Behavioural/Generic/Queue_Control/include/Queue_Control.h" |
---|
| 23 | |
---|
| 24 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Types.h" |
---|
| 25 | #include "Behavioural/Generic/Queue_Control/include/Queue_Control.h" |
---|
| 26 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Parameters.h" |
---|
| 27 | #ifdef STATISTICS |
---|
| 28 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/include/Statistics.h" |
---|
| 29 | #endif |
---|
| 30 | #include "Behavioural/include/Component.h" |
---|
| 31 | #ifdef VHDL |
---|
| 32 | #include "Behavioural/include/Vhdl.h" |
---|
| 33 | #endif |
---|
| 34 | |
---|
| 35 | using namespace std; |
---|
| 36 | using namespace morpheo::behavioural::generic::queue_control; |
---|
| 37 | |
---|
| 38 | namespace morpheo { |
---|
| 39 | namespace behavioural { |
---|
| 40 | namespace core { |
---|
| 41 | namespace multi_execute_loop { |
---|
| 42 | namespace execute_loop { |
---|
| 43 | namespace multi_execute_unit { |
---|
| 44 | namespace execute_unit { |
---|
| 45 | namespace load_store_unit { |
---|
| 46 | |
---|
| 47 | |
---|
| 48 | class Load_store_unit |
---|
| 49 | #if SYSTEMC |
---|
| 50 | : public sc_module |
---|
| 51 | #endif |
---|
| 52 | { |
---|
| 53 | // -----[ fields ]---------------------------------------------------- |
---|
| 54 | // Parameters |
---|
| 55 | protected : const string _name; |
---|
| 56 | |
---|
| 57 | protected : const Parameters * _param; |
---|
| 58 | //#ifdef STATISTICS |
---|
| 59 | // protected : const morpheo::behavioural::Parameters_Statistics * _param_statistics; |
---|
| 60 | //#endif |
---|
| 61 | |
---|
| 62 | #ifdef STATISTICS |
---|
| 63 | private : Statistics * _stat; |
---|
| 64 | #endif |
---|
| 65 | |
---|
| 66 | public : Component * _component; |
---|
| 67 | private : Interfaces * _interfaces; |
---|
| 68 | |
---|
| 69 | #ifdef SYSTEMC |
---|
| 70 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 71 | // Interface |
---|
| 72 | public : SC_CLOCK * in_CLOCK ; |
---|
| 73 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
| 74 | |
---|
| 75 | // ~~~~~[ Interface "memory_in" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 76 | public : SC_IN (Tcontrol_t ) * in_MEMORY_IN_VAL ; |
---|
| 77 | public : SC_OUT(Tcontrol_t ) * out_MEMORY_IN_ACK ; |
---|
| 78 | public : SC_IN (Tcontext_t ) * in_MEMORY_IN_CONTEXT_ID ; |
---|
| 79 | public : SC_IN (Tpacket_t ) * in_MEMORY_IN_PACKET_ID ; |
---|
| 80 | public : SC_IN (Toperation_t ) * in_MEMORY_IN_OPERATION ; |
---|
| 81 | #ifdef HAVE_MEMORY_OUT_TYPE |
---|
| 82 | public : SC_IN (Ttype_t ) * in_MEMORY_IN_TYPE ; |
---|
| 83 | #endif |
---|
| 84 | public : SC_IN (Tlsq_ptr_t ) * in_MEMORY_IN_STORE_QUEUE_PTR_WRITE; |
---|
| 85 | public : SC_IN (Tlsq_ptr_t ) * in_MEMORY_IN_LOAD_QUEUE_PTR_WRITE; |
---|
| 86 | //public : SC_IN (Tcontrol_t ) * in_MEMORY_IN_HAS_IMMEDIAT; |
---|
| 87 | public : SC_IN (Tgeneral_data_t ) * in_MEMORY_IN_IMMEDIAT ; // memory address |
---|
| 88 | public : SC_IN (Tgeneral_data_t ) * in_MEMORY_IN_DATA_RA ; // memory address |
---|
| 89 | public : SC_IN (Tgeneral_data_t ) * in_MEMORY_IN_DATA_RB ; // data (store) |
---|
| 90 | //public : SC_IN (Tspecial_data_t ) * in_MEMORY_IN_DATA_RC ; |
---|
| 91 | public : SC_IN (Tcontrol_t ) * in_MEMORY_IN_WRITE_RD ; // = (operation==load) |
---|
| 92 | public : SC_IN (Tgeneral_address_t) * in_MEMORY_IN_NUM_REG_RD ; // destination (load) |
---|
| 93 | //public : SC_IN (Tcontrol_t ) * in_MEMORY_IN_WRITE_RE ; |
---|
| 94 | //public : SC_IN (Tspecial_address_t) * in_MEMORY_IN_NUM_REG_RE ; |
---|
| 95 | |
---|
| 96 | // ~~~~~[ Interface "memory_out" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 97 | public : SC_OUT(Tcontrol_t ) * out_MEMORY_OUT_VAL ; |
---|
| 98 | public : SC_IN (Tcontrol_t ) * in_MEMORY_OUT_ACK ; |
---|
| 99 | public : SC_OUT(Tcontext_t ) * out_MEMORY_OUT_CONTEXT_ID; |
---|
| 100 | public : SC_OUT(Tpacket_t ) * out_MEMORY_OUT_PACKET_ID ; |
---|
| 101 | #ifdef HAVE_MEMORY_OUT_OPERATION |
---|
| 102 | public : SC_OUT(Toperation_t ) * out_MEMORY_OUT_OPERATION ; |
---|
| 103 | #endif |
---|
| 104 | #ifdef HAVE_MEMORY_OUT_TYPE |
---|
| 105 | public : SC_OUT(Ttype_t ) * out_MEMORY_OUT_TYPE ; |
---|
| 106 | #endif |
---|
| 107 | public : SC_OUT(Tcontrol_t ) * out_MEMORY_OUT_WRITE_RD ; // = (operation==load) |
---|
| 108 | public : SC_OUT(Tgeneral_address_t) * out_MEMORY_OUT_NUM_REG_RD; // destination (load) |
---|
| 109 | public : SC_OUT(Tgeneral_data_t ) * out_MEMORY_OUT_DATA_RD ; // data (load) |
---|
| 110 | //public : SC_OUT(Tcontrol_t ) * out_MEMORY_OUT_WRITE_RE ; |
---|
| 111 | //public : SC_OUT(Tspecial_address_t) * out_MEMORY_OUT_NUM_REG_RE; |
---|
| 112 | //public : SC_OUT(Tspecial_data_t ) * out_MEMORY_OUT_DATA_RE ; |
---|
| 113 | public : SC_OUT(Texception_t ) * out_MEMORY_OUT_EXCEPTION ; |
---|
| 114 | |
---|
| 115 | // ~~~~~[ Interface "dcache_req" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 116 | public : SC_OUT(Tcontrol_t ) * out_DCACHE_REQ_VAL ; |
---|
| 117 | public : SC_IN (Tcontrol_t ) * in_DCACHE_REQ_ACK ; |
---|
| 118 | public : SC_OUT(Tcontext_t ) * out_DCACHE_REQ_CONTEXT_ID; |
---|
| 119 | public : SC_OUT(Tpacket_t ) * out_DCACHE_REQ_PACKET_ID ; |
---|
| 120 | public : SC_OUT(Tdcache_address_t ) * out_DCACHE_REQ_ADDRESS ; |
---|
| 121 | public : SC_OUT(Tdcache_type_t ) * out_DCACHE_REQ_TYPE ; |
---|
| 122 | public : SC_OUT(Tcontrol_t ) * out_DCACHE_REQ_UNCACHED ; |
---|
| 123 | public : SC_OUT(Tdcache_data_t ) * out_DCACHE_REQ_WDATA ; |
---|
| 124 | |
---|
| 125 | // ~~~~~[ Interface "dcache_rsp" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 126 | public : SC_IN (Tcontrol_t ) * in_DCACHE_RSP_VAL ; |
---|
| 127 | public : SC_OUT(Tcontrol_t ) * out_DCACHE_RSP_ACK ; |
---|
| 128 | public : SC_IN (Tcontext_t ) * in_DCACHE_RSP_CONTEXT_ID; |
---|
| 129 | public : SC_IN (Tpacket_t ) * in_DCACHE_RSP_PACKET_ID ; |
---|
| 130 | public : SC_IN (Tdcache_data_t ) * in_DCACHE_RSP_RDATA ; |
---|
| 131 | public : SC_IN (Tdcache_error_t ) * in_DCACHE_RSP_ERROR ; |
---|
| 132 | |
---|
| 133 | // ~~~~~[ Interface "bypass_memory" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 134 | public : SC_OUT(Tcontrol_t ) ** out_BYPASS_MEMORY_VAL ; |
---|
| 135 | public : SC_OUT(Tcontext_t ) ** out_BYPASS_MEMORY_CONTEXT_ID; |
---|
| 136 | public : SC_OUT(Tgeneral_address_t) ** out_BYPASS_MEMORY_NUM_REG ; |
---|
| 137 | public : SC_OUT(Tgeneral_data_t ) ** out_BYPASS_MEMORY_DATA ; |
---|
| 138 | |
---|
| 139 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 140 | protected : Tstore_queue_entry_t * _store_queue; |
---|
| 141 | protected : Tload_queue_entry_t * _load_queue; |
---|
| 142 | protected : Tspeculative_access_queue_entry_t * _speculative_access_queue; |
---|
| 143 | protected : morpheo::behavioural::generic::queue_control::Queue_Control * _speculative_access_queue_control; |
---|
| 144 | |
---|
| 145 | // function pointer |
---|
| 146 | public : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_transition ) (void); |
---|
| 147 | public : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMoore ) (void); |
---|
| 148 | public : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMealy_dcache) (void); |
---|
| 149 | public : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMealy_insert) (void); |
---|
| 150 | public : void (morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Load_store_unit::*function_genMealy_retire) (void); |
---|
| 151 | |
---|
| 152 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 153 | |
---|
| 154 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 155 | |
---|
| 156 | public : Tlsq_ptr_t internal_MEMORY_STORE_QUEUE_PTR_READ; |
---|
| 157 | public : Tlsq_ptr_t internal_MEMORY_LOAD_QUEUE_PTR_READ; |
---|
| 158 | |
---|
| 159 | private : Tcontrol_t internal_MEMORY_IN_ACK; |
---|
| 160 | private : Tcontrol_t internal_MEMORY_OUT_VAL; |
---|
| 161 | private : Tselect_queue_t internal_MEMORY_OUT_SELECT_QUEUE; |
---|
| 162 | #endif |
---|
| 163 | |
---|
| 164 | // -----[ methods ]--------------------------------------------------- |
---|
| 165 | |
---|
| 166 | #ifdef SYSTEMC |
---|
| 167 | SC_HAS_PROCESS (Load_store_unit); |
---|
| 168 | #endif |
---|
| 169 | public : Load_store_unit |
---|
| 170 | ( |
---|
| 171 | #ifdef SYSTEMC |
---|
| 172 | sc_module_name name, |
---|
| 173 | #else |
---|
| 174 | string name, |
---|
| 175 | #endif |
---|
| 176 | #ifdef STATISTICS |
---|
| 177 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 178 | #endif |
---|
| 179 | Parameters * param ); |
---|
| 180 | public : ~Load_store_unit (void); |
---|
| 181 | |
---|
| 182 | #ifdef SYSTEMC |
---|
| 183 | private : void allocation (void); |
---|
| 184 | private : void deallocation (void); |
---|
| 185 | |
---|
| 186 | public : void transition (void); |
---|
| 187 | public : void genMoore (void); |
---|
| 188 | public : void genMealy_dcache (void); |
---|
| 189 | public : void genMealy_insert (void); |
---|
| 190 | public : void genMealy_retire (void); |
---|
| 191 | |
---|
| 192 | public : void function_speculative_load_commit_transition (void); |
---|
| 193 | public : void function_speculative_load_commit_genMoore (void); |
---|
| 194 | public : void function_speculative_load_commit_genMealy_dcache (void); |
---|
| 195 | public : void function_speculative_load_commit_genMealy_insert (void); |
---|
| 196 | public : void function_speculative_load_commit_genMealy_retire (void); |
---|
| 197 | #endif |
---|
| 198 | #ifdef STATISTICS |
---|
| 199 | public : string statistics (uint32_t depth); |
---|
| 200 | #endif |
---|
| 201 | |
---|
| 202 | #if VHDL |
---|
| 203 | public : void vhdl (void); |
---|
| 204 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
| 205 | private : void vhdl_body (Vhdl * & vhdl); |
---|
| 206 | #endif |
---|
| 207 | |
---|
| 208 | #ifdef VHDL_TESTBENCH |
---|
| 209 | private : void vhdl_testbench_transition (void); |
---|
| 210 | #endif |
---|
| 211 | }; |
---|
| 212 | |
---|
| 213 | }; // end namespace load_store_unit |
---|
| 214 | }; // end namespace execute_unit |
---|
| 215 | }; // end namespace multi_execute_unit |
---|
| 216 | }; // end namespace execute_loop |
---|
| 217 | }; // end namespace multi_execute_loop |
---|
| 218 | }; // end namespace core |
---|
| 219 | |
---|
| 220 | }; // end namespace behavioural |
---|
| 221 | }; // end namespace morpheo |
---|
| 222 | |
---|
| 223 | #endif |
---|