[88] | 1 | /* |
---|
| 2 | * $Id: Commit_unit.cpp 132 2009-07-11 16:39:35Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h" |
---|
[110] | 9 | #include "Behavioural/include/Simulation.h" |
---|
[88] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_ooo_engine { |
---|
| 15 | namespace ooo_engine { |
---|
| 16 | namespace commit_unit { |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Commit_unit::Commit_unit" |
---|
| 21 | Commit_unit::Commit_unit |
---|
| 22 | ( |
---|
| 23 | #ifdef SYSTEMC |
---|
| 24 | sc_module_name name, |
---|
| 25 | #else |
---|
| 26 | string name, |
---|
| 27 | #endif |
---|
| 28 | #ifdef STATISTICS |
---|
| 29 | morpheo::behavioural::Parameters_Statistics * param_statistics, |
---|
| 30 | #endif |
---|
| 31 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::commit_unit::Parameters * param, |
---|
| 32 | morpheo::behavioural::Tusage_t usage |
---|
| 33 | ): |
---|
| 34 | _name (name) |
---|
| 35 | ,_param (param) |
---|
| 36 | ,_usage (usage) |
---|
| 37 | { |
---|
| 38 | log_begin(Commit_unit,FUNCTION); |
---|
| 39 | |
---|
| 40 | usage_environment(_usage); |
---|
| 41 | |
---|
[123] | 42 | // #if DEBUG_Commit_unit == true |
---|
| 43 | // log_printf(TRACE,Commit_unit,FUNCTION,_("<%s> Parameters"),_name.c_str()); |
---|
[88] | 44 | |
---|
[123] | 45 | // std::cout << *param << std::endl; |
---|
| 46 | // #endif |
---|
[88] | 47 | |
---|
| 48 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Allocation"),_name.c_str()); |
---|
| 49 | |
---|
| 50 | allocation ( |
---|
| 51 | #ifdef STATISTICS |
---|
| 52 | param_statistics |
---|
| 53 | #endif |
---|
| 54 | ); |
---|
| 55 | |
---|
| 56 | #ifdef STATISTICS |
---|
| 57 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 58 | { |
---|
| 59 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Allocation of statistics"),_name.c_str()); |
---|
| 60 | |
---|
| 61 | statistics_allocation(param_statistics); |
---|
| 62 | } |
---|
| 63 | #endif |
---|
| 64 | |
---|
| 65 | #ifdef VHDL |
---|
| 66 | if (usage_is_set(_usage,USE_VHDL)) |
---|
| 67 | { |
---|
| 68 | // generate the vhdl |
---|
| 69 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Generate the vhdl"),_name.c_str()); |
---|
| 70 | |
---|
| 71 | vhdl(); |
---|
| 72 | } |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | #ifdef SYSTEMC |
---|
| 76 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
| 77 | { |
---|
[131] | 78 | #ifdef SYSTEMCASS_SPECIFIC |
---|
| 79 | constant(); |
---|
| 80 | #else |
---|
| 81 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - constant"),_name.c_str()); |
---|
[104] | 82 | |
---|
[131] | 83 | SC_METHOD (constant); |
---|
| 84 | // dont_initialize (); |
---|
| 85 | |
---|
| 86 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 87 | // List dependency information |
---|
| 88 | # endif |
---|
| 89 | #endif |
---|
[88] | 90 | |
---|
| 91 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - transition"),_name.c_str()); |
---|
| 92 | |
---|
| 93 | SC_METHOD (transition); |
---|
| 94 | dont_initialize (); |
---|
| 95 | sensitive << (*(in_CLOCK)).pos(); |
---|
| 96 | |
---|
| 97 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 98 | // List dependency information |
---|
| 99 | # endif |
---|
| 100 | |
---|
| 101 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMoore"),_name.c_str()); |
---|
| 102 | |
---|
| 103 | SC_METHOD (genMoore); |
---|
| 104 | dont_initialize (); |
---|
| 105 | sensitive << (*(in_CLOCK)).neg(); // need internal register |
---|
| 106 | |
---|
| 107 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 108 | // List dependency information |
---|
| 109 | # endif |
---|
| 110 | |
---|
| 111 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_insert"),_name.c_str()); |
---|
| 112 | |
---|
| 113 | SC_METHOD (genMealy_insert); |
---|
| 114 | dont_initialize (); |
---|
[132] | 115 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 116 | << (*(in_NRESET)); |
---|
[88] | 117 | // for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 118 | // for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) |
---|
| 119 | // sensitive << (*(in_INSERT_VAL [i][j])); |
---|
| 120 | |
---|
| 121 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 122 | // List dependency information |
---|
[112] | 123 | // for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 124 | // for (uint32_t j=0; j<_param->_nb_inst_insert[i]; j++) |
---|
| 125 | // for (uint32_t x=0; x<_param->_nb_rename_unit; x++) |
---|
| 126 | // for (uint32_t y=0; y<_param->_nb_inst_insert[x]; y++) |
---|
| 127 | // { |
---|
| 128 | // (*(out_INSERT_ACK [i][j])) (*(in_INSERT_VAL [x][y])); |
---|
| 129 | // if (_param->_have_port_rob_ptr) |
---|
| 130 | // (*(out_INSERT_PACKET_ID [i][j])) (*(in_INSERT_VAL [x][y])); |
---|
| 131 | // } |
---|
[88] | 132 | # endif |
---|
| 133 | |
---|
| 134 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_retire"),_name.c_str()); |
---|
| 135 | |
---|
| 136 | SC_METHOD (genMealy_retire); |
---|
| 137 | dont_initialize (); |
---|
[132] | 138 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 139 | << (*(in_NRESET)); |
---|
[88] | 140 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 141 | for (uint32_t j=0; j<_param->_nb_inst_retire[i]; j++) |
---|
| 142 | sensitive << (*(in_RETIRE_ACK [i][j])); |
---|
| 143 | |
---|
| 144 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 145 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 146 | sensitive << (*(in_SPR_WRITE_ACK [i][j])); |
---|
| 147 | |
---|
| 148 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 149 | // List dependency information |
---|
| 150 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 151 | for (uint32_t j=0; j<_param->_nb_inst_retire[i]; j++) |
---|
| 152 | { |
---|
| 153 | for (uint32_t x=0; x<_param->_nb_rename_unit; x++) |
---|
| 154 | for (uint32_t y=0; y<_param->_nb_inst_retire[x]; y++) |
---|
| 155 | { |
---|
| 156 | (*(out_RETIRE_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 157 | if (_param->_have_port_front_end_id) |
---|
| 158 | (*(out_RETIRE_FRONT_END_ID [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 159 | if (_param->_have_port_context_id) |
---|
| 160 | (*(out_RETIRE_CONTEXT_ID [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 161 | // (*(out_RETIRE_RENAME_UNIT_ID [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 162 | (*(out_RETIRE_USE_STORE_QUEUE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 163 | (*(out_RETIRE_USE_LOAD_QUEUE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 164 | (*(out_RETIRE_STORE_QUEUE_PTR_WRITE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 165 | if (_param->_have_port_load_queue_ptr) |
---|
| 166 | (*(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
[121] | 167 | // (*(out_RETIRE_READ_RA [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 168 | // (*(out_RETIRE_NUM_REG_RA_PHY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 169 | // (*(out_RETIRE_READ_RB [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 170 | // (*(out_RETIRE_NUM_REG_RB_PHY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 171 | // (*(out_RETIRE_READ_RC [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 172 | // (*(out_RETIRE_NUM_REG_RC_PHY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
[88] | 173 | (*(out_RETIRE_WRITE_RD [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 174 | (*(out_RETIRE_NUM_REG_RD_LOG [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 175 | (*(out_RETIRE_NUM_REG_RD_PHY_OLD [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 176 | (*(out_RETIRE_NUM_REG_RD_PHY_NEW [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 177 | (*(out_RETIRE_WRITE_RE [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 178 | (*(out_RETIRE_NUM_REG_RE_LOG [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 179 | (*(out_RETIRE_NUM_REG_RE_PHY_OLD [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 180 | (*(out_RETIRE_NUM_REG_RE_PHY_NEW [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 181 | } |
---|
| 182 | |
---|
| 183 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
| 184 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
| 185 | { |
---|
| 186 | (*(out_RETIRE_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 187 | if (_param->_have_port_front_end_id) |
---|
| 188 | (*(out_RETIRE_FRONT_END_ID [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 189 | if (_param->_have_port_context_id) |
---|
| 190 | (*(out_RETIRE_CONTEXT_ID [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 191 | // (*(out_RETIRE_RENAME_UNIT_ID [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 192 | (*(out_RETIRE_USE_STORE_QUEUE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 193 | (*(out_RETIRE_USE_LOAD_QUEUE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 194 | (*(out_RETIRE_STORE_QUEUE_PTR_WRITE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 195 | if (_param->_have_port_load_queue_ptr) |
---|
| 196 | (*(out_RETIRE_LOAD_QUEUE_PTR_WRITE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
[121] | 197 | // (*(out_RETIRE_READ_RA [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 198 | // (*(out_RETIRE_NUM_REG_RA_PHY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 199 | // (*(out_RETIRE_READ_RB [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 200 | // (*(out_RETIRE_NUM_REG_RB_PHY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 201 | // (*(out_RETIRE_READ_RC [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 202 | // (*(out_RETIRE_NUM_REG_RC_PHY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
[88] | 203 | (*(out_RETIRE_WRITE_RD [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 204 | (*(out_RETIRE_NUM_REG_RD_LOG [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 205 | (*(out_RETIRE_NUM_REG_RD_PHY_OLD [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 206 | (*(out_RETIRE_NUM_REG_RD_PHY_NEW [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 207 | (*(out_RETIRE_WRITE_RE [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 208 | (*(out_RETIRE_NUM_REG_RE_LOG [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 209 | (*(out_RETIRE_NUM_REG_RE_PHY_OLD [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 210 | (*(out_RETIRE_NUM_REG_RE_PHY_NEW [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 211 | } |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | for (uint32_t i=0; i<_param->_nb_front_end; ++i) |
---|
| 215 | for (uint32_t j=0; j<_param->_nb_context[i]; ++j) |
---|
| 216 | { |
---|
| 217 | for (uint32_t x=0; x<_param->_nb_rename_unit; x++) |
---|
| 218 | for (uint32_t y=0; y<_param->_nb_inst_retire[x]; y++) |
---|
| 219 | { |
---|
| 220 | (*(out_SPR_WRITE_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 221 | (*(out_SPR_WRITE_SR_F_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 222 | (*(out_SPR_WRITE_SR_F [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 223 | (*(out_SPR_WRITE_SR_CY_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 224 | (*(out_SPR_WRITE_SR_CY [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 225 | (*(out_SPR_WRITE_SR_OV_VAL [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 226 | (*(out_SPR_WRITE_SR_OV [i][j])) (*(in_RETIRE_ACK [x][y])); |
---|
| 227 | } |
---|
| 228 | |
---|
| 229 | for (uint32_t x=0; x<_param->_nb_front_end; ++x) |
---|
| 230 | for (uint32_t y=0; y<_param->_nb_context[x]; ++y) |
---|
| 231 | { |
---|
| 232 | (*(out_SPR_WRITE_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 233 | (*(out_SPR_WRITE_SR_F_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 234 | (*(out_SPR_WRITE_SR_F [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 235 | (*(out_SPR_WRITE_SR_CY_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 236 | (*(out_SPR_WRITE_SR_CY [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 237 | (*(out_SPR_WRITE_SR_OV_VAL [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 238 | (*(out_SPR_WRITE_SR_OV [i][j])) (*(in_SPR_WRITE_ACK [x][y])); |
---|
| 239 | } |
---|
| 240 | } |
---|
| 241 | # endif |
---|
| 242 | |
---|
| 243 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Method - genMealy_commit"),_name.c_str()); |
---|
| 244 | |
---|
| 245 | SC_METHOD (genMealy_commit); |
---|
| 246 | dont_initialize (); |
---|
[132] | 247 | sensitive << (*(in_CLOCK)).neg() // need internal register |
---|
| 248 | << (*(in_NRESET)); |
---|
[88] | 249 | for (uint32_t j=0; j<_param->_nb_inst_commit; j++) |
---|
| 250 | { |
---|
| 251 | sensitive << (*(in_COMMIT_VAL [j])); |
---|
| 252 | if (_param->_have_port_rob_ptr) |
---|
| 253 | sensitive << (*(in_COMMIT_PACKET_ID [j])); |
---|
| 254 | } |
---|
| 255 | |
---|
| 256 | # ifdef SYSTEMCASS_SPECIFIC |
---|
| 257 | // List dependency information |
---|
| 258 | for (uint32_t j=0; j<_param->_nb_inst_commit; j++) |
---|
| 259 | for (uint32_t y=0; y<_param->_nb_inst_commit; y++) |
---|
| 260 | { |
---|
| 261 | (*(out_COMMIT_ACK [j])) (*(in_COMMIT_VAL [y])); |
---|
| 262 | if (_param->_have_port_rob_ptr) |
---|
| 263 | (*(out_COMMIT_ACK [j])) (*(in_COMMIT_PACKET_ID [y])); |
---|
| 264 | } |
---|
| 265 | # endif |
---|
| 266 | |
---|
| 267 | #endif |
---|
[110] | 268 | |
---|
| 269 | // Init stop condition |
---|
| 270 | while (_simulation_nb_instruction_commited.size() < _param->_nb_thread) |
---|
| 271 | _simulation_nb_instruction_commited.push_back(0); |
---|
[88] | 272 | } |
---|
| 273 | log_end(Commit_unit,FUNCTION); |
---|
| 274 | }; |
---|
| 275 | |
---|
| 276 | #undef FUNCTION |
---|
| 277 | #define FUNCTION "Commit_unit::~Commit_unit" |
---|
| 278 | Commit_unit::~Commit_unit (void) |
---|
| 279 | { |
---|
| 280 | log_begin(Commit_unit,FUNCTION); |
---|
| 281 | |
---|
| 282 | #ifdef STATISTICS |
---|
| 283 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 284 | { |
---|
| 285 | statistics_deallocation(); |
---|
| 286 | } |
---|
| 287 | #endif |
---|
| 288 | |
---|
| 289 | log_printf(INFO,Commit_unit,FUNCTION,_("<%s> Deallocation"),_name.c_str()); |
---|
| 290 | deallocation (); |
---|
| 291 | |
---|
| 292 | log_end(Commit_unit,FUNCTION); |
---|
| 293 | }; |
---|
| 294 | |
---|
| 295 | }; // end namespace commit_unit |
---|
| 296 | }; // end namespace ooo_engine |
---|
| 297 | }; // end namespace multi_ooo_engine |
---|
| 298 | }; // end namespace core |
---|
| 299 | |
---|
| 300 | }; // end namespace behavioural |
---|
| 301 | }; // end namespace morpheo |
---|