[55] | 1 | #ifndef morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_read_unit_read_unit_reservation_station_Reservation_station_h |
---|
| 2 | #define morpheo_behavioural_core_multi_execute_loop_execute_loop_multi_read_unit_read_unit_reservation_station_Reservation_station_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id$ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
| 11 | #ifdef SYSTEMC |
---|
| 12 | #include "systemc.h" |
---|
| 13 | #endif |
---|
| 14 | |
---|
| 15 | #include <iostream> |
---|
| 16 | #include "Common/include/ToString.h" |
---|
| 17 | #include "Common/include/Debug.h" |
---|
| 18 | |
---|
[69] | 19 | #ifndef SYSTEMC_VHDL_COMPATIBILITY |
---|
[56] | 20 | #include "Behavioural/Generic/Queue_Control/include/Queue_Control.h" |
---|
[69] | 21 | #endif |
---|
[55] | 22 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Parameters.h" |
---|
[69] | 23 | #include "Behavioural/include/Types.h" |
---|
[55] | 24 | #ifdef STATISTICS |
---|
| 25 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Statistics.h" |
---|
| 26 | #endif |
---|
| 27 | #include "Behavioural/include/Component.h" |
---|
| 28 | #ifdef VHDL |
---|
| 29 | #include "Behavioural/include/Vhdl.h" |
---|
| 30 | #endif |
---|
| 31 | |
---|
| 32 | using namespace std; |
---|
[56] | 33 | using namespace morpheo::behavioural::generic::queue_control; |
---|
[55] | 34 | |
---|
| 35 | namespace morpheo { |
---|
| 36 | namespace behavioural { |
---|
| 37 | namespace core { |
---|
| 38 | namespace multi_execute_loop { |
---|
| 39 | namespace execute_loop { |
---|
| 40 | namespace multi_read_unit { |
---|
| 41 | namespace read_unit { |
---|
| 42 | namespace reservation_station { |
---|
| 43 | |
---|
| 44 | class Treservation_station_entry_t |
---|
| 45 | { |
---|
[69] | 46 | public : Tcontext_t _context_id ; |
---|
| 47 | public : Tcontext_t _front_end_id ; |
---|
| 48 | public : Tcontext_t _ooo_engine_id ; |
---|
| 49 | public : Tpacket_t _rob_id ; |
---|
[55] | 50 | public : Toperation_t _operation ; |
---|
| 51 | public : Ttype_t _type ; |
---|
| 52 | public : Tcontrol_t _has_immediat; |
---|
| 53 | public : Tgeneral_data_t _immediat ; |
---|
| 54 | //public : Tcontrol_t _read_ra ; |
---|
| 55 | public : Tgeneral_address_t _num_reg_ra ; |
---|
| 56 | public : Tcontrol_t _data_ra_val ; |
---|
| 57 | public : Tgeneral_data_t _data_ra ; |
---|
| 58 | //public : Tcontrol_t _read_rb ; |
---|
| 59 | public : Tgeneral_address_t _num_reg_rb ; |
---|
| 60 | public : Tcontrol_t _data_rb_val ; |
---|
| 61 | public : Tgeneral_data_t _data_rb ; |
---|
| 62 | //public : Tcontrol_t _read_rc ; |
---|
| 63 | public : Tspecial_address_t _num_reg_rc ; |
---|
| 64 | public : Tcontrol_t _data_rc_val ; |
---|
| 65 | public : Tspecial_data_t _data_rc ; |
---|
| 66 | public : Tcontrol_t _write_rd ; |
---|
| 67 | public : Tgeneral_address_t _num_reg_rd ; |
---|
| 68 | public : Tcontrol_t _write_re ; |
---|
| 69 | public : Tspecial_address_t _num_reg_re ; |
---|
| 70 | |
---|
| 71 | friend ostream& operator<< (ostream& output_stream, |
---|
| 72 | morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::reservation_station::Treservation_station_entry_t & x) |
---|
| 73 | { |
---|
[69] | 74 | output_stream << " * _context_id : " << toString(x._context_id ) << endl |
---|
| 75 | << " * _front_end_id : " << toString(x._front_end_id ) << endl |
---|
| 76 | << " * _ooo_engine_id : " << toString(x._ooo_engine_id ) << endl |
---|
| 77 | << " * _rob_id : " << toString(x._rob_id ) << endl |
---|
| 78 | << " * _operation : " << toString(x._operation ) << endl |
---|
| 79 | << " * _type : " << toString(x._type ) << endl |
---|
| 80 | << " * _has_immediat : " << toString(x._has_immediat ) << endl |
---|
| 81 | << " * _immediat : " << toString(x._immediat ) << endl |
---|
| 82 | // << " * _read_ra : " << toString(x._read_ra ) << endl |
---|
| 83 | << " * _num_reg_ra : " << toString(x._num_reg_ra ) << endl |
---|
| 84 | << " * _data_ra_val : " << toString(x._data_ra_val ) << endl |
---|
| 85 | << " * _data_ra : " << toString(x._data_ra ) << endl |
---|
| 86 | // << " * _read_rb : " << toString(x._read_rb ) << endl |
---|
| 87 | << " * _num_reg_rb : " << toString(x._num_reg_rb ) << endl |
---|
| 88 | << " * _data_rb_val : " << toString(x._data_rb_val ) << endl |
---|
| 89 | << " * _data_rb : " << toString(x._data_rb ) << endl |
---|
| 90 | // << " * _read_rc : " << toString(x._read_rc ) << endl |
---|
| 91 | << " * _num_reg_rc : " << toString(x._num_reg_rc ) << endl |
---|
| 92 | << " * _data_rc_val : " << toString(x._data_rc_val ) << endl |
---|
| 93 | << " * _data_rc : " << toString(x._data_rc ) << endl |
---|
| 94 | << " * _write_rd : " << toString(x._write_rd ) << endl |
---|
| 95 | << " * _num_reg_rd : " << toString(x._num_reg_rd ) << endl |
---|
| 96 | << " * _write_re : " << toString(x._write_re ) << endl |
---|
| 97 | << " * _num_reg_re : " << toString(x._num_reg_re ) << endl; |
---|
[55] | 98 | |
---|
| 99 | return output_stream; |
---|
| 100 | } |
---|
| 101 | |
---|
| 102 | }; |
---|
| 103 | |
---|
| 104 | class Reservation_station |
---|
| 105 | #if SYSTEMC |
---|
| 106 | : public sc_module |
---|
| 107 | #endif |
---|
| 108 | { |
---|
| 109 | // -----[ fields ]---------------------------------------------------- |
---|
| 110 | // Parameters |
---|
| 111 | protected : const string _name; |
---|
| 112 | |
---|
| 113 | protected : const Parameters * _param; |
---|
| 114 | //#ifdef STATISTICS |
---|
| 115 | // protected : const morpheo::behavioural::Parameters_Statistics * _param_statistics; |
---|
| 116 | //#endif |
---|
| 117 | |
---|
| 118 | #ifdef STATISTICS |
---|
| 119 | private : Statistics * _stat; |
---|
| 120 | #endif |
---|
| 121 | |
---|
| 122 | public : Component * _component; |
---|
| 123 | private : Interfaces * _interfaces; |
---|
| 124 | |
---|
| 125 | #ifdef SYSTEMC |
---|
| 126 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 127 | // Interface |
---|
| 128 | public : SC_CLOCK * in_CLOCK ; |
---|
| 129 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
| 130 | |
---|
[69] | 131 | // ~~~~~[ Interface "insert" ]~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 132 | public : SC_IN (Tcontrol_t ) * in_INSERT_VAL ; |
---|
| 133 | public : SC_OUT(Tcontrol_t ) * out_INSERT_ACK ; |
---|
| 134 | public : SC_IN (Tcontext_t ) * in_INSERT_CONTEXT_ID ; |
---|
| 135 | public : SC_IN (Tcontext_t ) * in_INSERT_FRONT_END_ID ; |
---|
| 136 | public : SC_IN (Tcontext_t ) * in_INSERT_OOO_ENGINE_ID ; |
---|
| 137 | public : SC_IN (Tpacket_t ) * in_INSERT_ROB_ID ; |
---|
| 138 | public : SC_IN (Toperation_t ) * in_INSERT_OPERATION ; |
---|
| 139 | public : SC_IN (Ttype_t ) * in_INSERT_TYPE ; |
---|
| 140 | public : SC_IN (Tcontrol_t ) * in_INSERT_HAS_IMMEDIAT ; |
---|
| 141 | public : SC_IN (Tgeneral_data_t ) * in_INSERT_IMMEDIAT ; |
---|
| 142 | //public : SC_IN (Tcontrol_t ) * in_INSERT_READ_RA ; |
---|
| 143 | public : SC_IN (Tgeneral_address_t) * in_INSERT_NUM_REG_RA ; |
---|
| 144 | public : SC_IN (Tcontrol_t ) * in_INSERT_DATA_RA_VAL ; |
---|
| 145 | public : SC_IN (Tgeneral_data_t ) * in_INSERT_DATA_RA ; |
---|
| 146 | //public : SC_IN (Tcontrol_t ) * in_INSERT_READ_RB ; |
---|
| 147 | public : SC_IN (Tgeneral_address_t) * in_INSERT_NUM_REG_RB ; |
---|
| 148 | public : SC_IN (Tcontrol_t ) * in_INSERT_DATA_RB_VAL ; |
---|
| 149 | public : SC_IN (Tgeneral_data_t ) * in_INSERT_DATA_RB ; |
---|
| 150 | //public : SC_IN (Tcontrol_t ) * in_INSERT_READ_RC ; |
---|
| 151 | public : SC_IN (Tspecial_address_t) * in_INSERT_NUM_REG_RC ; |
---|
| 152 | public : SC_IN (Tcontrol_t ) * in_INSERT_DATA_RC_VAL ; |
---|
| 153 | public : SC_IN (Tspecial_data_t ) * in_INSERT_DATA_RC ; |
---|
| 154 | public : SC_IN (Tcontrol_t ) * in_INSERT_WRITE_RD ; |
---|
| 155 | public : SC_IN (Tgeneral_address_t) * in_INSERT_NUM_REG_RD ; |
---|
| 156 | public : SC_IN (Tcontrol_t ) * in_INSERT_WRITE_RE ; |
---|
| 157 | public : SC_IN (Tspecial_address_t) * in_INSERT_NUM_REG_RE ; |
---|
[55] | 158 | |
---|
[69] | 159 | // ~~~~~[ Interface "retire" ]~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 160 | public : SC_OUT(Tcontrol_t ) ** out_RETIRE_VAL ; |
---|
| 161 | public : SC_IN (Tcontrol_t ) ** in_RETIRE_ACK ; |
---|
| 162 | public : SC_OUT(Tcontext_t ) ** out_RETIRE_CONTEXT_ID ; |
---|
| 163 | public : SC_OUT(Tcontext_t ) ** out_RETIRE_FRONT_END_ID ; |
---|
| 164 | public : SC_OUT(Tcontext_t ) ** out_RETIRE_OOO_ENGINE_ID ; |
---|
| 165 | public : SC_OUT(Tpacket_t ) ** out_RETIRE_ROB_ID ; |
---|
| 166 | public : SC_OUT(Toperation_t ) ** out_RETIRE_OPERATION ; |
---|
| 167 | public : SC_OUT(Ttype_t ) ** out_RETIRE_TYPE ; |
---|
| 168 | public : SC_OUT(Tcontrol_t ) ** out_RETIRE_HAS_IMMEDIAT ; |
---|
| 169 | public : SC_OUT(Tgeneral_data_t ) ** out_RETIRE_IMMEDIAT ; |
---|
| 170 | public : SC_OUT(Tgeneral_data_t ) ** out_RETIRE_DATA_RA ; |
---|
| 171 | public : SC_OUT(Tgeneral_data_t ) ** out_RETIRE_DATA_RB ; |
---|
| 172 | public : SC_OUT(Tspecial_data_t ) ** out_RETIRE_DATA_RC ; |
---|
| 173 | public : SC_OUT(Tcontrol_t ) ** out_RETIRE_WRITE_RD ; |
---|
| 174 | public : SC_OUT(Tgeneral_address_t) ** out_RETIRE_NUM_REG_RD ; |
---|
| 175 | public : SC_OUT(Tcontrol_t ) ** out_RETIRE_WRITE_RE ; |
---|
| 176 | public : SC_OUT(Tspecial_address_t) ** out_RETIRE_NUM_REG_RE ; |
---|
[55] | 177 | |
---|
| 178 | // ~~~~~[ Interface "gpr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 179 | |
---|
[69] | 180 | public : SC_IN (Tcontrol_t ) ** in_GPR_WRITE_VAL ; // val and ack |
---|
| 181 | public : SC_IN (Tcontext_t ) ** in_GPR_WRITE_OOO_ENGINE_ID; |
---|
| 182 | public : SC_IN (Tgeneral_address_t) ** in_GPR_WRITE_NUM_REG ; |
---|
| 183 | public : SC_IN (Tgeneral_data_t ) ** in_GPR_WRITE_DATA ; |
---|
[55] | 184 | |
---|
| 185 | // ~~~~~[ Interface "spr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 186 | |
---|
[69] | 187 | public : SC_IN (Tcontrol_t ) ** in_SPR_WRITE_VAL ; // val and ack |
---|
| 188 | public : SC_IN (Tcontext_t ) ** in_SPR_WRITE_OOO_ENGINE_ID; |
---|
| 189 | public : SC_IN (Tspecial_address_t) ** in_SPR_WRITE_NUM_REG ; |
---|
| 190 | public : SC_IN (Tspecial_data_t ) ** in_SPR_WRITE_DATA ; |
---|
[55] | 191 | |
---|
| 192 | // ~~~~~[ Interface "bypass_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 193 | |
---|
[69] | 194 | public : SC_IN (Tcontext_t ) ** in_BYPASS_WRITE_OOO_ENGINE_ID ; |
---|
| 195 | public : SC_IN (Tcontrol_t ) ** in_BYPASS_WRITE_GPR_VAL ; |
---|
| 196 | public : SC_IN (Tgeneral_address_t) ** in_BYPASS_WRITE_GPR_NUM_REG ; // RD |
---|
| 197 | public : SC_IN (Tgeneral_data_t ) ** in_BYPASS_WRITE_GPR_DATA ; |
---|
| 198 | public : SC_IN (Tcontrol_t ) ** in_BYPASS_WRITE_SPR_VAL ; |
---|
| 199 | public : SC_IN (Tspecial_address_t) ** in_BYPASS_WRITE_SPR_NUM_REG ; // RE |
---|
| 200 | public : SC_IN (Tspecial_data_t ) ** in_BYPASS_WRITE_SPR_DATA ; |
---|
[55] | 201 | |
---|
| 202 | // ~~~~~[ Interface "bypass_memory" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 203 | |
---|
[69] | 204 | public : SC_IN (Tcontrol_t ) ** in_BYPASS_MEMORY_VAL ; |
---|
| 205 | public : SC_IN (Tcontext_t ) ** in_BYPASS_MEMORY_OOO_ENGINE_ID; |
---|
| 206 | public : SC_IN (Tgeneral_address_t) ** in_BYPASS_MEMORY_NUM_REG ; |
---|
| 207 | public : SC_IN (Tgeneral_data_t ) ** in_BYPASS_MEMORY_DATA ; |
---|
[55] | 208 | |
---|
| 209 | |
---|
| 210 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 211 | |
---|
| 212 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 213 | |
---|
| 214 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[69] | 215 | #ifdef SYSTEMC_VHDL_COMPATIBILITY |
---|
| 216 | protected : bool * _queue_valid; |
---|
| 217 | protected : uint32_t internal_INSERT_SLOT; |
---|
| 218 | #else |
---|
[56] | 219 | protected : morpheo::behavioural::generic::queue_control::Queue_Control * _queue_control; |
---|
[69] | 220 | #endif |
---|
[55] | 221 | protected : Treservation_station_entry_t * _queue; |
---|
| 222 | |
---|
[69] | 223 | protected : Tcontrol_t internal_INSERT_ACK; |
---|
| 224 | protected : Tcontrol_t * internal_RETIRE_VAL; |
---|
| 225 | protected : uint32_t * internal_RETIRE_SLOT; |
---|
[55] | 226 | #endif |
---|
| 227 | |
---|
| 228 | // -----[ methods ]--------------------------------------------------- |
---|
| 229 | |
---|
| 230 | #ifdef SYSTEMC |
---|
| 231 | SC_HAS_PROCESS (Reservation_station); |
---|
| 232 | #endif |
---|
| 233 | public : Reservation_station ( |
---|
| 234 | #ifdef SYSTEMC |
---|
| 235 | sc_module_name name, |
---|
| 236 | #else |
---|
| 237 | string name, |
---|
| 238 | #endif |
---|
| 239 | #ifdef STATISTICS |
---|
| 240 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 241 | #endif |
---|
| 242 | Parameters * param ); |
---|
| 243 | public : ~Reservation_station (void); |
---|
| 244 | |
---|
| 245 | #ifdef SYSTEMC |
---|
| 246 | private : void allocation (void); |
---|
| 247 | private : void deallocation (void); |
---|
| 248 | |
---|
| 249 | public : void transition (void); |
---|
| 250 | public : void genMoore (void); |
---|
| 251 | #endif |
---|
| 252 | #ifdef STATISTICS |
---|
| 253 | public : string statistics (uint32_t depth); |
---|
| 254 | #endif |
---|
| 255 | |
---|
| 256 | #if VHDL |
---|
| 257 | public : void vhdl (void); |
---|
| 258 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
| 259 | private : void vhdl_body (Vhdl * & vhdl); |
---|
| 260 | #endif |
---|
| 261 | |
---|
[69] | 262 | private : void end_cycle (void); |
---|
[55] | 263 | }; |
---|
| 264 | |
---|
| 265 | }; // end namespace reservation_station |
---|
| 266 | }; // end namespace read_unit |
---|
| 267 | }; // end namespace multi_read_unit |
---|
| 268 | }; // end namespace execute_loop |
---|
| 269 | }; // end namespace multi_execute_loop |
---|
| 270 | }; // end namespace core |
---|
| 271 | |
---|
| 272 | }; // end namespace behavioural |
---|
| 273 | }; // end namespace morpheo |
---|
| 274 | |
---|
| 275 | #endif |
---|