[78] | 1 | /* |
---|
| 2 | * $Id: test.cpp 82 2008-05-01 16:48:45Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | * Test |
---|
| 7 | */ |
---|
| 8 | |
---|
[82] | 9 | #define NB_ITERATION 32 |
---|
| 10 | #define CYCLE_MAX (128*NB_ITERATION) |
---|
| 11 | |
---|
[78] | 12 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Register_translation_unit/Dependency_checking_unit/SelfTest/include/test.h" |
---|
| 13 | #include "Common/include/Test.h" |
---|
| 14 | #include "Behavioural/include/Allocation.h" |
---|
| 15 | #include <list> |
---|
| 16 | |
---|
| 17 | void test (string name, |
---|
| 18 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::register_translation_unit::dependency_checking_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 | |
---|
[82] | 26 | Dependency_checking_unit * _Dependency_checking_unit = new Dependency_checking_unit |
---|
| 27 | (name.c_str(), |
---|
[78] | 28 | #ifdef STATISTICS |
---|
[82] | 29 | _parameters_statistics, |
---|
[78] | 30 | #endif |
---|
[82] | 31 | _param, |
---|
| 32 | USE_ALL); |
---|
[78] | 33 | |
---|
| 34 | #ifdef SYSTEMC |
---|
| 35 | /********************************************************************* |
---|
| 36 | * Déclarations des signaux |
---|
| 37 | *********************************************************************/ |
---|
| 38 | |
---|
| 39 | string rename; |
---|
| 40 | |
---|
| 41 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
| 42 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
| 43 | |
---|
| 44 | // ALLOC1_SC_SIGNAL( in_RENAME_IN_VAL ," in_RENAME_IN_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 45 | // ALLOC1_SC_SIGNAL(out_RENAME_IN_ACK ,"out_RENAME_IN_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 46 | ALLOC1_SC_SIGNAL( in_RENAME_IN_FRONT_END_ID ," in_RENAME_IN_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 47 | ALLOC1_SC_SIGNAL( in_RENAME_IN_CONTEXT_ID ," in_RENAME_IN_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 48 | ALLOC1_SC_SIGNAL( in_RENAME_IN_READ_RA ," in_RENAME_IN_READ_RA ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 49 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RA_LOG ," in_RENAME_IN_NUM_REG_RA_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 50 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RA_PHY ," in_RENAME_IN_NUM_REG_RA_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 51 | ALLOC1_SC_SIGNAL( in_RENAME_IN_READ_RB ," in_RENAME_IN_READ_RB ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 52 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RB_LOG ," in_RENAME_IN_NUM_REG_RB_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 53 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RB_PHY ," in_RENAME_IN_NUM_REG_RB_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 54 | ALLOC1_SC_SIGNAL( in_RENAME_IN_READ_RC ," in_RENAME_IN_READ_RC ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 55 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RC_LOG ," in_RENAME_IN_NUM_REG_RC_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 56 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RC_PHY ," in_RENAME_IN_NUM_REG_RC_PHY ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 57 | ALLOC1_SC_SIGNAL( in_RENAME_IN_WRITE_RD ," in_RENAME_IN_WRITE_RD ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 58 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RD_LOG ," in_RENAME_IN_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 59 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RD_PHY_OLD ," in_RENAME_IN_NUM_REG_RD_PHY_OLD ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 60 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RD_PHY_NEW ," in_RENAME_IN_NUM_REG_RD_PHY_NEW ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 61 | ALLOC1_SC_SIGNAL( in_RENAME_IN_WRITE_RE ," in_RENAME_IN_WRITE_RE ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 62 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RE_LOG ," in_RENAME_IN_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 63 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RE_PHY_OLD ," in_RENAME_IN_NUM_REG_RE_PHY_OLD ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 64 | ALLOC1_SC_SIGNAL( in_RENAME_IN_NUM_REG_RE_PHY_NEW ," in_RENAME_IN_NUM_REG_RE_PHY_NEW ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 65 | // ALLOC1_SC_SIGNAL(out_RENAME_OUT_VAL ,"out_RENAME_OUT_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 66 | // ALLOC1_SC_SIGNAL( in_RENAME_OUT_ACK ," in_RENAME_OUT_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 67 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_FRONT_END_ID ,"out_RENAME_OUT_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 68 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_CONTEXT_ID ,"out_RENAME_OUT_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 69 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_READ_RA ,"out_RENAME_OUT_READ_RA ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 70 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RA_LOG ,"out_RENAME_OUT_NUM_REG_RA_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 71 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RA_PHY ,"out_RENAME_OUT_NUM_REG_RA_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 72 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_READ_RB ,"out_RENAME_OUT_READ_RB ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 73 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RB_LOG ,"out_RENAME_OUT_NUM_REG_RB_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 74 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RB_PHY ,"out_RENAME_OUT_NUM_REG_RB_PHY ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 75 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_READ_RC ,"out_RENAME_OUT_READ_RC ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 76 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RC_LOG ,"out_RENAME_OUT_NUM_REG_RC_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 77 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RC_PHY ,"out_RENAME_OUT_NUM_REG_RC_PHY ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 78 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_WRITE_RD ,"out_RENAME_OUT_WRITE_RD ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 79 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RD_LOG ,"out_RENAME_OUT_NUM_REG_RD_LOG ",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 80 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RD_PHY_OLD,"out_RENAME_OUT_NUM_REG_RD_PHY_OLD",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 81 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RD_PHY_NEW,"out_RENAME_OUT_NUM_REG_RD_PHY_NEW",Tgeneral_address_t,_param->_nb_inst_insert); |
---|
| 82 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_WRITE_RE ,"out_RENAME_OUT_WRITE_RE ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 83 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RE_LOG ,"out_RENAME_OUT_NUM_REG_RE_LOG ",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 84 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RE_PHY_OLD,"out_RENAME_OUT_NUM_REG_RE_PHY_OLD",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 85 | ALLOC1_SC_SIGNAL(out_RENAME_OUT_NUM_REG_RE_PHY_NEW,"out_RENAME_OUT_NUM_REG_RE_PHY_NEW",Tspecial_address_t,_param->_nb_inst_insert); |
---|
| 86 | |
---|
| 87 | /******************************************************** |
---|
| 88 | * Instanciation |
---|
| 89 | ********************************************************/ |
---|
| 90 | |
---|
| 91 | msg(_("<%s> : Instanciation of _Dependency_checking_unit.\n"),name.c_str()); |
---|
| 92 | |
---|
| 93 | (*(_Dependency_checking_unit->in_CLOCK)) (*(in_CLOCK)); |
---|
| 94 | (*(_Dependency_checking_unit->in_NRESET)) (*(in_NRESET)); |
---|
| 95 | |
---|
| 96 | // INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_VAL ,_param->_nb_inst_insert); |
---|
| 97 | // INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_IN_ACK ,_param->_nb_inst_insert); |
---|
| 98 | if (_param->_have_port_front_end_id) |
---|
| 99 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
| 100 | if (_param->_have_port_context_id) |
---|
| 101 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
| 102 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_READ_RA ,_param->_nb_inst_insert); |
---|
| 103 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RA_LOG ,_param->_nb_inst_insert); |
---|
| 104 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RA_PHY ,_param->_nb_inst_insert); |
---|
| 105 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_READ_RB ,_param->_nb_inst_insert); |
---|
| 106 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RB_LOG ,_param->_nb_inst_insert); |
---|
| 107 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RB_PHY ,_param->_nb_inst_insert); |
---|
| 108 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_READ_RC ,_param->_nb_inst_insert); |
---|
| 109 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RC_LOG ,_param->_nb_inst_insert); |
---|
| 110 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RC_PHY ,_param->_nb_inst_insert); |
---|
| 111 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_WRITE_RD ,_param->_nb_inst_insert); |
---|
| 112 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RD_LOG ,_param->_nb_inst_insert); |
---|
| 113 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RD_PHY_OLD ,_param->_nb_inst_insert); |
---|
| 114 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RD_PHY_NEW ,_param->_nb_inst_insert); |
---|
| 115 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_WRITE_RE ,_param->_nb_inst_insert); |
---|
| 116 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RE_LOG ,_param->_nb_inst_insert); |
---|
| 117 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RE_PHY_OLD ,_param->_nb_inst_insert); |
---|
| 118 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_IN_NUM_REG_RE_PHY_NEW ,_param->_nb_inst_insert); |
---|
| 119 | |
---|
| 120 | // INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_VAL ,_param->_nb_inst_insert); |
---|
| 121 | // INSTANCE1_SC_SIGNAL(_Dependency_checking_unit, in_RENAME_OUT_ACK ,_param->_nb_inst_insert); |
---|
| 122 | if (_param->_have_port_front_end_id) |
---|
| 123 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
| 124 | if (_param->_have_port_context_id) |
---|
| 125 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
| 126 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_READ_RA ,_param->_nb_inst_insert); |
---|
| 127 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RA_LOG ,_param->_nb_inst_insert); |
---|
| 128 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RA_PHY ,_param->_nb_inst_insert); |
---|
| 129 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_READ_RB ,_param->_nb_inst_insert); |
---|
| 130 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RB_LOG ,_param->_nb_inst_insert); |
---|
| 131 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RB_PHY ,_param->_nb_inst_insert); |
---|
| 132 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_READ_RC ,_param->_nb_inst_insert); |
---|
| 133 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RC_LOG ,_param->_nb_inst_insert); |
---|
| 134 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RC_PHY ,_param->_nb_inst_insert); |
---|
| 135 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_WRITE_RD ,_param->_nb_inst_insert); |
---|
| 136 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RD_LOG ,_param->_nb_inst_insert); |
---|
| 137 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RD_PHY_OLD,_param->_nb_inst_insert); |
---|
| 138 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RD_PHY_NEW,_param->_nb_inst_insert); |
---|
| 139 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_WRITE_RE ,_param->_nb_inst_insert); |
---|
| 140 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RE_LOG ,_param->_nb_inst_insert); |
---|
| 141 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RE_PHY_OLD,_param->_nb_inst_insert); |
---|
| 142 | INSTANCE1_SC_SIGNAL(_Dependency_checking_unit,out_RENAME_OUT_NUM_REG_RE_PHY_NEW,_param->_nb_inst_insert); |
---|
| 143 | |
---|
| 144 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
| 145 | |
---|
| 146 | Time * _time = new Time(); |
---|
| 147 | |
---|
| 148 | /******************************************************** |
---|
| 149 | * Simulation - Begin |
---|
| 150 | ********************************************************/ |
---|
| 151 | |
---|
| 152 | // Initialisation |
---|
| 153 | |
---|
| 154 | const uint32_t seed = 0; |
---|
| 155 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 156 | |
---|
| 157 | srand(seed); |
---|
| 158 | |
---|
| 159 | int32_t percent_transaction_read = 75; |
---|
| 160 | int32_t percent_transaction_write = 75; |
---|
| 161 | |
---|
| 162 | SC_START(0); |
---|
| 163 | LABEL("Initialisation"); |
---|
| 164 | |
---|
| 165 | LABEL("Reset"); |
---|
| 166 | in_NRESET->write(0); |
---|
| 167 | SC_START(5); |
---|
| 168 | in_NRESET->write(1); |
---|
| 169 | |
---|
| 170 | LABEL("Loop of Test"); |
---|
| 171 | |
---|
| 172 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
| 173 | { |
---|
| 174 | LABEL("Iteration %d",iteration); |
---|
| 175 | |
---|
| 176 | Tgeneral_address_t rat_gpr [_param->_nb_front_end][_param->_max_nb_context][_param->_nb_general_register_logic]; |
---|
| 177 | Tspecial_address_t rat_spr [_param->_nb_front_end][_param->_max_nb_context][_param->_nb_special_register_logic]; |
---|
| 178 | std::list<Tgeneral_address_t> free_list_gpr [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 179 | std::list<Tspecial_address_t> free_list_spr [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 180 | |
---|
| 181 | for (uint32_t x=0; x< _param->_nb_front_end; x++) |
---|
| 182 | for (uint32_t y=0; y<_param->_max_nb_context; y++) |
---|
| 183 | { |
---|
| 184 | for (uint32_t i=0; i<_param->_nb_general_register_logic; i++) |
---|
| 185 | rat_gpr [x][y][i] = i; |
---|
| 186 | for (uint32_t i=_param->_nb_general_register_logic; i<_param->_nb_general_register; i++) |
---|
| 187 | free_list_gpr[x][y].push_back(i); |
---|
| 188 | for (uint32_t i=0; i<_param->_nb_special_register_logic; i++) |
---|
| 189 | rat_spr [x][y][i] = i; |
---|
| 190 | for (uint32_t i=_param->_nb_special_register_logic; i<_param->_nb_special_register; i++) |
---|
| 191 | free_list_spr[x][y].push_back(i); |
---|
| 192 | } |
---|
| 193 | |
---|
| 194 | int32_t nb_request = 32; |
---|
| 195 | |
---|
| 196 | while (nb_request >= 0) |
---|
| 197 | { |
---|
| 198 | // uint32_t nb_in_val = rand()%_param->_nb_inst_insert; |
---|
| 199 | // uint32_t nb_out_ack = rand()%_param->_nb_inst_insert; |
---|
| 200 | |
---|
| 201 | std::list<Tgeneral_address_t>::iterator it_gpr [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 202 | std::list<Tspecial_address_t>::iterator it_spr [_param->_nb_front_end][_param->_max_nb_context]; |
---|
| 203 | |
---|
| 204 | for (uint32_t x=0; x< _param->_nb_front_end; x++) |
---|
| 205 | for (uint32_t y=0; y<_param->_max_nb_context; y++) |
---|
| 206 | { |
---|
| 207 | it_gpr [x][y] = free_list_gpr [x][y].begin(); |
---|
| 208 | it_spr [x][y] = free_list_spr [x][y].begin(); |
---|
| 209 | } |
---|
| 210 | |
---|
| 211 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 212 | { |
---|
| 213 | Tcontext_t front_end_id= rand()%_param->_nb_front_end; |
---|
| 214 | Tcontext_t context_id = rand()%_param->_max_nb_context; |
---|
| 215 | |
---|
| 216 | Tgeneral_address_t ra_log = rand()%_param->_nb_general_register_logic; |
---|
| 217 | Tgeneral_address_t rb_log = rand()%_param->_nb_general_register_logic; |
---|
| 218 | Tspecial_address_t rc_log = rand()%_param->_nb_special_register_logic; |
---|
| 219 | Tgeneral_address_t rd_log = rand()%_param->_nb_general_register_logic; |
---|
| 220 | Tspecial_address_t re_log = rand()%_param->_nb_special_register_logic; |
---|
| 221 | Tcontrol_t read_ra = ((rand()%100)<percent_transaction_read ); |
---|
| 222 | Tcontrol_t read_rb = ((rand()%100)<percent_transaction_read ); |
---|
| 223 | Tcontrol_t read_rc = ((rand()%100)<percent_transaction_read ); |
---|
| 224 | Tcontrol_t write_rd = ((rand()%100)<percent_transaction_write)and (i < free_list_gpr [front_end_id][context_id].size()); |
---|
| 225 | Tcontrol_t write_re = ((rand()%100)<percent_transaction_write)and (i < free_list_spr [front_end_id][context_id].size()); |
---|
| 226 | |
---|
| 227 | // in_RENAME_IN_VAL [i]->write(i<nb_in_val ); |
---|
| 228 | in_RENAME_IN_FRONT_END_ID [i]->write(front_end_id ); |
---|
| 229 | in_RENAME_IN_CONTEXT_ID [i]->write(context_id ); |
---|
| 230 | in_RENAME_IN_READ_RA [i]->write(read_ra ); |
---|
| 231 | in_RENAME_IN_NUM_REG_RA_LOG [i]->write(ra_log ); |
---|
| 232 | in_RENAME_IN_NUM_REG_RA_PHY [i]->write(rat_gpr[front_end_id][context_id][ra_log]); |
---|
| 233 | in_RENAME_IN_READ_RB [i]->write(read_rb ); |
---|
| 234 | in_RENAME_IN_NUM_REG_RB_LOG [i]->write(rb_log ); |
---|
| 235 | in_RENAME_IN_NUM_REG_RB_PHY [i]->write(rat_gpr[front_end_id][context_id][rb_log]); |
---|
| 236 | in_RENAME_IN_READ_RC [i]->write(read_rc ); |
---|
| 237 | in_RENAME_IN_NUM_REG_RC_LOG [i]->write(rc_log ); |
---|
| 238 | in_RENAME_IN_NUM_REG_RC_PHY [i]->write(rat_spr[front_end_id][context_id][rc_log]); |
---|
| 239 | in_RENAME_IN_WRITE_RD [i]->write(write_rd ); |
---|
| 240 | in_RENAME_IN_NUM_REG_RD_LOG [i]->write(rd_log ); |
---|
| 241 | in_RENAME_IN_NUM_REG_RD_PHY_OLD [i]->write(rat_gpr[front_end_id][context_id][rd_log]); |
---|
| 242 | in_RENAME_IN_NUM_REG_RD_PHY_NEW [i]->write((write_rd)?*it_gpr[front_end_id][context_id]:0); |
---|
| 243 | in_RENAME_IN_WRITE_RE [i]->write(write_re ); |
---|
| 244 | in_RENAME_IN_NUM_REG_RE_LOG [i]->write(re_log ); |
---|
| 245 | in_RENAME_IN_NUM_REG_RE_PHY_OLD [i]->write(rat_spr[front_end_id][context_id][re_log]); |
---|
| 246 | in_RENAME_IN_NUM_REG_RE_PHY_NEW [i]->write((write_re)?*it_spr[front_end_id][context_id]:0); |
---|
| 247 | |
---|
| 248 | // in_RENAME_OUT_ACK [i]->write(i<nb_out_ack ); |
---|
| 249 | |
---|
| 250 | LABEL("Rename_in [%d]",i); |
---|
| 251 | LABEL(" * FRONT_END_ID : %d",front_end_id ); |
---|
| 252 | LABEL(" * CONTEXT_ID : %d",context_id ); |
---|
| 253 | LABEL(" * READ_RA : %d",read_ra ); |
---|
| 254 | LABEL(" * NUM_REG_RA_LOG : %d",ra_log ); |
---|
| 255 | LABEL(" * NUM_REG_RA_PHY : %d",rat_gpr[front_end_id][context_id][ra_log]); |
---|
| 256 | LABEL(" * READ_RB : %d",read_rb ); |
---|
| 257 | LABEL(" * NUM_REG_RB_LOG : %d",rb_log ); |
---|
| 258 | LABEL(" * NUM_REG_RB_PHY : %d",rat_gpr[front_end_id][context_id][rb_log]); |
---|
| 259 | LABEL(" * READ_RC : %d",read_rc ); |
---|
| 260 | LABEL(" * NUM_REG_RC_LOG : %d",rc_log ); |
---|
| 261 | LABEL(" * NUM_REG_RC_PHY : %d",rat_spr[front_end_id][context_id][rc_log]); |
---|
| 262 | LABEL(" * WRITE_RD : %d",write_rd ); |
---|
| 263 | LABEL(" * NUM_REG_RD_LOG : %d",rd_log ); |
---|
| 264 | LABEL(" * NUM_REG_RD_PHY_OLD : %d",rat_gpr[front_end_id][context_id][rd_log]); |
---|
| 265 | LABEL(" * NUM_REG_RD_PHY_NEW : %d",(write_rd)?*it_gpr[front_end_id][context_id]:0); |
---|
| 266 | LABEL(" * WRITE_RE : %d",write_re ); |
---|
| 267 | LABEL(" * NUM_REG_RE_LOG : %d",re_log ); |
---|
| 268 | LABEL(" * NUM_REG_RE_PHY_OLD : %d",rat_spr[front_end_id][context_id][re_log]); |
---|
| 269 | LABEL(" * NUM_REG_RE_PHY_NEW : %d",(write_re)?*it_spr[front_end_id][context_id]:0); |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | if (write_rd) |
---|
| 273 | it_gpr[front_end_id][context_id] ++; |
---|
| 274 | if (write_re) |
---|
| 275 | it_spr[front_end_id][context_id] ++; |
---|
| 276 | } |
---|
| 277 | |
---|
| 278 | SC_START(0); |
---|
| 279 | |
---|
| 280 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 281 | { |
---|
| 282 | // if ( in_RENAME_IN_VAL [i]->read() == |
---|
| 283 | // out_RENAME_IN_ACK [i]->read() == |
---|
| 284 | // out_RENAME_OUT_VAL [i]->read() == |
---|
| 285 | // in_RENAME_OUT_ACK [i]->read() == 1) |
---|
| 286 | { |
---|
| 287 | nb_request --; |
---|
| 288 | |
---|
| 289 | LABEL("Rename_out [%d]",i); |
---|
| 290 | |
---|
| 291 | Tcontext_t front_end_id= (_param->_have_port_front_end_id)?in_RENAME_IN_FRONT_END_ID [i]->read():0; |
---|
| 292 | Tcontext_t context_id = (_param->_have_port_context_id )?in_RENAME_IN_CONTEXT_ID [i]->read():0; |
---|
| 293 | |
---|
| 294 | if (_param->_have_port_front_end_id) |
---|
| 295 | TEST(Tcontext_t ,out_RENAME_OUT_FRONT_END_ID [i]->read(), front_end_id); |
---|
| 296 | if (_param->_have_port_context_id) |
---|
| 297 | TEST(Tcontext_t ,out_RENAME_OUT_CONTEXT_ID [i]->read(), context_id); |
---|
| 298 | |
---|
| 299 | |
---|
| 300 | Tcontrol_t read_ra = in_RENAME_IN_READ_RA [i]->read(); |
---|
| 301 | Tgeneral_address_t num_reg_ra_log = in_RENAME_IN_NUM_REG_RA_LOG [i]->read(); |
---|
| 302 | Tcontrol_t read_rb = in_RENAME_IN_READ_RB [i]->read(); |
---|
| 303 | Tgeneral_address_t num_reg_rb_log = in_RENAME_IN_NUM_REG_RB_LOG [i]->read(); |
---|
| 304 | Tcontrol_t read_rc = in_RENAME_IN_READ_RC [i]->read(); |
---|
| 305 | Tspecial_address_t num_reg_rc_log = in_RENAME_IN_NUM_REG_RC_LOG [i]->read(); |
---|
| 306 | Tcontrol_t write_rd = in_RENAME_IN_WRITE_RD [i]->read(); |
---|
| 307 | Tgeneral_address_t num_reg_rd_log = in_RENAME_IN_NUM_REG_RD_LOG [i]->read(); |
---|
| 308 | Tgeneral_address_t num_reg_rd_phy_old = in_RENAME_IN_NUM_REG_RD_PHY_OLD [i]->read(); |
---|
| 309 | Tgeneral_address_t num_reg_rd_phy_new = in_RENAME_IN_NUM_REG_RD_PHY_NEW [i]->read(); |
---|
| 310 | Tcontrol_t write_re = in_RENAME_IN_WRITE_RE [i]->read(); |
---|
| 311 | Tspecial_address_t num_reg_re_log = in_RENAME_IN_NUM_REG_RE_LOG [i]->read(); |
---|
| 312 | Tspecial_address_t num_reg_re_phy_old = in_RENAME_IN_NUM_REG_RE_PHY_OLD [i]->read(); |
---|
| 313 | Tspecial_address_t num_reg_re_phy_new = in_RENAME_IN_NUM_REG_RE_PHY_NEW [i]->read(); |
---|
| 314 | |
---|
| 315 | TEST(Tcontrol_t ,out_RENAME_OUT_READ_RA [i]->read(), read_ra ); |
---|
| 316 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RA_LOG [i]->read(), num_reg_ra_log ); |
---|
| 317 | if (read_ra) |
---|
| 318 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RA_PHY [i]->read(), rat_gpr[front_end_id][context_id][num_reg_ra_log]); |
---|
| 319 | TEST(Tcontrol_t ,out_RENAME_OUT_READ_RB [i]->read(), read_rb ); |
---|
| 320 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RB_LOG [i]->read(), num_reg_rb_log ); |
---|
| 321 | if (read_rb) |
---|
| 322 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RB_PHY [i]->read(), rat_gpr[front_end_id][context_id][num_reg_rb_log]); |
---|
| 323 | TEST(Tcontrol_t ,out_RENAME_OUT_READ_RC [i]->read(), read_rc ); |
---|
| 324 | TEST(Tspecial_address_t,out_RENAME_OUT_NUM_REG_RC_LOG [i]->read(), num_reg_rc_log ); |
---|
| 325 | if (read_rc) |
---|
| 326 | TEST(Tspecial_address_t,out_RENAME_OUT_NUM_REG_RC_PHY [i]->read(), rat_spr[front_end_id][context_id][num_reg_rc_log]); |
---|
| 327 | TEST(Tcontrol_t ,out_RENAME_OUT_WRITE_RD [i]->read(), write_rd ); |
---|
| 328 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RD_LOG [i]->read(), num_reg_rd_log ); |
---|
| 329 | if (write_rd) |
---|
| 330 | { |
---|
| 331 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RD_PHY_OLD [i]->read(), rat_gpr[front_end_id][context_id][num_reg_rd_log]); |
---|
| 332 | TEST(Tgeneral_address_t,out_RENAME_OUT_NUM_REG_RD_PHY_NEW [i]->read(), free_list_gpr[front_end_id][context_id].front()); |
---|
| 333 | } |
---|
| 334 | TEST(Tcontrol_t ,out_RENAME_OUT_WRITE_RE [i]->read(), write_re ); |
---|
| 335 | TEST(Tspecial_address_t,out_RENAME_OUT_NUM_REG_RE_LOG [i]->read(), num_reg_re_log ); |
---|
| 336 | if (write_re) |
---|
| 337 | { |
---|
| 338 | TEST(Tspecial_address_t,out_RENAME_OUT_NUM_REG_RE_PHY_OLD [i]->read(), rat_spr[front_end_id][context_id][num_reg_re_log]); |
---|
| 339 | TEST(Tspecial_address_t,out_RENAME_OUT_NUM_REG_RE_PHY_NEW [i]->read(), free_list_spr[front_end_id][context_id].front()); |
---|
| 340 | } |
---|
| 341 | |
---|
| 342 | if (write_rd) |
---|
| 343 | { |
---|
| 344 | free_list_gpr[front_end_id][context_id].pop_front(); |
---|
| 345 | free_list_gpr[front_end_id][context_id].push_back(num_reg_rd_phy_old); |
---|
| 346 | rat_gpr [front_end_id][context_id][num_reg_rd_log] = num_reg_rd_phy_new; |
---|
| 347 | } |
---|
| 348 | if (write_re) |
---|
| 349 | { |
---|
| 350 | free_list_spr[front_end_id][context_id].pop_front(); |
---|
| 351 | free_list_spr[front_end_id][context_id].push_back(num_reg_re_phy_old); |
---|
| 352 | rat_spr [front_end_id][context_id][num_reg_re_log] = num_reg_re_phy_new; |
---|
| 353 | } |
---|
| 354 | |
---|
| 355 | } |
---|
| 356 | } |
---|
| 357 | SC_START(1); |
---|
| 358 | } |
---|
| 359 | } |
---|
| 360 | |
---|
| 361 | /******************************************************** |
---|
| 362 | * Simulation - End |
---|
| 363 | ********************************************************/ |
---|
| 364 | |
---|
| 365 | TEST_OK ("End of Simulation"); |
---|
| 366 | delete _time; |
---|
| 367 | |
---|
| 368 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
| 369 | |
---|
| 370 | delete in_CLOCK; |
---|
| 371 | delete in_NRESET; |
---|
| 372 | |
---|
| 373 | // delete [] in_RENAME_IN_VAL ; |
---|
| 374 | // delete [] out_RENAME_IN_ACK ; |
---|
| 375 | if (_param->_have_port_front_end_id) |
---|
| 376 | delete [] in_RENAME_IN_FRONT_END_ID ; |
---|
| 377 | if (_param->_have_port_context_id) |
---|
| 378 | delete [] in_RENAME_IN_CONTEXT_ID ; |
---|
| 379 | delete [] in_RENAME_IN_READ_RA ; |
---|
| 380 | delete [] in_RENAME_IN_NUM_REG_RA_LOG ; |
---|
| 381 | delete [] in_RENAME_IN_NUM_REG_RA_PHY ; |
---|
| 382 | delete [] in_RENAME_IN_READ_RB ; |
---|
| 383 | delete [] in_RENAME_IN_NUM_REG_RB_LOG ; |
---|
| 384 | delete [] in_RENAME_IN_NUM_REG_RB_PHY ; |
---|
| 385 | delete [] in_RENAME_IN_READ_RC ; |
---|
| 386 | delete [] in_RENAME_IN_NUM_REG_RC_LOG ; |
---|
| 387 | delete [] in_RENAME_IN_NUM_REG_RC_PHY ; |
---|
| 388 | delete [] in_RENAME_IN_WRITE_RD ; |
---|
| 389 | delete [] in_RENAME_IN_NUM_REG_RD_LOG ; |
---|
| 390 | delete [] in_RENAME_IN_NUM_REG_RD_PHY_OLD ; |
---|
| 391 | delete [] in_RENAME_IN_NUM_REG_RD_PHY_NEW ; |
---|
| 392 | delete [] in_RENAME_IN_WRITE_RE ; |
---|
| 393 | delete [] in_RENAME_IN_NUM_REG_RE_LOG ; |
---|
| 394 | delete [] in_RENAME_IN_NUM_REG_RE_PHY_OLD ; |
---|
| 395 | delete [] in_RENAME_IN_NUM_REG_RE_PHY_NEW ; |
---|
| 396 | // delete [] out_RENAME_OUT_VAL ; |
---|
| 397 | // delete [] in_RENAME_OUT_ACK ; |
---|
| 398 | if (_param->_have_port_front_end_id) |
---|
| 399 | delete [] out_RENAME_OUT_FRONT_END_ID ; |
---|
| 400 | if (_param->_have_port_context_id) |
---|
| 401 | delete [] out_RENAME_OUT_CONTEXT_ID ; |
---|
| 402 | delete [] out_RENAME_OUT_READ_RA ; |
---|
| 403 | delete [] out_RENAME_OUT_NUM_REG_RA_LOG ; |
---|
| 404 | delete [] out_RENAME_OUT_NUM_REG_RA_PHY ; |
---|
| 405 | delete [] out_RENAME_OUT_READ_RB ; |
---|
| 406 | delete [] out_RENAME_OUT_NUM_REG_RB_LOG ; |
---|
| 407 | delete [] out_RENAME_OUT_NUM_REG_RB_PHY ; |
---|
| 408 | delete [] out_RENAME_OUT_READ_RC ; |
---|
| 409 | delete [] out_RENAME_OUT_NUM_REG_RC_LOG ; |
---|
| 410 | delete [] out_RENAME_OUT_NUM_REG_RC_PHY ; |
---|
| 411 | delete [] out_RENAME_OUT_WRITE_RD ; |
---|
| 412 | delete [] out_RENAME_OUT_NUM_REG_RD_LOG ; |
---|
| 413 | delete [] out_RENAME_OUT_NUM_REG_RD_PHY_OLD; |
---|
| 414 | delete [] out_RENAME_OUT_NUM_REG_RD_PHY_NEW; |
---|
| 415 | delete [] out_RENAME_OUT_WRITE_RE ; |
---|
| 416 | delete [] out_RENAME_OUT_NUM_REG_RE_LOG ; |
---|
| 417 | delete [] out_RENAME_OUT_NUM_REG_RE_PHY_OLD; |
---|
| 418 | delete [] out_RENAME_OUT_NUM_REG_RE_PHY_NEW; |
---|
| 419 | |
---|
| 420 | #endif |
---|
| 421 | |
---|
| 422 | delete _Dependency_checking_unit; |
---|
| 423 | #ifdef STATISTICS |
---|
| 424 | delete _parameters_statistics; |
---|
| 425 | #endif |
---|
| 426 | } |
---|