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