[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Commit_unit_genMealy_commit.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h" |
---|
| 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::genMealy_commit" |
---|
| 21 | void Commit_unit::genMealy_commit (void) |
---|
| 22 | { |
---|
| 23 | log_begin(Commit_unit,FUNCTION); |
---|
| 24 | log_function(Commit_unit,FUNCTION,_name.c_str()); |
---|
| 25 | |
---|
| 26 | #ifdef STATISTICS |
---|
| 27 | internal_BANK_COMMIT_CONFLIT_ACCESS = 0; |
---|
| 28 | #endif |
---|
| 29 | |
---|
| 30 | uint32_t bank_nb_access [_param->_nb_bank]; |
---|
| 31 | Tcontrol_t commit_ack [_param->_nb_inst_commit]; |
---|
| 32 | // Initialisation |
---|
| 33 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 34 | { |
---|
| 35 | bank_nb_access [i] = 0; |
---|
| 36 | for (uint32_t j=0; j<_param->_nb_bank_access_commit; j++) |
---|
| 37 | internal_BANK_COMMIT_VAL [i][j] = false; |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | // commit interface |
---|
| 41 | for (uint32_t i=0; i<_param->_nb_inst_commit; i++) |
---|
| 42 | { |
---|
| 43 | commit_ack [i] = false; |
---|
| 44 | |
---|
| 45 | // Test if have instruction |
---|
| 46 | if (PORT_READ(in_COMMIT_VAL [i])) |
---|
| 47 | { |
---|
| 48 | Tpacket_t packet = (_param->_have_port_rob_ptr )?PORT_READ(in_COMMIT_PACKET_ID [i]):0; |
---|
| 49 | uint32_t num_bank = packet >> _param->_shift_num_bank; |
---|
| 50 | uint32_t num_bank_access = bank_nb_access [num_bank]; |
---|
| 51 | |
---|
| 52 | // test if bank is not busy (previous access) |
---|
| 53 | if (num_bank_access < _param->_nb_bank_access_commit) |
---|
| 54 | { |
---|
| 55 | // find |
---|
| 56 | bank_nb_access [num_bank] ++; |
---|
| 57 | commit_ack [i] = true; |
---|
| 58 | |
---|
| 59 | internal_BANK_COMMIT_VAL [num_bank][num_bank_access] = true; |
---|
| 60 | internal_BANK_COMMIT_NUM_INST [num_bank][num_bank_access] = i; |
---|
| 61 | |
---|
| 62 | Tpacket_t packet_id = packet & _param->_mask_size_bank; |
---|
| 63 | |
---|
| 64 | // find the good entry !!! |
---|
| 65 | entry_t* entry = NULL; |
---|
| 66 | for (std::list<entry_t*>::iterator it=_rob[num_bank].begin(); |
---|
| 67 | it!=_rob[num_bank].end(); |
---|
| 68 | it++) |
---|
| 69 | if ((*it)->ptr == packet_id) |
---|
| 70 | { |
---|
| 71 | entry = (*it); |
---|
| 72 | break; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | #ifdef DEBUG_TEST |
---|
| 76 | if (entry == NULL) |
---|
| 77 | throw ERRORMORPHEO(FUNCTION,_("Commit : Packet_id miss match in the Re Order Buffer.\n")); |
---|
| 78 | #endif |
---|
| 79 | |
---|
| 80 | internal_BANK_COMMIT_ENTRY [num_bank][num_bank_access] = entry; |
---|
| 81 | |
---|
| 82 | // PORT_WRITE(out_COMMIT_NUM_REG_RD [i],(entry->rename_unit_id << _param->_size_general_register)+entry->num_reg_rd_phy_new); |
---|
| 83 | PORT_WRITE(out_COMMIT_NUM_REG_RD [i],entry->num_reg_rd_phy_new); |
---|
| 84 | } |
---|
| 85 | #ifdef STATISTICS |
---|
| 86 | else |
---|
| 87 | { |
---|
| 88 | internal_BANK_COMMIT_CONFLIT_ACCESS ++; |
---|
| 89 | } |
---|
| 90 | #endif |
---|
| 91 | } |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | for (uint32_t i=0; i<_param->_nb_inst_commit; i++) |
---|
| 95 | PORT_WRITE(out_COMMIT_ACK [i],commit_ack [i]); |
---|
| 96 | |
---|
| 97 | log_end(Commit_unit,FUNCTION); |
---|
| 98 | }; |
---|
| 99 | |
---|
| 100 | }; // end namespace commit_unit |
---|
| 101 | }; // end namespace ooo_engine |
---|
| 102 | }; // end namespace multi_ooo_engine |
---|
| 103 | }; // end namespace core |
---|
| 104 | }; // end namespace behavioural |
---|
| 105 | }; // end namespace morpheo |
---|
| 106 | #endif |
---|