[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 | |
---|
[56] | 19 | #include "Behavioural/Generic/Queue_Control/include/Queue_Control.h" |
---|
[55] | 20 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Parameters.h" |
---|
| 21 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Types.h" |
---|
| 22 | #ifdef STATISTICS |
---|
| 23 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Read_unit/Read_unit/Reservation_station/include/Statistics.h" |
---|
| 24 | #endif |
---|
| 25 | #include "Behavioural/include/Component.h" |
---|
| 26 | #ifdef VHDL |
---|
| 27 | #include "Behavioural/include/Vhdl.h" |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | using namespace std; |
---|
[56] | 31 | using namespace morpheo::behavioural::generic::queue_control; |
---|
[55] | 32 | |
---|
| 33 | namespace morpheo { |
---|
| 34 | namespace behavioural { |
---|
| 35 | namespace core { |
---|
| 36 | namespace multi_execute_loop { |
---|
| 37 | namespace execute_loop { |
---|
| 38 | namespace multi_read_unit { |
---|
| 39 | namespace read_unit { |
---|
| 40 | namespace reservation_station { |
---|
| 41 | |
---|
| 42 | class Treservation_station_entry_t |
---|
| 43 | { |
---|
| 44 | public : Tcontext_t _context_id ; |
---|
| 45 | public : Tpacket_t _packet_id ; |
---|
| 46 | public : Toperation_t _operation ; |
---|
| 47 | public : Ttype_t _type ; |
---|
| 48 | public : Tcontrol_t _has_immediat; |
---|
| 49 | public : Tgeneral_data_t _immediat ; |
---|
| 50 | //public : Tcontrol_t _read_ra ; |
---|
| 51 | public : Tgeneral_address_t _num_reg_ra ; |
---|
| 52 | public : Tcontrol_t _data_ra_val ; |
---|
| 53 | public : Tgeneral_data_t _data_ra ; |
---|
| 54 | //public : Tcontrol_t _read_rb ; |
---|
| 55 | public : Tgeneral_address_t _num_reg_rb ; |
---|
| 56 | public : Tcontrol_t _data_rb_val ; |
---|
| 57 | public : Tgeneral_data_t _data_rb ; |
---|
| 58 | //public : Tcontrol_t _read_rc ; |
---|
| 59 | public : Tspecial_address_t _num_reg_rc ; |
---|
| 60 | public : Tcontrol_t _data_rc_val ; |
---|
| 61 | public : Tspecial_data_t _data_rc ; |
---|
| 62 | public : Tcontrol_t _write_rd ; |
---|
| 63 | public : Tgeneral_address_t _num_reg_rd ; |
---|
| 64 | public : Tcontrol_t _write_re ; |
---|
| 65 | public : Tspecial_address_t _num_reg_re ; |
---|
| 66 | |
---|
| 67 | friend ostream& operator<< (ostream& output_stream, |
---|
| 68 | morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_read_unit::read_unit::reservation_station::Treservation_station_entry_t & x) |
---|
| 69 | { |
---|
| 70 | output_stream << " * _context_id : " << toString(x._context_id ) << endl |
---|
| 71 | << " * _packet_id : " << toString(x._packet_id ) << endl |
---|
| 72 | << " * _operation : " << toString(x._operation ) << endl |
---|
| 73 | << " * _type : " << toString(x._type ) << endl |
---|
| 74 | << " * _has_immediat: " << toString(x._has_immediat) << endl |
---|
| 75 | << " * _immediat : " << toString(x._immediat ) << endl |
---|
| 76 | // << " * _read_ra : " << toString(x._read_ra ) << endl |
---|
| 77 | << " * _num_reg_ra : " << toString(x._num_reg_ra ) << endl |
---|
| 78 | << " * _data_ra_val : " << toString(x._data_ra_val ) << endl |
---|
| 79 | << " * _data_ra : " << toString(x._data_ra ) << endl |
---|
| 80 | // << " * _read_rb : " << toString(x._read_rb ) << endl |
---|
| 81 | << " * _num_reg_rb : " << toString(x._num_reg_rb ) << endl |
---|
| 82 | << " * _data_rb_val : " << toString(x._data_rb_val ) << endl |
---|
| 83 | << " * _data_rb : " << toString(x._data_rb ) << endl |
---|
| 84 | // << " * _read_rc : " << toString(x._read_rc ) << endl |
---|
| 85 | << " * _num_reg_rc : " << toString(x._num_reg_rc ) << endl |
---|
| 86 | << " * _data_rc_val : " << toString(x._data_rc_val ) << endl |
---|
| 87 | << " * _data_rc : " << toString(x._data_rc ) << endl |
---|
| 88 | << " * _write_rd : " << toString(x._write_rd ) << endl |
---|
| 89 | << " * _num_reg_rd : " << toString(x._num_reg_rd ) << endl |
---|
| 90 | << " * _write_re : " << toString(x._write_re ) << endl |
---|
| 91 | << " * _num_reg_re : " << toString(x._num_reg_re ) << endl; |
---|
| 92 | |
---|
| 93 | return output_stream; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | }; |
---|
| 97 | |
---|
| 98 | class Reservation_station |
---|
| 99 | #if SYSTEMC |
---|
| 100 | : public sc_module |
---|
| 101 | #endif |
---|
| 102 | { |
---|
| 103 | // -----[ fields ]---------------------------------------------------- |
---|
| 104 | // Parameters |
---|
| 105 | protected : const string _name; |
---|
| 106 | |
---|
| 107 | protected : const Parameters * _param; |
---|
| 108 | //#ifdef STATISTICS |
---|
| 109 | // protected : const morpheo::behavioural::Parameters_Statistics * _param_statistics; |
---|
| 110 | //#endif |
---|
| 111 | |
---|
| 112 | #ifdef STATISTICS |
---|
| 113 | private : Statistics * _stat; |
---|
| 114 | #endif |
---|
| 115 | |
---|
| 116 | public : Component * _component; |
---|
| 117 | private : Interfaces * _interfaces; |
---|
| 118 | |
---|
| 119 | #ifdef SYSTEMC |
---|
| 120 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 121 | // Interface |
---|
| 122 | public : SC_CLOCK * in_CLOCK ; |
---|
| 123 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
| 124 | |
---|
| 125 | // ~~~~~[ Interface "reservation_station_in" ]~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 126 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_VAL ; |
---|
| 127 | public : SC_OUT(Tcontrol_t ) * out_RESERVATION_STATION_IN_ACK ; |
---|
| 128 | public : SC_IN (Tcontext_t ) * in_RESERVATION_STATION_IN_CONTEXT_ID ; |
---|
| 129 | public : SC_IN (Tpacket_t ) * in_RESERVATION_STATION_IN_PACKET_ID ; |
---|
| 130 | public : SC_IN (Toperation_t ) * in_RESERVATION_STATION_IN_OPERATION ; |
---|
| 131 | public : SC_IN (Ttype_t ) * in_RESERVATION_STATION_IN_TYPE ; |
---|
| 132 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_HAS_IMMEDIAT; |
---|
| 133 | public : SC_IN (Tgeneral_data_t ) * in_RESERVATION_STATION_IN_IMMEDIAT ; |
---|
| 134 | //public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_READ_RA ; |
---|
| 135 | public : SC_IN (Tgeneral_address_t) * in_RESERVATION_STATION_IN_NUM_REG_RA ; |
---|
| 136 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_DATA_RA_VAL ; |
---|
| 137 | public : SC_IN (Tgeneral_data_t ) * in_RESERVATION_STATION_IN_DATA_RA ; |
---|
| 138 | //public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_READ_RB ; |
---|
| 139 | public : SC_IN (Tgeneral_address_t) * in_RESERVATION_STATION_IN_NUM_REG_RB ; |
---|
| 140 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_DATA_RB_VAL ; |
---|
| 141 | public : SC_IN (Tgeneral_data_t ) * in_RESERVATION_STATION_IN_DATA_RB ; |
---|
| 142 | //public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_READ_RC ; |
---|
| 143 | public : SC_IN (Tspecial_address_t) * in_RESERVATION_STATION_IN_NUM_REG_RC ; |
---|
| 144 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_DATA_RC_VAL ; |
---|
| 145 | public : SC_IN (Tspecial_data_t ) * in_RESERVATION_STATION_IN_DATA_RC ; |
---|
| 146 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_WRITE_RD ; |
---|
| 147 | public : SC_IN (Tgeneral_address_t) * in_RESERVATION_STATION_IN_NUM_REG_RD ; |
---|
| 148 | public : SC_IN (Tcontrol_t ) * in_RESERVATION_STATION_IN_WRITE_RE ; |
---|
| 149 | public : SC_IN (Tspecial_address_t) * in_RESERVATION_STATION_IN_NUM_REG_RE ; |
---|
| 150 | |
---|
| 151 | // ~~~~~[ Interface "reservation_station_out" ]~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 152 | public : SC_OUT(Tcontrol_t ) ** out_RESERVATION_STATION_OUT_VAL ; |
---|
| 153 | public : SC_IN (Tcontrol_t ) ** in_RESERVATION_STATION_OUT_ACK ; |
---|
| 154 | public : SC_OUT(Tcontext_t ) ** out_RESERVATION_STATION_OUT_CONTEXT_ID ; |
---|
| 155 | public : SC_OUT(Tpacket_t ) ** out_RESERVATION_STATION_OUT_PACKET_ID ; |
---|
| 156 | public : SC_OUT(Toperation_t ) ** out_RESERVATION_STATION_OUT_OPERATION ; |
---|
| 157 | public : SC_OUT(Ttype_t ) ** out_RESERVATION_STATION_OUT_TYPE ; |
---|
| 158 | public : SC_OUT(Tcontrol_t ) ** out_RESERVATION_STATION_OUT_HAS_IMMEDIAT; |
---|
| 159 | public : SC_OUT(Tgeneral_data_t ) ** out_RESERVATION_STATION_OUT_IMMEDIAT ; |
---|
| 160 | public : SC_OUT(Tgeneral_data_t ) ** out_RESERVATION_STATION_OUT_DATA_RA ; |
---|
| 161 | public : SC_OUT(Tgeneral_data_t ) ** out_RESERVATION_STATION_OUT_DATA_RB ; |
---|
| 162 | public : SC_OUT(Tspecial_data_t ) ** out_RESERVATION_STATION_OUT_DATA_RC ; |
---|
| 163 | public : SC_OUT(Tcontrol_t ) ** out_RESERVATION_STATION_OUT_WRITE_RD ; |
---|
| 164 | public : SC_OUT(Tgeneral_address_t) ** out_RESERVATION_STATION_OUT_NUM_REG_RD ; |
---|
| 165 | public : SC_OUT(Tcontrol_t ) ** out_RESERVATION_STATION_OUT_WRITE_RE ; |
---|
| 166 | public : SC_OUT(Tspecial_address_t) ** out_RESERVATION_STATION_OUT_NUM_REG_RE ; |
---|
| 167 | |
---|
| 168 | // ~~~~~[ Interface "gpr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 169 | |
---|
| 170 | public : SC_IN (Tcontrol_t ) ** in_GPR_WRITE_VAL ; // val and ack |
---|
| 171 | public : SC_IN (Tcontext_t ) ** in_GPR_WRITE_CONTEXT_ID; |
---|
| 172 | public : SC_IN (Tgeneral_address_t) ** in_GPR_WRITE_NUM_REG ; |
---|
| 173 | public : SC_IN (Tgeneral_data_t ) ** in_GPR_WRITE_DATA ; |
---|
| 174 | |
---|
| 175 | // ~~~~~[ Interface "spr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 176 | |
---|
| 177 | public : SC_IN (Tcontrol_t ) ** in_SPR_WRITE_VAL ; // val and ack |
---|
| 178 | public : SC_IN (Tcontext_t ) ** in_SPR_WRITE_CONTEXT_ID; |
---|
| 179 | public : SC_IN (Tspecial_address_t) ** in_SPR_WRITE_NUM_REG ; |
---|
| 180 | public : SC_IN (Tspecial_data_t ) ** in_SPR_WRITE_DATA ; |
---|
| 181 | |
---|
| 182 | // ~~~~~[ Interface "bypass_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 183 | |
---|
| 184 | public : SC_IN (Tcontext_t ) ** in_BYPASS_WRITE_CONTEXT_ID ; |
---|
| 185 | public : SC_IN (Tcontrol_t ) ** in_BYPASS_WRITE_GPR_VAL ; |
---|
| 186 | public : SC_IN (Tgeneral_address_t) ** in_BYPASS_WRITE_GPR_NUM_REG; // RD |
---|
| 187 | public : SC_IN (Tgeneral_data_t ) ** in_BYPASS_WRITE_GPR_DATA ; |
---|
| 188 | public : SC_IN (Tcontrol_t ) ** in_BYPASS_WRITE_SPR_VAL ; |
---|
| 189 | public : SC_IN (Tspecial_address_t) ** in_BYPASS_WRITE_SPR_NUM_REG; // RE |
---|
| 190 | public : SC_IN (Tspecial_data_t ) ** in_BYPASS_WRITE_SPR_DATA ; |
---|
| 191 | |
---|
| 192 | // ~~~~~[ Interface "bypass_memory" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 193 | |
---|
| 194 | public : SC_IN (Tcontrol_t ) ** in_BYPASS_MEMORY_VAL ; |
---|
| 195 | public : SC_IN (Tcontext_t ) ** in_BYPASS_MEMORY_CONTEXT_ID; |
---|
| 196 | public : SC_IN (Tgeneral_address_t) ** in_BYPASS_MEMORY_NUM_REG ; |
---|
| 197 | public : SC_IN (Tgeneral_data_t ) ** in_BYPASS_MEMORY_DATA ; |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 201 | |
---|
| 202 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 203 | |
---|
| 204 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[56] | 205 | protected : morpheo::behavioural::generic::queue_control::Queue_Control * _queue_control; |
---|
[55] | 206 | protected : Treservation_station_entry_t * _queue; |
---|
| 207 | |
---|
| 208 | protected : Tcontrol_t internal_RESERVATION_STATION_IN_ACK; |
---|
| 209 | protected : Tcontrol_t * internal_RESERVATION_STATION_OUT_VAL; |
---|
| 210 | #endif |
---|
| 211 | |
---|
| 212 | // -----[ methods ]--------------------------------------------------- |
---|
| 213 | |
---|
| 214 | #ifdef SYSTEMC |
---|
| 215 | SC_HAS_PROCESS (Reservation_station); |
---|
| 216 | #endif |
---|
| 217 | public : Reservation_station ( |
---|
| 218 | #ifdef SYSTEMC |
---|
| 219 | sc_module_name name, |
---|
| 220 | #else |
---|
| 221 | string name, |
---|
| 222 | #endif |
---|
| 223 | #ifdef STATISTICS |
---|
| 224 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 225 | #endif |
---|
| 226 | Parameters * param ); |
---|
| 227 | public : ~Reservation_station (void); |
---|
| 228 | |
---|
| 229 | #ifdef SYSTEMC |
---|
| 230 | private : void allocation (void); |
---|
| 231 | private : void deallocation (void); |
---|
| 232 | |
---|
| 233 | public : void transition (void); |
---|
| 234 | public : void genMoore (void); |
---|
| 235 | #endif |
---|
| 236 | #ifdef STATISTICS |
---|
| 237 | public : string statistics (uint32_t depth); |
---|
| 238 | #endif |
---|
| 239 | |
---|
| 240 | #if VHDL |
---|
| 241 | public : void vhdl (void); |
---|
| 242 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
| 243 | private : void vhdl_body (Vhdl * & vhdl); |
---|
| 244 | #endif |
---|
| 245 | |
---|
| 246 | #ifdef VHDL_TESTBENCH |
---|
| 247 | private : void vhdl_testbench_transition (void); |
---|
| 248 | #endif |
---|
| 249 | }; |
---|
| 250 | |
---|
| 251 | }; // end namespace reservation_station |
---|
| 252 | }; // end namespace read_unit |
---|
| 253 | }; // end namespace multi_read_unit |
---|
| 254 | }; // end namespace execute_loop |
---|
| 255 | }; // end namespace multi_execute_loop |
---|
| 256 | }; // end namespace core |
---|
| 257 | |
---|
| 258 | }; // end namespace behavioural |
---|
| 259 | }; // end namespace morpheo |
---|
| 260 | |
---|
| 261 | #endif |
---|