[78] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Free_List_unit_transition.cpp 137 2010-02-16 12:35:48Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Free_List_unit/include/Free_List_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 free_list_unit { |
---|
| 19 | |
---|
| 20 | |
---|
| 21 | #undef FUNCTION |
---|
| 22 | #define FUNCTION "Free_List_unit::transition" |
---|
| 23 | void Free_List_unit::transition (void) |
---|
| 24 | { |
---|
[88] | 25 | log_begin(Free_List_unit,FUNCTION); |
---|
| 26 | log_function(Free_List_unit,FUNCTION,_name.c_str()); |
---|
[78] | 27 | |
---|
| 28 | if (PORT_READ(in_NRESET) == 0) |
---|
| 29 | { |
---|
[109] | 30 | _priority_gpr->reset(); |
---|
| 31 | _priority_spr->reset(); |
---|
| 32 | |
---|
[78] | 33 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 34 | { |
---|
| 35 | _gpr_list[i].clear(); |
---|
| 36 | _spr_list[i].clear(); |
---|
| 37 | } |
---|
| 38 | } |
---|
| 39 | else |
---|
| 40 | { |
---|
[109] | 41 | _priority_gpr->transition(); |
---|
| 42 | _priority_spr->transition(); |
---|
| 43 | |
---|
[78] | 44 | // ================================================== |
---|
| 45 | // =====[ POP ]====================================== |
---|
| 46 | // ================================================== |
---|
| 47 | for (uint32_t i=0; i<_param->_nb_pop; i++) |
---|
| 48 | if (PORT_READ(in_POP_VAL[i]) and internal_POP_ACK [i]) |
---|
| 49 | { |
---|
[88] | 50 | log_printf(TRACE,Free_List_unit,FUNCTION," * POP [%d]",i); |
---|
| 51 | |
---|
[110] | 52 | #ifdef STATISTICS |
---|
[112] | 53 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 54 | (*_stat_nb_inst_pop) ++; |
---|
[110] | 55 | #endif |
---|
| 56 | |
---|
[78] | 57 | if (PORT_READ(in_POP_GPR_VAL [i])) |
---|
[110] | 58 | { |
---|
| 59 | #ifdef STATISTICS |
---|
[112] | 60 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 61 | (*_stat_nb_inst_pop_gpr) ++; |
---|
[110] | 62 | #endif |
---|
| 63 | _gpr_list [internal_POP_GPR_BANK[i]].pop_front(); |
---|
| 64 | } |
---|
[78] | 65 | |
---|
| 66 | if (PORT_READ(in_POP_SPR_VAL [i])) |
---|
[110] | 67 | { |
---|
| 68 | #ifdef STATISTICS |
---|
[112] | 69 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 70 | (*_stat_nb_inst_pop_spr) ++; |
---|
[110] | 71 | #endif |
---|
| 72 | _spr_list [internal_POP_SPR_BANK[i]].pop_front(); |
---|
| 73 | } |
---|
[78] | 74 | } |
---|
| 75 | |
---|
| 76 | // ================================================== |
---|
| 77 | // =====[ PUSH_GPR ]================================= |
---|
| 78 | // ================================================== |
---|
| 79 | for (uint32_t i=0; i<_param->_nb_push; i++) |
---|
| 80 | if (PORT_READ(in_PUSH_GPR_VAL[i]) and internal_PUSH_GPR_ACK [i]) |
---|
[88] | 81 | { |
---|
| 82 | log_printf(TRACE,Free_List_unit,FUNCTION," * PUSH_GPR[%d]",i); |
---|
[108] | 83 | log_printf(TRACE,Free_List_unit,FUNCTION," * bank : %d",internal_PUSH_GPR_BANK[i]); |
---|
| 84 | log_printf(TRACE,Free_List_unit,FUNCTION," * num_reg : %d",PORT_READ(in_PUSH_GPR_NUM_REG [i])); |
---|
[78] | 85 | |
---|
[110] | 86 | #ifdef STATISTICS |
---|
[112] | 87 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 88 | (*_stat_nb_inst_push_gpr) ++; |
---|
[110] | 89 | #endif |
---|
| 90 | |
---|
[108] | 91 | _gpr_list [internal_PUSH_GPR_BANK[i]].push_back(PORT_READ(in_PUSH_GPR_NUM_REG [i])); |
---|
[88] | 92 | } |
---|
[78] | 93 | // ================================================== |
---|
| 94 | // =====[ PUSH_SPR ]================================= |
---|
| 95 | // ================================================== |
---|
| 96 | for (uint32_t i=0; i<_param->_nb_push; i++) |
---|
| 97 | if (PORT_READ(in_PUSH_SPR_VAL[i]) and internal_PUSH_SPR_ACK [i]) |
---|
[88] | 98 | { |
---|
| 99 | log_printf(TRACE,Free_List_unit,FUNCTION," * PUSH_SPR[%d]",i); |
---|
[108] | 100 | log_printf(TRACE,Free_List_unit,FUNCTION," * bank : %d",internal_PUSH_SPR_BANK[i]); |
---|
| 101 | log_printf(TRACE,Free_List_unit,FUNCTION," * num_reg : %d",PORT_READ(in_PUSH_SPR_NUM_REG [i])); |
---|
[78] | 102 | |
---|
[110] | 103 | #ifdef STATISTICS |
---|
[112] | 104 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
| 105 | (*_stat_nb_inst_push_spr) ++; |
---|
[110] | 106 | #endif |
---|
| 107 | |
---|
[108] | 108 | _spr_list [internal_PUSH_SPR_BANK[i]].push_back(PORT_READ(in_PUSH_SPR_NUM_REG [i])); |
---|
[88] | 109 | } |
---|
| 110 | |
---|
[110] | 111 | #ifdef STATISTICS |
---|
[112] | 112 | if (usage_is_set(_usage,USE_STATISTICS)) |
---|
[110] | 113 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
| 114 | { |
---|
[112] | 115 | |
---|
[110] | 116 | (*(_stat_bank_gpr_nb_elt [i])) += _gpr_list[i].size(); |
---|
| 117 | (*(_stat_bank_spr_nb_elt [i])) += _spr_list[i].size(); |
---|
| 118 | } |
---|
| 119 | #endif |
---|
| 120 | |
---|
[88] | 121 | #if (DEBUG >= DEBUG_TRACE) and (DEBUG_Free_List_unit == true) |
---|
[137] | 122 | if (0) |
---|
[106] | 123 | { |
---|
| 124 | uint32_t limit = 4; |
---|
| 125 | |
---|
| 126 | log_printf(TRACE,Free_List_unit,FUNCTION," * Dump Free List"); |
---|
| 127 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
| 128 | { |
---|
[108] | 129 | log_printf(TRACE,Free_List_unit,FUNCTION," * GPR [%d] - NB_ELT : %d",i,_gpr_list[i].size()); |
---|
| 130 | |
---|
[106] | 131 | uint32_t j=0; |
---|
[108] | 132 | for (std::list<Tgeneral_address_t>::iterator it=_gpr_list[i].begin(); |
---|
| 133 | it!=_gpr_list[i].end(); |
---|
[106] | 134 | ) |
---|
| 135 | { |
---|
| 136 | std::string str = ""; |
---|
| 137 | |
---|
| 138 | for (uint32_t x=0; x<limit; x++) |
---|
| 139 | { |
---|
[108] | 140 | if (it==_gpr_list[i].end()) |
---|
[106] | 141 | break; |
---|
| 142 | else |
---|
| 143 | str+=toString("GPR[%.4d][%.4d] : %.5d | ",i,j,*it); |
---|
| 144 | ++it; |
---|
| 145 | ++j; |
---|
| 146 | } |
---|
| 147 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * %s",str.c_str()); |
---|
| 148 | } |
---|
| 149 | } |
---|
[88] | 150 | |
---|
[106] | 151 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
| 152 | { |
---|
[108] | 153 | log_printf(TRACE,Free_List_unit,FUNCTION," * SPR [%d] - NB_ELT : %d",i,_spr_list[i].size()); |
---|
| 154 | |
---|
[106] | 155 | uint32_t j=0; |
---|
[108] | 156 | for (std::list<Tspecial_address_t>::iterator it=_spr_list[i].begin(); |
---|
| 157 | it!=_spr_list[i].end(); |
---|
[106] | 158 | ) |
---|
| 159 | { |
---|
| 160 | std::string str = ""; |
---|
| 161 | |
---|
| 162 | for (uint32_t x=0; x<limit; x++) |
---|
| 163 | { |
---|
[108] | 164 | if (it==_spr_list[i].end()) |
---|
[106] | 165 | break; |
---|
| 166 | else |
---|
| 167 | str+=toString("SPR[%.4d][%.4d] : %.5d | ",i,j,*it); |
---|
| 168 | ++it; |
---|
| 169 | ++j; |
---|
| 170 | } |
---|
| 171 | log_printf(TRACE,Register_Address_Translation_unit,FUNCTION," * %s",str.c_str()); |
---|
| 172 | } |
---|
| 173 | } |
---|
| 174 | } |
---|
| 175 | #endif |
---|
| 176 | |
---|
| 177 | #ifdef DEBUG_TEST |
---|
[137] | 178 | if (0) |
---|
[108] | 179 | for (uint32_t i=0; i<_param->_nb_bank; ++i) |
---|
[110] | 180 | { |
---|
[108] | 181 | for (std::list<Tgeneral_address_t>::iterator it1=_gpr_list[i].begin(); |
---|
| 182 | it1!=_gpr_list[i].end(); |
---|
[106] | 183 | ++it1 |
---|
| 184 | ) |
---|
[88] | 185 | { |
---|
[106] | 186 | std::list<Tgeneral_address_t>::iterator it2 = it1; |
---|
| 187 | |
---|
| 188 | it2 ++; |
---|
[108] | 189 | while (it2 != _gpr_list[i].end()) |
---|
[106] | 190 | { |
---|
| 191 | if (*it1 == *it2) |
---|
| 192 | throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same GPR (%d)"),*it1)); |
---|
| 193 | it2 ++; |
---|
| 194 | } |
---|
[88] | 195 | } |
---|
[106] | 196 | |
---|
[108] | 197 | for (std::list<Tspecial_address_t>::iterator it1=_spr_list[i].begin(); |
---|
| 198 | it1!=_spr_list[i].end(); |
---|
[106] | 199 | ++it1 |
---|
| 200 | ) |
---|
[88] | 201 | { |
---|
[106] | 202 | std::list<Tspecial_address_t>::iterator it2 = it1; |
---|
| 203 | |
---|
| 204 | it2 ++; |
---|
[108] | 205 | while (it2 != _spr_list[i].end()) |
---|
[106] | 206 | { |
---|
| 207 | if (*it1 == *it2) |
---|
| 208 | throw ERRORMORPHEO (FUNCTION,toString(_("In free list, Same SPR (%d)"),*it1)); |
---|
| 209 | it2 ++; |
---|
| 210 | } |
---|
[88] | 211 | } |
---|
| 212 | } |
---|
[106] | 213 | #endif |
---|
[88] | 214 | |
---|
[78] | 215 | } |
---|
| 216 | |
---|
| 217 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 218 | end_cycle (); |
---|
| 219 | #endif |
---|
| 220 | |
---|
[88] | 221 | log_end(Free_List_unit,FUNCTION); |
---|
[78] | 222 | }; |
---|
| 223 | |
---|
| 224 | }; // end namespace free_list_unit |
---|
| 225 | }; // end namespace register_translation_unit |
---|
| 226 | }; // end namespace rename_unit |
---|
| 227 | }; // end namespace ooo_engine |
---|
| 228 | }; // end namespace multi_ooo_engine |
---|
| 229 | }; // end namespace core |
---|
| 230 | |
---|
| 231 | }; // end namespace behavioural |
---|
| 232 | }; // end namespace morpheo |
---|
| 233 | #endif |
---|