[88] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Register_Address_Translation_unit_genMealy_retire.cpp 122 2009-06-03 08:15:51Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/include/Register_Address_Translation_unit.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_ooo_engine { |
---|
| 15 | namespace ooo_engine { |
---|
| 16 | namespace rename_unit { |
---|
| 17 | namespace register_translation_unit { |
---|
| 18 | namespace register_address_translation_unit { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Register_Address_Translation_unit::genMealy_retire" |
---|
| 23 | void Register_Address_Translation_unit::genMealy_retire (void) |
---|
| 24 | { |
---|
| 25 | log_begin(Register_Address_Translation_unit,FUNCTION); |
---|
| 26 | log_function(Register_Address_Translation_unit,FUNCTION,_name.c_str()); |
---|
| 27 | |
---|
[122] | 28 | if (PORT_READ(in_NRESET) != 0) |
---|
| 29 | { |
---|
[88] | 30 | // Init internal update table |
---|
| 31 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 32 | for (uint32_t j=0; j<_param->_nb_context[i]; j++) |
---|
| 33 | { |
---|
[122] | 34 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * init [%d][%d]",i,j); |
---|
| 35 | |
---|
[106] | 36 | // An event occure |
---|
[112] | 37 | // bool event = (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) != EVENT_STATE_NO_EVENT); |
---|
| 38 | bool reset_update_table = (PORT_READ(in_RETIRE_EVENT_VAL [i][j]) and // always ack |
---|
| 39 | (PORT_READ(in_RETIRE_EVENT_STATE [i][j]) == EVENT_STATE_EVENT)); |
---|
| 40 | |
---|
[122] | 41 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * reset_update_table : %d",reset_update_table); |
---|
| 42 | |
---|
[112] | 43 | // not event -> update_table == 1 -> always update |
---|
| 44 | // event -> update_table and not reset |
---|
[88] | 45 | for (uint32_t k=0; k<_param->_nb_general_register_logic; ++k) |
---|
[112] | 46 | internal_rat_gpr_update_table [i][j][k] = // not event or |
---|
[122] | 47 | (not reset_update_table and rat_gpr_update_table [i][j][k]); |
---|
[88] | 48 | for (uint32_t k=0; k<_param->_nb_special_register_logic; ++k) |
---|
[112] | 49 | internal_rat_spr_update_table [i][j][k] = // not event or |
---|
[122] | 50 | (not reset_update_table and rat_spr_update_table [i][j][k]); |
---|
[88] | 51 | } |
---|
| 52 | |
---|
| 53 | // RETIRE is in order -> also don't need test if an instruction is valid |
---|
| 54 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 55 | { |
---|
| 56 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * inst_retire [%d]",i); |
---|
| 57 | |
---|
| 58 | // init -> need't restore old value |
---|
[104] | 59 | Tcontrol_t retire_restore_rd_phy_old = false; |
---|
| 60 | Tcontrol_t retire_restore_re_phy_old = false; |
---|
[88] | 61 | |
---|
[122] | 62 | Tcontext_t front_end_id = (_param->_have_port_front_end_id)?PORT_READ(in_RETIRE_FRONT_END_ID [i]):0; |
---|
| 63 | Tcontext_t context_id = (_param->_have_port_context_id )?PORT_READ(in_RETIRE_CONTEXT_ID [i]):0; |
---|
| 64 | Tcontrol_t retire_restore = (PORT_READ(in_RETIRE_EVENT_STATE [front_end_id][context_id]) != EVENT_STATE_NO_EVENT); |
---|
[104] | 65 | |
---|
[122] | 66 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * front_end_id : %d",front_end_id); |
---|
| 67 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * context_id : %d",context_id ); |
---|
| 68 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * restore : %d",retire_restore); |
---|
| 69 | |
---|
[88] | 70 | // Test if event -> need restore ? |
---|
[122] | 71 | if (retire_restore) |
---|
[88] | 72 | { |
---|
[122] | 73 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * Have event"); |
---|
[88] | 74 | |
---|
| 75 | // Test and update update table |
---|
| 76 | if (PORT_READ(in_RETIRE_WRITE_RD [i])) |
---|
| 77 | { |
---|
| 78 | Tgeneral_address_t rd_log = PORT_READ(in_RETIRE_NUM_REG_RD_LOG [i]); |
---|
| 79 | retire_restore_rd_phy_old = (internal_rat_gpr_update_table[front_end_id][context_id][rd_log] == 0); |
---|
| 80 | |
---|
| 81 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * write_rd"); |
---|
| 82 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * rd_log : %d",rd_log); |
---|
| 83 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * rat_gpr_update : %d",internal_rat_gpr_update_table[front_end_id][context_id][rd_log]); |
---|
| 84 | |
---|
| 85 | internal_rat_gpr_update_table[front_end_id][context_id][rd_log] = 1; |
---|
| 86 | } |
---|
| 87 | if (PORT_READ(in_RETIRE_WRITE_RE [i])) |
---|
| 88 | { |
---|
| 89 | // log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * write_re"); |
---|
| 90 | |
---|
| 91 | Tgeneral_address_t re_log = PORT_READ(in_RETIRE_NUM_REG_RE_LOG [i]); |
---|
| 92 | retire_restore_re_phy_old = (internal_rat_spr_update_table[front_end_id][context_id][re_log] == 0); |
---|
| 93 | internal_rat_spr_update_table[front_end_id][context_id][re_log] = 1; |
---|
| 94 | } |
---|
| 95 | |
---|
[122] | 96 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * restore_rd_phy_old : %d",retire_restore_rd_phy_old); |
---|
| 97 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * restore_re_phy_old : %d",retire_restore_re_phy_old); |
---|
[88] | 98 | } |
---|
[112] | 99 | |
---|
[122] | 100 | internal_RETIRE_RESTORE [i] = retire_restore; |
---|
| 101 | internal_RETIRE_RESTORE_RD_PHY_OLD [i] = retire_restore_rd_phy_old; |
---|
| 102 | internal_RETIRE_RESTORE_RE_PHY_OLD [i] = retire_restore_re_phy_old; |
---|
[88] | 103 | |
---|
[122] | 104 | PORT_WRITE(out_RETIRE_RESTORE [i], internal_RETIRE_RESTORE [i]); |
---|
| 105 | PORT_WRITE(out_RETIRE_RESTORE_RD_PHY_OLD[i], internal_RETIRE_RESTORE_RD_PHY_OLD [i]); |
---|
| 106 | PORT_WRITE(out_RETIRE_RESTORE_RE_PHY_OLD[i], internal_RETIRE_RESTORE_RE_PHY_OLD [i]); |
---|
[88] | 107 | } |
---|
[122] | 108 | } |
---|
[88] | 109 | |
---|
| 110 | log_end(Register_Address_Translation_unit,FUNCTION); |
---|
| 111 | }; |
---|
| 112 | |
---|
| 113 | }; // end namespace register_address_translation_unit |
---|
| 114 | }; // end namespace register_translation_unit |
---|
| 115 | }; // end namespace rename_unit |
---|
| 116 | }; // end namespace ooo_engine |
---|
| 117 | }; // end namespace multi_ooo_engine |
---|
| 118 | }; // end namespace core |
---|
| 119 | |
---|
| 120 | }; // end namespace behavioural |
---|
| 121 | }; // end namespace morpheo |
---|
| 122 | #endif |
---|