[78] | 1 | /* |
---|
| 2 | * $Id: test.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | * Test |
---|
| 7 | */ |
---|
| 8 | |
---|
[82] | 9 | #define NB_ITERATION 64 |
---|
| 10 | #define CYCLE_MAX (1024*NB_ITERATION) |
---|
| 11 | |
---|
[78] | 12 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Register_Address_Translation_unit/SelfTest/include/test.h" |
---|
| 13 | #include "Common/include/Test.h" |
---|
| 14 | #include "Common/include/Max.h" |
---|
| 15 | #include "Behavioural/include/Allocation.h" |
---|
| 16 | |
---|
| 17 | void test (string name, |
---|
| 18 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::register_translation_unit::register_address_translation_unit::Parameters * _param) |
---|
| 19 | { |
---|
| 20 | msg(_("<%s> : Simulation SystemC.\n"),name.c_str()); |
---|
| 21 | |
---|
| 22 | #ifdef STATISTICS |
---|
| 23 | morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50); |
---|
| 24 | #endif |
---|
| 25 | |
---|
[88] | 26 | Tusage_t _usage = USE_ALL; |
---|
| 27 | |
---|
| 28 | // _usage = usage_unset(_usage,USE_SYSTEMC ); |
---|
| 29 | // _usage = usage_unset(_usage,USE_VHDL ); |
---|
| 30 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH ); |
---|
| 31 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
| 32 | // _usage = usage_unset(_usage,USE_POSITION ); |
---|
| 33 | // _usage = usage_unset(_usage,USE_STATISTICS ); |
---|
| 34 | // _usage = usage_unset(_usage,USE_INFORMATION ); |
---|
| 35 | |
---|
[82] | 36 | Register_Address_Translation_unit * _Register_Address_Translation_unit = new Register_Address_Translation_unit |
---|
| 37 | (name.c_str(), |
---|
[78] | 38 | #ifdef STATISTICS |
---|
[82] | 39 | _parameters_statistics, |
---|
[78] | 40 | #endif |
---|
[82] | 41 | _param, |
---|
[88] | 42 | _usage); |
---|
[78] | 43 | |
---|
| 44 | #ifdef SYSTEMC |
---|
| 45 | /********************************************************************* |
---|
| 46 | * Déclarations des signaux |
---|
| 47 | *********************************************************************/ |
---|
| 48 | string rename; |
---|
| 49 | |
---|
| 50 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
| 51 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
| 52 | |
---|
| 53 | ALLOC1_SC_SIGNAL( in_RENAME_VAL ," in_RENAME_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 54 | ALLOC1_SC_SIGNAL(out_RENAME_ACK ,"out_RENAME_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 55 | ALLOC1_SC_SIGNAL( in_RENAME_FRONT_END_ID ," in_RENAME_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 56 | ALLOC1_SC_SIGNAL( in_RENAME_CONTEXT_ID ," in_RENAME_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 57 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RA_LOG ," in_RENAME_NUM_REG_RA_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 58 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RB_LOG ," in_RENAME_NUM_REG_RB_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 59 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RC_LOG ," in_RENAME_NUM_REG_RC_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 60 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RD_LOG ," in_RENAME_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 61 | ALLOC1_SC_SIGNAL( in_RENAME_NUM_REG_RE_LOG ," in_RENAME_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 62 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RA_PHY ,"out_RENAME_NUM_REG_RA_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 63 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RB_PHY ,"out_RENAME_NUM_REG_RB_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 64 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RC_PHY ,"out_RENAME_NUM_REG_RC_PHY ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 65 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RD_PHY_OLD,"out_RENAME_NUM_REG_RD_PHY_OLD",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 66 | ALLOC1_SC_SIGNAL(out_RENAME_NUM_REG_RE_PHY_OLD,"out_RENAME_NUM_REG_RE_PHY_OLD",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 67 | |
---|
| 68 | ALLOC1_SC_SIGNAL( in_INSERT_VAL ," in_INSERT_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 69 | ALLOC1_SC_SIGNAL(out_INSERT_ACK ,"out_INSERT_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 70 | //ALLOC1_SC_SIGNAL( in_INSERT_FRONT_END_ID ," in_INSERT_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 71 | //ALLOC1_SC_SIGNAL( in_INSERT_CONTEXT_ID ," in_INSERT_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 72 | ALLOC1_SC_SIGNAL( in_INSERT_WRITE_RD ," in_INSERT_WRITE_RD ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 73 | ALLOC1_SC_SIGNAL( in_INSERT_WRITE_RE ," in_INSERT_WRITE_RE ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 74 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RD_LOG ," in_INSERT_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 75 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RE_LOG ," in_INSERT_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 76 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RD_PHY ," in_INSERT_NUM_REG_RD_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 77 | ALLOC1_SC_SIGNAL( in_INSERT_NUM_REG_RE_PHY ," in_INSERT_NUM_REG_RE_PHY ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 78 | |
---|
| 79 | ALLOC1_SC_SIGNAL( in_RETIRE_VAL ," in_RETIRE_VAL ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 80 | ALLOC1_SC_SIGNAL(out_RETIRE_ACK ,"out_RETIRE_ACK ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 81 | ALLOC1_SC_SIGNAL( in_RETIRE_FRONT_END_ID ," in_RETIRE_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_retire); |
---|
| 82 | ALLOC1_SC_SIGNAL( in_RETIRE_CONTEXT_ID ," in_RETIRE_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_retire); |
---|
| 83 | ALLOC1_SC_SIGNAL( in_RETIRE_EVENT_STATE ," in_RETIRE_EVENT_STATE ",Tevent_state_t ,_param->_nb_inst_retire); |
---|
| 84 | ALLOC1_SC_SIGNAL( in_RETIRE_WRITE_RD ," in_RETIRE_WRITE_RD ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 85 | ALLOC1_SC_SIGNAL( in_RETIRE_WRITE_RE ," in_RETIRE_WRITE_RE ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 86 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RD_LOG ," in_RETIRE_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_retire); |
---|
| 87 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RE_LOG ," in_RETIRE_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_retire); |
---|
| 88 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RD_PHY_OLD," in_RETIRE_NUM_REG_RD_PHY_OLD",Tgeneral_address_t,_param->_nb_inst_retire); |
---|
| 89 | ALLOC1_SC_SIGNAL( in_RETIRE_NUM_REG_RE_PHY_OLD," in_RETIRE_NUM_REG_RE_PHY_OLD",Tspecial_address_t,_param->_nb_inst_retire); |
---|
[88] | 90 | ALLOC1_SC_SIGNAL(out_RETIRE_RESTORE_RD_PHY_OLD,"out_RETIRE_RESTORE_RD_PHY_OLD",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 91 | ALLOC1_SC_SIGNAL(out_RETIRE_RESTORE_RE_PHY_OLD,"out_RETIRE_RESTORE_RE_PHY_OLD",Tcontrol_t ,_param->_nb_inst_retire); |
---|
[78] | 92 | |
---|
| 93 | /******************************************************** |
---|
| 94 | * Instanciation |
---|
| 95 | ********************************************************/ |
---|
| 96 | |
---|
| 97 | msg(_("<%s> : Instanciation of _Register_Address_Translation_unit.\n"),name.c_str()); |
---|
| 98 | |
---|
| 99 | (*(_Register_Address_Translation_unit->in_CLOCK)) (*(in_CLOCK)); |
---|
| 100 | (*(_Register_Address_Translation_unit->in_NRESET)) (*(in_NRESET)); |
---|
| 101 | |
---|
| 102 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_VAL ,_param->_nb_inst_insert); |
---|
| 103 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_ACK ,_param->_nb_inst_insert); |
---|
| 104 | if (_param->_have_port_front_end_id) |
---|
| 105 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
| 106 | if (_param->_have_port_context_id) |
---|
| 107 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
| 108 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RA_LOG ,_param->_nb_inst_insert); |
---|
| 109 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RB_LOG ,_param->_nb_inst_insert); |
---|
| 110 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RC_LOG ,_param->_nb_inst_insert); |
---|
| 111 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RD_LOG ,_param->_nb_inst_insert); |
---|
| 112 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RENAME_NUM_REG_RE_LOG ,_param->_nb_inst_insert); |
---|
| 113 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RA_PHY ,_param->_nb_inst_insert); |
---|
| 114 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RB_PHY ,_param->_nb_inst_insert); |
---|
| 115 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RC_PHY ,_param->_nb_inst_insert); |
---|
| 116 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RD_PHY_OLD,_param->_nb_inst_insert); |
---|
| 117 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RENAME_NUM_REG_RE_PHY_OLD,_param->_nb_inst_insert); |
---|
| 118 | |
---|
| 119 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_VAL ,_param->_nb_inst_insert); |
---|
| 120 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_INSERT_ACK ,_param->_nb_inst_insert); |
---|
| 121 | //if (_param->_have_port_front_end_id) |
---|
| 122 | //INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
| 123 | //if (_param->_have_port_context_id) |
---|
| 124 | //INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
| 125 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_WRITE_RD ,_param->_nb_inst_insert); |
---|
| 126 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_WRITE_RE ,_param->_nb_inst_insert); |
---|
| 127 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RD_LOG ,_param->_nb_inst_insert); |
---|
| 128 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RE_LOG ,_param->_nb_inst_insert); |
---|
| 129 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RD_PHY ,_param->_nb_inst_insert); |
---|
| 130 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_INSERT_NUM_REG_RE_PHY ,_param->_nb_inst_insert); |
---|
| 131 | |
---|
| 132 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_VAL ,_param->_nb_inst_retire); |
---|
| 133 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RETIRE_ACK ,_param->_nb_inst_retire); |
---|
| 134 | if (_param->_have_port_front_end_id) |
---|
| 135 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_FRONT_END_ID ,_param->_nb_inst_retire); |
---|
| 136 | if (_param->_have_port_context_id) |
---|
| 137 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_CONTEXT_ID ,_param->_nb_inst_retire); |
---|
| 138 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_EVENT_STATE ,_param->_nb_inst_retire); |
---|
| 139 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_WRITE_RD ,_param->_nb_inst_retire); |
---|
| 140 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_WRITE_RE ,_param->_nb_inst_retire); |
---|
| 141 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RD_LOG ,_param->_nb_inst_retire); |
---|
| 142 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RE_LOG ,_param->_nb_inst_retire); |
---|
| 143 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RD_PHY_OLD,_param->_nb_inst_retire); |
---|
| 144 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit, in_RETIRE_NUM_REG_RE_PHY_OLD,_param->_nb_inst_retire); |
---|
[88] | 145 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RETIRE_RESTORE_RD_PHY_OLD,_param->_nb_inst_retire); |
---|
| 146 | INSTANCE1_SC_SIGNAL(_Register_Address_Translation_unit,out_RETIRE_RESTORE_RE_PHY_OLD,_param->_nb_inst_retire); |
---|
[78] | 147 | |
---|
| 148 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
| 149 | |
---|
| 150 | Time * _time = new Time(); |
---|
| 151 | |
---|
| 152 | /******************************************************** |
---|
| 153 | * Simulation - Begin |
---|
| 154 | ********************************************************/ |
---|
| 155 | |
---|
| 156 | // Initialisation |
---|
| 157 | |
---|
| 158 | const uint32_t seed = 0; |
---|
| 159 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 160 | |
---|
| 161 | srand(seed); |
---|
| 162 | |
---|
| 163 | const int32_t percent_transaction_insert = 75; |
---|
| 164 | const int32_t percent_transaction_retire = 75; |
---|
| 165 | |
---|
| 166 | uint32_t max_nb_context = max(_param->_nb_context,_param->_nb_front_end); |
---|
| 167 | |
---|
| 168 | Tgeneral_address_t rat_gpr [_param->_nb_front_end][max_nb_context][_param->_nb_general_register_logic]; |
---|
| 169 | Tspecial_address_t rat_spr [_param->_nb_front_end][max_nb_context][_param->_nb_special_register_logic]; |
---|
| 170 | bool rat_gpr_updt [_param->_nb_front_end][max_nb_context][_param->_nb_general_register_logic]; |
---|
| 171 | bool rat_spr_updt [_param->_nb_front_end][max_nb_context][_param->_nb_special_register_logic]; |
---|
| 172 | |
---|
| 173 | uint32_t gpr=1; |
---|
| 174 | uint32_t spr=0; |
---|
| 175 | for (uint32_t i=0; i<_param->_nb_front_end; i++) |
---|
| 176 | for (uint32_t j=0; j<_param->_nb_context[i]; j++) |
---|
| 177 | { |
---|
| 178 | rat_gpr [i][j][0] = 0; |
---|
| 179 | |
---|
| 180 | for (uint32_t k=1; k<_param->_nb_general_register_logic; k++) |
---|
| 181 | { |
---|
| 182 | rat_gpr [i][j][k] = gpr++; |
---|
| 183 | rat_gpr_updt [i][j][k] = false; |
---|
| 184 | } |
---|
| 185 | for (uint32_t k=0; k<_param->_nb_special_register_logic; k++) |
---|
| 186 | { |
---|
| 187 | rat_spr [i][j][k] = spr++; |
---|
| 188 | rat_spr_updt [i][j][k] = false; |
---|
| 189 | } |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | SC_START(0); |
---|
| 193 | LABEL("Initialisation"); |
---|
| 194 | |
---|
| 195 | LABEL("Reset"); |
---|
| 196 | in_NRESET->write(0); |
---|
| 197 | SC_START(5); |
---|
| 198 | in_NRESET->write(1); |
---|
| 199 | |
---|
| 200 | LABEL("Loop of Test"); |
---|
| 201 | |
---|
| 202 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
| 203 | { |
---|
| 204 | int32_t nb_request; |
---|
| 205 | |
---|
| 206 | LABEL("Iteration %d",iteration); |
---|
| 207 | |
---|
| 208 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 209 | { |
---|
| 210 | in_RENAME_VAL [i]->write(0); |
---|
| 211 | in_INSERT_VAL [i]->write(0); |
---|
| 212 | } |
---|
| 213 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 214 | in_RETIRE_VAL [i]->write(0); |
---|
| 215 | |
---|
| 216 | nb_request = 32; |
---|
| 217 | while (nb_request > 1) |
---|
| 218 | { |
---|
| 219 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 220 | { |
---|
| 221 | Tcontrol_t val = (rand()%100)<percent_transaction_insert; |
---|
| 222 | |
---|
| 223 | Tcontext_t front_end_id = rand() % _param->_nb_front_end; |
---|
| 224 | |
---|
| 225 | in_RENAME_VAL [i]->write(val); |
---|
| 226 | in_RENAME_FRONT_END_ID [i]->write(front_end_id); |
---|
| 227 | in_RENAME_CONTEXT_ID [i]->write(rand() % (_param->_nb_context[front_end_id])); |
---|
| 228 | in_RENAME_NUM_REG_RA_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
| 229 | in_RENAME_NUM_REG_RB_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
| 230 | in_RENAME_NUM_REG_RC_LOG [i]->write( rand() % _param->_nb_special_register_logic); |
---|
| 231 | in_RENAME_NUM_REG_RD_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
| 232 | in_RENAME_NUM_REG_RE_LOG [i]->write( rand() % _param->_nb_special_register_logic); |
---|
| 233 | in_INSERT_VAL [i]->write(val); |
---|
| 234 | in_INSERT_WRITE_RD [i]->write(rand() % 2); |
---|
| 235 | in_INSERT_WRITE_RE [i]->write(rand() % 2); |
---|
| 236 | in_INSERT_NUM_REG_RD_LOG [i]->write((rand() % (_param->_nb_general_register_logic-1))+1); |
---|
| 237 | in_INSERT_NUM_REG_RE_LOG [i]->write( rand() % _param->_nb_special_register_logic); |
---|
| 238 | in_INSERT_NUM_REG_RD_PHY [i]->write(rand() % _param->_nb_general_register); |
---|
| 239 | in_INSERT_NUM_REG_RE_PHY [i]->write(rand() % _param->_nb_special_register); |
---|
| 240 | } |
---|
| 241 | |
---|
[88] | 242 | uint32_t retire_max = _param->_nb_inst_retire; |
---|
[78] | 243 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 244 | { |
---|
[88] | 245 | // in order ........... |
---|
| 246 | |
---|
| 247 | Tcontrol_t val = (i<retire_max) and ((rand()%100)<percent_transaction_retire); |
---|
[78] | 248 | |
---|
[88] | 249 | if (not val) |
---|
| 250 | retire_max = i; |
---|
| 251 | |
---|
[78] | 252 | Tcontext_t front_end_id = rand() % _param->_nb_front_end; |
---|
| 253 | |
---|
| 254 | in_RETIRE_VAL [i]->write(val); |
---|
| 255 | in_RETIRE_FRONT_END_ID [i]->write(front_end_id); |
---|
| 256 | in_RETIRE_CONTEXT_ID [i]->write(rand() % (_param->_nb_context[front_end_id])); |
---|
| 257 | in_RETIRE_EVENT_STATE [i]->write(EVENT_STATE_NO_EVENT); |
---|
| 258 | in_RETIRE_WRITE_RD [i]->write(rand() % 2); |
---|
| 259 | in_RETIRE_WRITE_RE [i]->write(rand() % 2); |
---|
| 260 | in_RETIRE_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
| 261 | in_RETIRE_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
| 262 | in_RETIRE_NUM_REG_RD_PHY_OLD [i]->write(rand() % _param->_nb_general_register); |
---|
| 263 | in_RETIRE_NUM_REG_RE_PHY_OLD [i]->write(rand() % _param->_nb_special_register); |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | SC_START(1); |
---|
| 267 | |
---|
| 268 | |
---|
| 269 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 270 | { |
---|
| 271 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
| 272 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
| 273 | if (in_INSERT_VAL [i]->read() and out_INSERT_ACK [i]->read()) |
---|
| 274 | { |
---|
| 275 | if (in_INSERT_WRITE_RD [i]->read() == 1) |
---|
| 276 | rat_gpr[front_end_id][context_id][in_INSERT_NUM_REG_RD_LOG[i]->read()] = in_INSERT_NUM_REG_RD_PHY[i]->read(); |
---|
| 277 | if (in_INSERT_WRITE_RE [i]->read() == 1) |
---|
| 278 | rat_spr[front_end_id][context_id][in_INSERT_NUM_REG_RE_LOG[i]->read()] = in_INSERT_NUM_REG_RE_PHY[i]->read(); |
---|
| 279 | } |
---|
| 280 | } |
---|
[88] | 281 | |
---|
| 282 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 283 | { |
---|
| 284 | TEST(Tcontrol_t,out_RETIRE_RESTORE_RD_PHY_OLD[i]->read(), 0); |
---|
| 285 | TEST(Tcontrol_t,out_RETIRE_RESTORE_RE_PHY_OLD[i]->read(), 0); |
---|
| 286 | } |
---|
| 287 | |
---|
[78] | 288 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 289 | { |
---|
| 290 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
| 291 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
| 292 | if (in_RENAME_VAL [i]->read() and out_RENAME_ACK [i]->read()) |
---|
| 293 | { |
---|
| 294 | nb_request --; |
---|
| 295 | |
---|
| 296 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RA_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RA_LOG[i]->read()]); |
---|
| 297 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RB_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RB_LOG[i]->read()]); |
---|
| 298 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RC_PHY [i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RC_LOG[i]->read()]); |
---|
| 299 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RD_PHY_OLD[i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RD_LOG[i]->read()]); |
---|
| 300 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RE_PHY_OLD[i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RE_LOG[i]->read()]); |
---|
| 301 | } |
---|
| 302 | |
---|
| 303 | } |
---|
| 304 | } |
---|
| 305 | |
---|
| 306 | // Event |
---|
| 307 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 308 | { |
---|
| 309 | in_RENAME_VAL [i]->write(0); |
---|
| 310 | in_INSERT_VAL [i]->write(0); |
---|
| 311 | } |
---|
| 312 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 313 | in_RETIRE_VAL [i]->write(0); |
---|
| 314 | |
---|
| 315 | Tcontext_t retire_front_end_id [_param->_nb_inst_retire]; |
---|
| 316 | Tcontext_t retire_context_id [_param->_nb_inst_retire]; |
---|
| 317 | |
---|
| 318 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 319 | { |
---|
| 320 | retire_front_end_id [i] = rand() % _param->_nb_front_end; |
---|
| 321 | retire_context_id [i] = rand() % (_param->_nb_context[retire_front_end_id [i]]); |
---|
| 322 | |
---|
| 323 | for (uint32_t k=0; k<_param->_nb_general_register_logic; k++) |
---|
| 324 | rat_gpr_updt [retire_front_end_id [i]][retire_context_id [i]][k] = false; |
---|
| 325 | for (uint32_t k=0; k<_param->_nb_special_register_logic; k++) |
---|
| 326 | rat_spr_updt [retire_front_end_id [i]][retire_context_id [i]][k] = false; |
---|
| 327 | } |
---|
| 328 | |
---|
| 329 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 330 | { |
---|
| 331 | in_RETIRE_VAL [i]->write(1); |
---|
| 332 | in_RETIRE_FRONT_END_ID [i]->write(retire_front_end_id [i]); |
---|
| 333 | in_RETIRE_CONTEXT_ID [i]->write(retire_context_id [i]); |
---|
| 334 | in_RETIRE_EVENT_STATE [i]->write(EVENT_STATE_EVENT); |
---|
| 335 | in_RETIRE_WRITE_RD [i]->write(0); |
---|
| 336 | in_RETIRE_WRITE_RE [i]->write(0); |
---|
| 337 | |
---|
| 338 | do |
---|
| 339 | { |
---|
| 340 | SC_START(1); |
---|
| 341 | } |
---|
| 342 | while (out_RETIRE_ACK[i]->read() == 0); |
---|
| 343 | |
---|
| 344 | in_RETIRE_VAL [i]->write(0); |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | SC_START(1); |
---|
| 348 | |
---|
[88] | 349 | // EVENT !!!!!!!! |
---|
| 350 | |
---|
[78] | 351 | nb_request = 32; |
---|
| 352 | while (nb_request > 1) |
---|
| 353 | { |
---|
| 354 | |
---|
| 355 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 356 | { |
---|
| 357 | Tcontrol_t val = (rand()%100)<percent_transaction_insert; |
---|
| 358 | |
---|
| 359 | Tcontext_t front_end_id = rand() % _param->_nb_front_end; |
---|
| 360 | |
---|
| 361 | in_RENAME_VAL [i]->write(val); |
---|
| 362 | in_RENAME_FRONT_END_ID [i]->write(front_end_id); |
---|
| 363 | in_RENAME_CONTEXT_ID [i]->write(rand() % (_param->_nb_context[front_end_id])); |
---|
| 364 | in_RENAME_NUM_REG_RA_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
| 365 | in_RENAME_NUM_REG_RB_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
| 366 | in_RENAME_NUM_REG_RC_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
| 367 | in_RENAME_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
| 368 | in_RENAME_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
| 369 | in_INSERT_VAL [i]->write(val); |
---|
| 370 | in_INSERT_WRITE_RD [i]->write(rand() % 2); |
---|
| 371 | in_INSERT_WRITE_RE [i]->write(rand() % 2); |
---|
| 372 | in_INSERT_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
| 373 | in_INSERT_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
| 374 | in_INSERT_NUM_REG_RD_PHY [i]->write(rand() % _param->_nb_general_register); |
---|
| 375 | in_INSERT_NUM_REG_RE_PHY [i]->write(rand() % _param->_nb_special_register); |
---|
| 376 | } |
---|
| 377 | |
---|
[88] | 378 | uint32_t retire_max = _param->_nb_inst_retire; |
---|
[78] | 379 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 380 | { |
---|
[88] | 381 | // in order ........... |
---|
| 382 | |
---|
| 383 | Tcontrol_t val = (i<retire_max) and ((rand()%100)<percent_transaction_retire); |
---|
| 384 | |
---|
| 385 | if (not val) |
---|
| 386 | retire_max = i; |
---|
| 387 | |
---|
[78] | 388 | in_RETIRE_VAL [i]->write(val); |
---|
| 389 | in_RETIRE_FRONT_END_ID [i]->write(retire_front_end_id [i]); |
---|
| 390 | in_RETIRE_CONTEXT_ID [i]->write(retire_context_id [i]); |
---|
| 391 | in_RETIRE_EVENT_STATE [i]->write(EVENT_STATE_WAITEND); |
---|
| 392 | in_RETIRE_WRITE_RD [i]->write(rand() % 2); |
---|
| 393 | in_RETIRE_WRITE_RE [i]->write(rand() % 2); |
---|
| 394 | in_RETIRE_NUM_REG_RD_LOG [i]->write(rand() % _param->_nb_general_register_logic); |
---|
| 395 | in_RETIRE_NUM_REG_RE_LOG [i]->write(rand() % _param->_nb_special_register_logic); |
---|
| 396 | in_RETIRE_NUM_REG_RD_PHY_OLD [i]->write(rand() % _param->_nb_general_register); |
---|
| 397 | in_RETIRE_NUM_REG_RE_PHY_OLD [i]->write(rand() % _param->_nb_special_register); |
---|
| 398 | } |
---|
| 399 | |
---|
[88] | 400 | SC_START(0); |
---|
[78] | 401 | |
---|
| 402 | |
---|
| 403 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 404 | { |
---|
| 405 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
| 406 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
| 407 | if (in_INSERT_VAL [i]->read() and out_INSERT_ACK [i]->read()) |
---|
| 408 | { |
---|
| 409 | if (in_INSERT_WRITE_RD [i]->read() == 1) |
---|
| 410 | rat_gpr[front_end_id][context_id][in_INSERT_NUM_REG_RD_LOG[i]->read()] = in_INSERT_NUM_REG_RD_PHY[i]->read(); |
---|
| 411 | if (in_INSERT_WRITE_RE [i]->read() == 1) |
---|
| 412 | rat_spr[front_end_id][context_id][in_INSERT_NUM_REG_RE_LOG[i]->read()] = in_INSERT_NUM_REG_RE_PHY[i]->read(); |
---|
| 413 | } |
---|
| 414 | } |
---|
| 415 | |
---|
| 416 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 417 | { |
---|
[88] | 418 | LABEL("RETIRE[%d]",i); |
---|
| 419 | |
---|
[78] | 420 | Tcontext_t front_end_id = in_RETIRE_FRONT_END_ID [i]->read(); |
---|
| 421 | Tcontext_t context_id = in_RETIRE_CONTEXT_ID [i]->read(); |
---|
[88] | 422 | |
---|
| 423 | LABEL(" * front_end_id : %d",front_end_id); |
---|
| 424 | LABEL(" * context_id : %d",context_id ); |
---|
| 425 | |
---|
[78] | 426 | if (in_RETIRE_VAL [i]->read() and out_RETIRE_ACK [i]->read()) |
---|
| 427 | { |
---|
| 428 | if (in_RETIRE_WRITE_RD [i]->read() == 1) |
---|
| 429 | { |
---|
[88] | 430 | // LABEL(" * transaction and write rd"); |
---|
| 431 | // LABEL(" * rd_log : %d",in_RETIRE_NUM_REG_RD_LOG[i]->read()); |
---|
| 432 | // LABEL(" * rat_gpr_updt : %d",rat_gpr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()]); |
---|
| 433 | TEST(Tcontrol_t,out_RETIRE_RESTORE_RD_PHY_OLD[i]->read(), (rat_gpr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] == false)); |
---|
| 434 | |
---|
[78] | 435 | if (rat_gpr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] == false) |
---|
| 436 | rat_gpr[front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] = in_RETIRE_NUM_REG_RD_PHY_OLD[i]->read(); |
---|
| 437 | rat_gpr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RD_LOG[i]->read()] = true; |
---|
| 438 | } |
---|
| 439 | if (in_RETIRE_WRITE_RE [i]->read() == 1) |
---|
| 440 | { |
---|
[88] | 441 | TEST(Tcontrol_t,out_RETIRE_RESTORE_RE_PHY_OLD[i]->read(), (rat_spr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] == false)); |
---|
| 442 | |
---|
[78] | 443 | if (rat_spr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] == false) |
---|
| 444 | rat_spr[front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] = in_RETIRE_NUM_REG_RE_PHY_OLD[i]->read(); |
---|
| 445 | rat_spr_updt [front_end_id][context_id][in_RETIRE_NUM_REG_RE_LOG[i]->read()] = true; |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | } |
---|
[88] | 449 | |
---|
| 450 | SC_START(1); |
---|
| 451 | |
---|
[78] | 452 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 453 | { |
---|
| 454 | Tcontext_t front_end_id = in_RENAME_FRONT_END_ID [i]->read(); |
---|
| 455 | Tcontext_t context_id = in_RENAME_CONTEXT_ID [i]->read(); |
---|
| 456 | if (in_RENAME_VAL [i]->read() and out_RENAME_ACK [i]->read()) |
---|
| 457 | { |
---|
| 458 | nb_request --; |
---|
| 459 | |
---|
| 460 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RA_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RA_LOG[i]->read()]); |
---|
| 461 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RB_PHY [i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RB_LOG[i]->read()]); |
---|
| 462 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RC_PHY [i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RC_LOG[i]->read()]); |
---|
| 463 | TEST(Tgeneral_address_t,out_RENAME_NUM_REG_RD_PHY_OLD[i]->read(), rat_gpr[front_end_id][context_id][in_RENAME_NUM_REG_RD_LOG[i]->read()]); |
---|
| 464 | TEST(Tspecial_address_t,out_RENAME_NUM_REG_RE_PHY_OLD[i]->read(), rat_spr[front_end_id][context_id][in_RENAME_NUM_REG_RE_LOG[i]->read()]); |
---|
| 465 | } |
---|
[88] | 466 | } |
---|
[78] | 467 | |
---|
| 468 | } |
---|
| 469 | } |
---|
| 470 | |
---|
| 471 | /******************************************************** |
---|
| 472 | * Simulation - End |
---|
| 473 | ********************************************************/ |
---|
| 474 | |
---|
| 475 | TEST_OK ("End of Simulation"); |
---|
| 476 | delete _time; |
---|
| 477 | |
---|
| 478 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
| 479 | |
---|
| 480 | delete in_CLOCK; |
---|
| 481 | delete in_NRESET; |
---|
| 482 | |
---|
| 483 | delete [] in_RENAME_VAL ; |
---|
| 484 | delete [] out_RENAME_ACK ; |
---|
| 485 | if (_param->_have_port_front_end_id) |
---|
| 486 | delete [] in_RENAME_FRONT_END_ID ; |
---|
| 487 | if (_param->_have_port_context_id) |
---|
| 488 | delete [] in_RENAME_CONTEXT_ID ; |
---|
| 489 | delete [] in_RENAME_NUM_REG_RA_LOG ; |
---|
| 490 | delete [] in_RENAME_NUM_REG_RB_LOG ; |
---|
| 491 | delete [] in_RENAME_NUM_REG_RC_LOG ; |
---|
| 492 | delete [] in_RENAME_NUM_REG_RD_LOG ; |
---|
| 493 | delete [] in_RENAME_NUM_REG_RE_LOG ; |
---|
| 494 | delete [] out_RENAME_NUM_REG_RA_PHY ; |
---|
| 495 | delete [] out_RENAME_NUM_REG_RB_PHY ; |
---|
| 496 | delete [] out_RENAME_NUM_REG_RC_PHY ; |
---|
| 497 | delete [] out_RENAME_NUM_REG_RD_PHY_OLD; |
---|
| 498 | delete [] out_RENAME_NUM_REG_RE_PHY_OLD; |
---|
| 499 | |
---|
| 500 | delete [] in_INSERT_VAL ; |
---|
| 501 | delete [] out_INSERT_ACK ; |
---|
| 502 | //if (_param->_have_port_front_end_id) |
---|
| 503 | //delete [] in_INSERT_FRONT_END_ID ; |
---|
| 504 | //if (_param->_have_port_context_id) |
---|
| 505 | //delete [] in_INSERT_CONTEXT_ID ; |
---|
| 506 | delete [] in_INSERT_WRITE_RD ; |
---|
| 507 | delete [] in_INSERT_WRITE_RE ; |
---|
| 508 | delete [] in_INSERT_NUM_REG_RD_LOG ; |
---|
| 509 | delete [] in_INSERT_NUM_REG_RE_LOG ; |
---|
| 510 | delete [] in_INSERT_NUM_REG_RD_PHY ; |
---|
| 511 | delete [] in_INSERT_NUM_REG_RE_PHY ; |
---|
| 512 | |
---|
| 513 | delete [] in_RETIRE_VAL ; |
---|
| 514 | delete [] out_RETIRE_ACK ; |
---|
| 515 | if (_param->_have_port_front_end_id) |
---|
| 516 | delete [] in_RETIRE_FRONT_END_ID ; |
---|
| 517 | if (_param->_have_port_context_id) |
---|
| 518 | delete [] in_RETIRE_CONTEXT_ID ; |
---|
| 519 | delete [] in_RETIRE_EVENT_STATE ; |
---|
| 520 | delete [] in_RETIRE_WRITE_RD ; |
---|
| 521 | delete [] in_RETIRE_WRITE_RE ; |
---|
| 522 | delete [] in_RETIRE_NUM_REG_RD_LOG ; |
---|
| 523 | delete [] in_RETIRE_NUM_REG_RE_LOG ; |
---|
| 524 | delete [] in_RETIRE_NUM_REG_RD_PHY_OLD; |
---|
| 525 | delete [] in_RETIRE_NUM_REG_RE_PHY_OLD; |
---|
[88] | 526 | delete [] out_RETIRE_RESTORE_RD_PHY_OLD; |
---|
| 527 | delete [] out_RETIRE_RESTORE_RE_PHY_OLD; |
---|
[78] | 528 | |
---|
| 529 | #endif |
---|
| 530 | |
---|
| 531 | delete _Register_Address_Translation_unit; |
---|
| 532 | #ifdef STATISTICS |
---|
| 533 | delete _parameters_statistics; |
---|
| 534 | #endif |
---|
| 535 | } |
---|