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