[60] | 1 | /* |
---|
| 2 | * $Id: test.cpp 131 2009-07-08 18:40:08Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | * Test |
---|
| 7 | */ |
---|
| 8 | |
---|
[82] | 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/SelfTest/include/test.h" |
---|
[60] | 10 | |
---|
| 11 | void test (string name, |
---|
| 12 | morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters * _param) |
---|
| 13 | { |
---|
| 14 | cout << "<" << name << "> : Simulation SystemC" << endl; |
---|
| 15 | |
---|
| 16 | #ifdef STATISTICS |
---|
| 17 | morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50); |
---|
| 18 | #endif |
---|
| 19 | |
---|
[131] | 20 | _model.set_model(MODEL_SYSTEMC,true); |
---|
[128] | 21 | |
---|
[88] | 22 | Tusage_t _usage = USE_ALL; |
---|
| 23 | |
---|
| 24 | // _usage = usage_unset(_usage,USE_SYSTEMC ); |
---|
| 25 | // _usage = usage_unset(_usage,USE_VHDL ); |
---|
| 26 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH ); |
---|
| 27 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
| 28 | // _usage = usage_unset(_usage,USE_POSITION ); |
---|
| 29 | // _usage = usage_unset(_usage,USE_STATISTICS ); |
---|
| 30 | // _usage = usage_unset(_usage,USE_INFORMATION ); |
---|
| 31 | |
---|
[82] | 32 | Register_unit * _Register_unit = new Register_unit |
---|
| 33 | (name.c_str(), |
---|
[60] | 34 | #ifdef STATISTICS |
---|
[82] | 35 | _parameters_statistics, |
---|
[60] | 36 | #endif |
---|
[82] | 37 | _param, |
---|
[88] | 38 | _usage); |
---|
[60] | 39 | |
---|
| 40 | #ifdef SYSTEMC |
---|
| 41 | /********************************************************************* |
---|
| 42 | * Déclarations des signaux |
---|
| 43 | *********************************************************************/ |
---|
| 44 | sc_clock * in_CLOCK; |
---|
| 45 | sc_signal<Tcontrol_t> * in_NRESET; |
---|
| 46 | |
---|
| 47 | // ~~~~~[ Interface "gpr_read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 48 | sc_signal<Tcontrol_t > ** in_GPR_READ_VAL ; |
---|
| 49 | sc_signal<Tcontrol_t > ** out_GPR_READ_ACK ; |
---|
| 50 | sc_signal<Tcontext_t > ** in_GPR_READ_OOO_ENGINE_ID ; |
---|
| 51 | sc_signal<Tgeneral_address_t> ** in_GPR_READ_NUM_REG ; |
---|
| 52 | sc_signal<Tgeneral_data_t > ** out_GPR_READ_DATA ; |
---|
| 53 | sc_signal<Tcontrol_t > ** out_GPR_READ_DATA_VAL ; |
---|
| 54 | |
---|
| 55 | // ~~~~~[ Interface "gpr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 56 | sc_signal<Tcontrol_t > ** in_GPR_WRITE_VAL ; |
---|
| 57 | sc_signal<Tcontrol_t > ** out_GPR_WRITE_ACK ; |
---|
| 58 | sc_signal<Tcontext_t > ** in_GPR_WRITE_OOO_ENGINE_ID ; |
---|
| 59 | sc_signal<Tgeneral_address_t> ** in_GPR_WRITE_NUM_REG ; |
---|
| 60 | sc_signal<Tgeneral_data_t > ** in_GPR_WRITE_DATA ; |
---|
| 61 | |
---|
| 62 | // ~~~~~[ Interface "spr_read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 63 | sc_signal<Tcontrol_t > ** in_SPR_READ_VAL ; |
---|
| 64 | sc_signal<Tcontrol_t > ** out_SPR_READ_ACK ; |
---|
| 65 | sc_signal<Tcontext_t > ** in_SPR_READ_OOO_ENGINE_ID ; |
---|
| 66 | sc_signal<Tspecial_address_t> ** in_SPR_READ_NUM_REG ; |
---|
| 67 | sc_signal<Tspecial_data_t > ** out_SPR_READ_DATA ; |
---|
| 68 | sc_signal<Tcontrol_t > ** out_SPR_READ_DATA_VAL ; |
---|
| 69 | |
---|
| 70 | // ~~~~~[ Interface "spr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 71 | sc_signal<Tcontrol_t > ** in_SPR_WRITE_VAL ; |
---|
| 72 | sc_signal<Tcontrol_t > ** out_SPR_WRITE_ACK ; |
---|
| 73 | sc_signal<Tcontext_t > ** in_SPR_WRITE_OOO_ENGINE_ID ; |
---|
| 74 | sc_signal<Tspecial_address_t> ** in_SPR_WRITE_NUM_REG ; |
---|
| 75 | sc_signal<Tspecial_data_t > ** in_SPR_WRITE_DATA ; |
---|
| 76 | |
---|
| 77 | // ~~~~~[ Interface "insert_rob" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 78 | sc_signal<Tcontrol_t > *** in_INSERT_ROB_VAL ; |
---|
| 79 | sc_signal<Tcontrol_t > *** out_INSERT_ROB_ACK ; |
---|
| 80 | sc_signal<Tcontrol_t > *** in_INSERT_ROB_RD_USE ; |
---|
| 81 | sc_signal<Tgeneral_address_t> *** in_INSERT_ROB_RD_NUM_REG ; // use=1 : status[num_reg]<- 0 |
---|
| 82 | sc_signal<Tcontrol_t > *** in_INSERT_ROB_RE_USE ; |
---|
| 83 | sc_signal<Tspecial_address_t> *** in_INSERT_ROB_RE_NUM_REG ; |
---|
| 84 | |
---|
[88] | 85 | // // ~~~~~[ Interface "retire_rob" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 86 | // sc_signal<Tcontrol_t > *** in_RETIRE_ROB_VAL ; |
---|
| 87 | // sc_signal<Tcontrol_t > *** out_RETIRE_ROB_ACK ; |
---|
| 88 | // sc_signal<Tcontrol_t > *** in_RETIRE_ROB_RD_OLD_USE ; |
---|
| 89 | // sc_signal<Tgeneral_address_t> *** in_RETIRE_ROB_RD_OLD_NUM_REG ; // old_use=1 : status[old_num_reg]<- 0 |
---|
| 90 | // sc_signal<Tcontrol_t > *** in_RETIRE_ROB_RD_NEW_USE ; |
---|
| 91 | // sc_signal<Tgeneral_address_t> *** in_RETIRE_ROB_RD_NEW_NUM_REG ; // new_use=1 : status[new_num_reg]<- 1 |
---|
| 92 | // sc_signal<Tcontrol_t > *** in_RETIRE_ROB_RE_OLD_USE ; |
---|
| 93 | // sc_signal<Tspecial_address_t> *** in_RETIRE_ROB_RE_OLD_NUM_REG ; |
---|
| 94 | // sc_signal<Tcontrol_t > *** in_RETIRE_ROB_RE_NEW_USE ; |
---|
| 95 | // sc_signal<Tspecial_address_t> *** in_RETIRE_ROB_RE_NEW_NUM_REG ; |
---|
[60] | 96 | |
---|
[62] | 97 | string rename = "signal"; |
---|
[60] | 98 | |
---|
| 99 | in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
| 100 | in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
| 101 | |
---|
| 102 | |
---|
| 103 | // ~~~~~[ Interface "gpr_read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 104 | in_GPR_READ_VAL = new sc_signal<Tcontrol_t > * [_param->_nb_gpr_read]; |
---|
| 105 | out_GPR_READ_ACK = new sc_signal<Tcontrol_t > * [_param->_nb_gpr_read]; |
---|
| 106 | in_GPR_READ_OOO_ENGINE_ID = new sc_signal<Tcontext_t > * [_param->_nb_gpr_read]; |
---|
| 107 | in_GPR_READ_NUM_REG = new sc_signal<Tgeneral_address_t> * [_param->_nb_gpr_read]; |
---|
| 108 | out_GPR_READ_DATA = new sc_signal<Tgeneral_data_t > * [_param->_nb_gpr_read]; |
---|
| 109 | out_GPR_READ_DATA_VAL = new sc_signal<Tcontrol_t > * [_param->_nb_gpr_read]; |
---|
| 110 | |
---|
| 111 | for (uint32_t i=0; i<_param->_nb_gpr_read; i++) |
---|
| 112 | { |
---|
| 113 | in_GPR_READ_VAL [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 114 | out_GPR_READ_ACK [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 115 | in_GPR_READ_OOO_ENGINE_ID [i]= new sc_signal<Tcontext_t > (rename.c_str()); |
---|
| 116 | in_GPR_READ_NUM_REG [i]= new sc_signal<Tgeneral_address_t> (rename.c_str()); |
---|
| 117 | out_GPR_READ_DATA [i]= new sc_signal<Tgeneral_data_t > (rename.c_str()); |
---|
| 118 | out_GPR_READ_DATA_VAL [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | // ~~~~~[ Interface "gpr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 122 | in_GPR_WRITE_VAL = new sc_signal<Tcontrol_t > * [_param->_nb_gpr_write]; |
---|
| 123 | out_GPR_WRITE_ACK = new sc_signal<Tcontrol_t > * [_param->_nb_gpr_write]; |
---|
| 124 | in_GPR_WRITE_OOO_ENGINE_ID = new sc_signal<Tcontext_t > * [_param->_nb_gpr_write]; |
---|
| 125 | in_GPR_WRITE_NUM_REG = new sc_signal<Tgeneral_address_t> * [_param->_nb_gpr_write]; |
---|
| 126 | in_GPR_WRITE_DATA = new sc_signal<Tgeneral_data_t > * [_param->_nb_gpr_write]; |
---|
| 127 | |
---|
| 128 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
| 129 | { |
---|
| 130 | in_GPR_WRITE_VAL [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 131 | out_GPR_WRITE_ACK [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 132 | in_GPR_WRITE_OOO_ENGINE_ID [i]= new sc_signal<Tcontext_t > (rename.c_str()); |
---|
| 133 | in_GPR_WRITE_NUM_REG [i]= new sc_signal<Tgeneral_address_t> (rename.c_str()); |
---|
| 134 | in_GPR_WRITE_DATA [i]= new sc_signal<Tgeneral_data_t > (rename.c_str()); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | // ~~~~~[ Interface "spr_read" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 138 | in_SPR_READ_VAL = new sc_signal<Tcontrol_t > * [_param->_nb_spr_read]; |
---|
| 139 | out_SPR_READ_ACK = new sc_signal<Tcontrol_t > * [_param->_nb_spr_read]; |
---|
| 140 | in_SPR_READ_OOO_ENGINE_ID = new sc_signal<Tcontext_t > * [_param->_nb_spr_read]; |
---|
| 141 | in_SPR_READ_NUM_REG = new sc_signal<Tspecial_address_t> * [_param->_nb_spr_read]; |
---|
| 142 | out_SPR_READ_DATA = new sc_signal<Tspecial_data_t > * [_param->_nb_spr_read]; |
---|
| 143 | out_SPR_READ_DATA_VAL = new sc_signal<Tcontrol_t > * [_param->_nb_spr_read]; |
---|
| 144 | |
---|
| 145 | for (uint32_t i=0; i<_param->_nb_spr_read; i++) |
---|
| 146 | { |
---|
| 147 | in_SPR_READ_VAL [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 148 | out_SPR_READ_ACK [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 149 | in_SPR_READ_OOO_ENGINE_ID [i]= new sc_signal<Tcontext_t > (rename.c_str()); |
---|
| 150 | in_SPR_READ_NUM_REG [i]= new sc_signal<Tspecial_address_t> (rename.c_str()); |
---|
| 151 | out_SPR_READ_DATA [i]= new sc_signal<Tspecial_data_t > (rename.c_str()); |
---|
| 152 | out_SPR_READ_DATA_VAL [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | // ~~~~~[ Interface "spr_write" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 156 | in_SPR_WRITE_VAL = new sc_signal<Tcontrol_t > * [_param->_nb_spr_write]; |
---|
| 157 | out_SPR_WRITE_ACK = new sc_signal<Tcontrol_t > * [_param->_nb_spr_write]; |
---|
| 158 | in_SPR_WRITE_OOO_ENGINE_ID = new sc_signal<Tcontext_t > * [_param->_nb_spr_write]; |
---|
| 159 | in_SPR_WRITE_NUM_REG = new sc_signal<Tspecial_address_t> * [_param->_nb_spr_write]; |
---|
| 160 | in_SPR_WRITE_DATA = new sc_signal<Tspecial_data_t > * [_param->_nb_spr_write]; |
---|
| 161 | |
---|
| 162 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
| 163 | { |
---|
| 164 | in_SPR_WRITE_VAL [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 165 | out_SPR_WRITE_ACK [i]= new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 166 | in_SPR_WRITE_OOO_ENGINE_ID [i]= new sc_signal<Tcontext_t > (rename.c_str()); |
---|
| 167 | in_SPR_WRITE_NUM_REG [i]= new sc_signal<Tspecial_address_t> (rename.c_str()); |
---|
| 168 | in_SPR_WRITE_DATA [i]= new sc_signal<Tspecial_data_t > (rename.c_str()); |
---|
| 169 | } |
---|
| 170 | |
---|
| 171 | // ~~~~~[ Interface "insert_rob" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 172 | in_INSERT_ROB_VAL = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 173 | out_INSERT_ROB_ACK = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 174 | in_INSERT_ROB_RD_USE = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 175 | in_INSERT_ROB_RD_NUM_REG = new sc_signal<Tgeneral_address_t> ** [_param->_nb_ooo_engine]; |
---|
| 176 | in_INSERT_ROB_RE_USE = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 177 | in_INSERT_ROB_RE_NUM_REG = new sc_signal<Tspecial_address_t> ** [_param->_nb_ooo_engine]; |
---|
| 178 | |
---|
| 179 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 180 | { |
---|
| 181 | uint32_t x=_param->_nb_inst_insert_rob [i]; |
---|
| 182 | |
---|
| 183 | in_INSERT_ROB_VAL [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 184 | out_INSERT_ROB_ACK [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 185 | in_INSERT_ROB_RD_USE [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 186 | in_INSERT_ROB_RD_NUM_REG [i] = new sc_signal<Tgeneral_address_t> * [x]; |
---|
| 187 | in_INSERT_ROB_RE_USE [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 188 | in_INSERT_ROB_RE_NUM_REG [i] = new sc_signal<Tspecial_address_t> * [x]; |
---|
| 189 | |
---|
| 190 | for (uint32_t j=0; j<x; j++) |
---|
| 191 | { |
---|
| 192 | in_INSERT_ROB_VAL [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 193 | out_INSERT_ROB_ACK [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 194 | in_INSERT_ROB_RD_USE [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 195 | in_INSERT_ROB_RD_NUM_REG [i][j] = new sc_signal<Tgeneral_address_t> (rename.c_str()); |
---|
| 196 | in_INSERT_ROB_RE_USE [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 197 | in_INSERT_ROB_RE_NUM_REG [i][j] = new sc_signal<Tspecial_address_t> (rename.c_str()); |
---|
| 198 | |
---|
| 199 | } |
---|
| 200 | } |
---|
| 201 | |
---|
[88] | 202 | // // ~~~~~[ Interface "retire_rob" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 203 | // in_RETIRE_ROB_VAL = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 204 | // out_RETIRE_ROB_ACK = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 205 | // in_RETIRE_ROB_RD_OLD_USE = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 206 | // in_RETIRE_ROB_RD_OLD_NUM_REG = new sc_signal<Tgeneral_address_t> ** [_param->_nb_ooo_engine]; |
---|
| 207 | // in_RETIRE_ROB_RE_OLD_USE = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 208 | // in_RETIRE_ROB_RE_OLD_NUM_REG = new sc_signal<Tspecial_address_t> ** [_param->_nb_ooo_engine]; |
---|
| 209 | // in_RETIRE_ROB_RD_NEW_USE = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 210 | // in_RETIRE_ROB_RD_NEW_NUM_REG = new sc_signal<Tgeneral_address_t> ** [_param->_nb_ooo_engine]; |
---|
| 211 | // in_RETIRE_ROB_RE_NEW_USE = new sc_signal<Tcontrol_t > ** [_param->_nb_ooo_engine]; |
---|
| 212 | // in_RETIRE_ROB_RE_NEW_NUM_REG = new sc_signal<Tspecial_address_t> ** [_param->_nb_ooo_engine]; |
---|
[60] | 213 | |
---|
[88] | 214 | // for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 215 | // { |
---|
| 216 | // uint32_t x=_param->_nb_inst_retire_rob [i]; |
---|
[60] | 217 | |
---|
[88] | 218 | // in_RETIRE_ROB_VAL [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 219 | // out_RETIRE_ROB_ACK [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 220 | // in_RETIRE_ROB_RD_OLD_USE [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 221 | // in_RETIRE_ROB_RD_OLD_NUM_REG [i] = new sc_signal<Tgeneral_address_t> * [x]; |
---|
| 222 | // in_RETIRE_ROB_RE_OLD_USE [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 223 | // in_RETIRE_ROB_RE_OLD_NUM_REG [i] = new sc_signal<Tspecial_address_t> * [x]; |
---|
| 224 | // in_RETIRE_ROB_RD_NEW_USE [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 225 | // in_RETIRE_ROB_RD_NEW_NUM_REG [i] = new sc_signal<Tgeneral_address_t> * [x]; |
---|
| 226 | // in_RETIRE_ROB_RE_NEW_USE [i] = new sc_signal<Tcontrol_t > * [x]; |
---|
| 227 | // in_RETIRE_ROB_RE_NEW_NUM_REG [i] = new sc_signal<Tspecial_address_t> * [x]; |
---|
[60] | 228 | |
---|
[88] | 229 | // for (uint32_t j=0; j<x; j++) |
---|
| 230 | // { |
---|
| 231 | // in_RETIRE_ROB_VAL [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 232 | // out_RETIRE_ROB_ACK [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 233 | // in_RETIRE_ROB_RD_OLD_USE [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 234 | // in_RETIRE_ROB_RD_OLD_NUM_REG [i][j] = new sc_signal<Tgeneral_address_t> (rename.c_str()); |
---|
| 235 | // in_RETIRE_ROB_RE_OLD_USE [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 236 | // in_RETIRE_ROB_RE_OLD_NUM_REG [i][j] = new sc_signal<Tspecial_address_t> (rename.c_str()); |
---|
| 237 | // in_RETIRE_ROB_RD_NEW_USE [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 238 | // in_RETIRE_ROB_RD_NEW_NUM_REG [i][j] = new sc_signal<Tgeneral_address_t> (rename.c_str()); |
---|
| 239 | // in_RETIRE_ROB_RE_NEW_USE [i][j] = new sc_signal<Tcontrol_t > (rename.c_str()); |
---|
| 240 | // in_RETIRE_ROB_RE_NEW_NUM_REG [i][j] = new sc_signal<Tspecial_address_t> (rename.c_str()); |
---|
| 241 | // } |
---|
| 242 | // } |
---|
[60] | 243 | |
---|
| 244 | |
---|
| 245 | /******************************************************** |
---|
| 246 | * Instanciation |
---|
| 247 | ********************************************************/ |
---|
| 248 | |
---|
| 249 | cout << "<" << name << "> Instanciation of _Register_unit" << endl; |
---|
| 250 | |
---|
| 251 | (*(_Register_unit->in_CLOCK)) (*(in_CLOCK)); |
---|
| 252 | (*(_Register_unit->in_NRESET)) (*(in_NRESET)); |
---|
| 253 | |
---|
| 254 | for (uint32_t i=0; i<_param->_nb_gpr_read; i++) |
---|
| 255 | { |
---|
| 256 | (*(_Register_unit-> in_GPR_READ_VAL [i]))(*( in_GPR_READ_VAL [i])); |
---|
| 257 | (*(_Register_unit->out_GPR_READ_ACK [i]))(*(out_GPR_READ_ACK [i])); |
---|
| 258 | if (_param->_have_port_ooo_engine_id == true) |
---|
| 259 | (*(_Register_unit-> in_GPR_READ_OOO_ENGINE_ID [i]))(*( in_GPR_READ_OOO_ENGINE_ID [i])); |
---|
| 260 | (*(_Register_unit-> in_GPR_READ_NUM_REG [i]))(*( in_GPR_READ_NUM_REG [i])); |
---|
| 261 | (*(_Register_unit->out_GPR_READ_DATA [i]))(*(out_GPR_READ_DATA [i])); |
---|
| 262 | (*(_Register_unit->out_GPR_READ_DATA_VAL [i]))(*(out_GPR_READ_DATA_VAL [i])); |
---|
| 263 | } |
---|
| 264 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
| 265 | { |
---|
| 266 | (*(_Register_unit-> in_GPR_WRITE_VAL [i]))(*( in_GPR_WRITE_VAL [i])); |
---|
| 267 | (*(_Register_unit->out_GPR_WRITE_ACK [i]))(*(out_GPR_WRITE_ACK [i])); |
---|
| 268 | if (_param->_have_port_ooo_engine_id == true) |
---|
| 269 | (*(_Register_unit-> in_GPR_WRITE_OOO_ENGINE_ID [i]))(*( in_GPR_WRITE_OOO_ENGINE_ID [i])); |
---|
| 270 | (*(_Register_unit-> in_GPR_WRITE_NUM_REG [i]))(*( in_GPR_WRITE_NUM_REG [i])); |
---|
| 271 | (*(_Register_unit-> in_GPR_WRITE_DATA [i]))(*( in_GPR_WRITE_DATA [i])); |
---|
| 272 | } |
---|
| 273 | for (uint32_t i=0; i<_param->_nb_spr_read; i++) |
---|
| 274 | { |
---|
| 275 | (*(_Register_unit-> in_SPR_READ_VAL [i]))(*( in_SPR_READ_VAL [i])); |
---|
| 276 | (*(_Register_unit->out_SPR_READ_ACK [i]))(*(out_SPR_READ_ACK [i])); |
---|
| 277 | if (_param->_have_port_ooo_engine_id == true) |
---|
| 278 | (*(_Register_unit-> in_SPR_READ_OOO_ENGINE_ID [i]))(*( in_SPR_READ_OOO_ENGINE_ID [i])); |
---|
| 279 | (*(_Register_unit-> in_SPR_READ_NUM_REG [i]))(*( in_SPR_READ_NUM_REG [i])); |
---|
| 280 | (*(_Register_unit->out_SPR_READ_DATA [i]))(*(out_SPR_READ_DATA [i])); |
---|
| 281 | (*(_Register_unit->out_SPR_READ_DATA_VAL [i]))(*(out_SPR_READ_DATA_VAL [i])); |
---|
| 282 | } |
---|
| 283 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
| 284 | { |
---|
| 285 | (*(_Register_unit-> in_SPR_WRITE_VAL [i]))(*( in_SPR_WRITE_VAL [i])); |
---|
| 286 | (*(_Register_unit->out_SPR_WRITE_ACK [i]))(*(out_SPR_WRITE_ACK [i])); |
---|
| 287 | if (_param->_have_port_ooo_engine_id == true) |
---|
| 288 | (*(_Register_unit-> in_SPR_WRITE_OOO_ENGINE_ID [i]))(*( in_SPR_WRITE_OOO_ENGINE_ID [i])); |
---|
| 289 | (*(_Register_unit-> in_SPR_WRITE_NUM_REG [i]))(*( in_SPR_WRITE_NUM_REG [i])); |
---|
| 290 | (*(_Register_unit-> in_SPR_WRITE_DATA [i]))(*( in_SPR_WRITE_DATA [i])); |
---|
| 291 | } |
---|
| 292 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 293 | for (uint32_t j=0; j<_param->_nb_inst_insert_rob [i]; j++) |
---|
| 294 | { |
---|
| 295 | (*(_Register_unit-> in_INSERT_ROB_VAL [i][j]))(*( in_INSERT_ROB_VAL [i][j])); |
---|
| 296 | (*(_Register_unit->out_INSERT_ROB_ACK [i][j]))(*(out_INSERT_ROB_ACK [i][j])); |
---|
| 297 | (*(_Register_unit-> in_INSERT_ROB_RD_USE [i][j]))(*( in_INSERT_ROB_RD_USE [i][j])); |
---|
| 298 | (*(_Register_unit-> in_INSERT_ROB_RD_NUM_REG [i][j]))(*( in_INSERT_ROB_RD_NUM_REG [i][j])); |
---|
| 299 | (*(_Register_unit-> in_INSERT_ROB_RE_USE [i][j]))(*( in_INSERT_ROB_RE_USE [i][j])); |
---|
| 300 | (*(_Register_unit-> in_INSERT_ROB_RE_NUM_REG [i][j]))(*( in_INSERT_ROB_RE_NUM_REG [i][j])); |
---|
| 301 | } |
---|
[88] | 302 | // for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 303 | // for (uint32_t j=0; j<_param->_nb_inst_retire_rob [i]; j++) |
---|
| 304 | // { |
---|
| 305 | // (*(_Register_unit-> in_RETIRE_ROB_VAL [i][j]))(*( in_RETIRE_ROB_VAL [i][j])); |
---|
| 306 | // (*(_Register_unit->out_RETIRE_ROB_ACK [i][j]))(*(out_RETIRE_ROB_ACK [i][j])); |
---|
| 307 | // (*(_Register_unit-> in_RETIRE_ROB_RD_OLD_USE [i][j]))(*( in_RETIRE_ROB_RD_OLD_USE [i][j])); |
---|
| 308 | // (*(_Register_unit-> in_RETIRE_ROB_RD_OLD_NUM_REG [i][j]))(*( in_RETIRE_ROB_RD_OLD_NUM_REG [i][j])); |
---|
| 309 | // (*(_Register_unit-> in_RETIRE_ROB_RE_OLD_USE [i][j]))(*( in_RETIRE_ROB_RE_OLD_USE [i][j])); |
---|
| 310 | // (*(_Register_unit-> in_RETIRE_ROB_RE_OLD_NUM_REG [i][j]))(*( in_RETIRE_ROB_RE_OLD_NUM_REG [i][j])); |
---|
| 311 | // (*(_Register_unit-> in_RETIRE_ROB_RD_NEW_USE [i][j]))(*( in_RETIRE_ROB_RD_NEW_USE [i][j])); |
---|
| 312 | // (*(_Register_unit-> in_RETIRE_ROB_RD_NEW_NUM_REG [i][j]))(*( in_RETIRE_ROB_RD_NEW_NUM_REG [i][j])); |
---|
| 313 | // (*(_Register_unit-> in_RETIRE_ROB_RE_NEW_USE [i][j]))(*( in_RETIRE_ROB_RE_NEW_USE [i][j])); |
---|
| 314 | // (*(_Register_unit-> in_RETIRE_ROB_RE_NEW_NUM_REG [i][j]))(*( in_RETIRE_ROB_RE_NEW_NUM_REG [i][j])); |
---|
| 315 | // } |
---|
[60] | 316 | |
---|
| 317 | cout << "<" << name << "> Start Simulation ............" << endl; |
---|
| 318 | Time * _time = new Time(); |
---|
| 319 | |
---|
| 320 | /******************************************************** |
---|
| 321 | * Simulation - Begin |
---|
| 322 | ********************************************************/ |
---|
| 323 | |
---|
| 324 | // Initialisation |
---|
[64] | 325 | uint32_t max_nb_general_register = 0; |
---|
[60] | 326 | |
---|
[64] | 327 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 328 | if (_param->_nb_general_register [i] > max_nb_general_register) |
---|
| 329 | max_nb_general_register = _param->_nb_general_register [i]; |
---|
| 330 | |
---|
| 331 | uint32_t max_nb_special_register = 0; |
---|
| 332 | |
---|
| 333 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 334 | if (_param->_nb_special_register [i] > max_nb_special_register) |
---|
| 335 | max_nb_special_register = _param->_nb_special_register [i]; |
---|
| 336 | |
---|
| 337 | const int32_t percent_transaction_read = 70; |
---|
| 338 | const int32_t percent_transaction_write = 70; |
---|
| 339 | const int32_t percent_transaction_insert = 70; |
---|
| 340 | const int32_t percent_transaction_insert_use = 70; |
---|
[88] | 341 | // const int32_t percent_transaction_retire = 70; |
---|
| 342 | // const int32_t percent_transaction_retire_use = 70; |
---|
[64] | 343 | const uint32_t nb_request = max_nb_general_register; |
---|
| 344 | |
---|
[60] | 345 | const uint32_t seed = 0; |
---|
| 346 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 347 | |
---|
| 348 | srand(seed); |
---|
| 349 | |
---|
[64] | 350 | Tgeneral_data_t gpr [_param->_nb_ooo_engine][max_nb_general_register]; |
---|
| 351 | Tcontrol_t gpr_status [_param->_nb_ooo_engine][max_nb_general_register]; |
---|
| 352 | Tspecial_data_t spr [_param->_nb_ooo_engine][max_nb_special_register]; |
---|
| 353 | Tcontrol_t spr_status [_param->_nb_ooo_engine][max_nb_special_register]; |
---|
| 354 | |
---|
[60] | 355 | SC_START(0); |
---|
| 356 | |
---|
| 357 | LABEL("Initialisation"); |
---|
| 358 | |
---|
[65] | 359 | in_NRESET->write(0); |
---|
| 360 | SC_START(5); |
---|
| 361 | in_NRESET->write(1); |
---|
| 362 | |
---|
[64] | 363 | for (uint32_t i=0; i<_param->_nb_gpr_read ; i++) |
---|
| 364 | in_GPR_READ_VAL [i]->write(0); |
---|
| 365 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
| 366 | in_GPR_WRITE_VAL [i]->write(0); |
---|
| 367 | for (uint32_t i=0; i<_param->_nb_spr_read ; i++) |
---|
| 368 | in_SPR_READ_VAL [i]->write(0); |
---|
| 369 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
| 370 | in_SPR_WRITE_VAL [i]->write(0); |
---|
| 371 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 372 | { |
---|
| 373 | for (uint32_t j=0; j<_param->_nb_inst_insert_rob [i]; j++) |
---|
| 374 | in_INSERT_ROB_VAL [i][j]->write(0); |
---|
[88] | 375 | // for (uint32_t j=0; j<_param->_nb_inst_retire_rob [i]; j++) |
---|
| 376 | // in_RETIRE_ROB_VAL [i][j]->write(0); |
---|
[64] | 377 | } |
---|
| 378 | |
---|
| 379 | Tgeneral_address_t gpr_address [_param->_nb_gpr_write]; |
---|
| 380 | Tgeneral_address_t gpr_address_next; |
---|
| 381 | uint32_t nb_port_gpr_active; // number of port active |
---|
| 382 | |
---|
| 383 | Tspecial_address_t spr_address [_param->_nb_spr_write]; |
---|
| 384 | Tspecial_address_t spr_address_next; |
---|
| 385 | uint32_t nb_port_spr_active; // number of port active |
---|
| 386 | |
---|
[60] | 387 | LABEL("Loop of Test"); |
---|
| 388 | |
---|
| 389 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
| 390 | { |
---|
[82] | 391 | LABEL("Iteration %d",iteration); |
---|
[60] | 392 | |
---|
[64] | 393 | LABEL("(GPR) Write default value"); |
---|
| 394 | |
---|
| 395 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 396 | for(uint32_t j=0; j<max_nb_general_register; j++) |
---|
| 397 | { |
---|
| 398 | gpr [i][j] = rand()%_param->_size_general_data; |
---|
| 399 | gpr_status [i][j] = 1; |
---|
| 400 | } |
---|
| 401 | |
---|
| 402 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 403 | { |
---|
| 404 | gpr_address_next = _param->_nb_gpr_write; |
---|
| 405 | nb_port_gpr_active = _param->_nb_gpr_write; |
---|
| 406 | |
---|
| 407 | for (uint32_t j=0; j<_param->_nb_gpr_write; j++) |
---|
| 408 | { |
---|
| 409 | gpr_address[j] = j; |
---|
| 410 | if (j >= _param->_nb_general_register [i]) |
---|
| 411 | nb_port_gpr_active --; |
---|
| 412 | } |
---|
| 413 | |
---|
| 414 | while (nb_port_gpr_active > 0) |
---|
| 415 | { |
---|
| 416 | for (uint32_t j=0; j<_param->_nb_gpr_write; j++) |
---|
| 417 | { |
---|
| 418 | in_GPR_WRITE_VAL [j]->write((gpr_address[j] < _param->_nb_general_register [i]) and |
---|
| 419 | ((rand() % 100) < percent_transaction_write)); |
---|
| 420 | in_GPR_WRITE_OOO_ENGINE_ID [j]->write(i); |
---|
| 421 | in_GPR_WRITE_NUM_REG [j]->write(gpr_address[j]); |
---|
| 422 | in_GPR_WRITE_DATA [j]->write(gpr [i][gpr_address[j]]); |
---|
| 423 | } |
---|
| 424 | |
---|
| 425 | SC_START(1); |
---|
| 426 | |
---|
| 427 | // Test if write |
---|
| 428 | for (uint32_t j=0; j<_param->_nb_gpr_write; j++) |
---|
| 429 | if (in_GPR_WRITE_VAL [j]->read() and out_GPR_WRITE_ACK [j]->read()) |
---|
| 430 | { |
---|
| 431 | gpr_address[j] = gpr_address_next; |
---|
| 432 | |
---|
| 433 | if (gpr_address_next >= _param->_nb_general_register [i]) |
---|
| 434 | nb_port_gpr_active --; |
---|
| 435 | |
---|
| 436 | gpr_address_next ++; |
---|
| 437 | } |
---|
| 438 | } |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | for (uint32_t i=0; i<_param->_nb_gpr_write; i++) |
---|
| 442 | in_GPR_WRITE_VAL [i]->write(0); |
---|
| 443 | |
---|
| 444 | LABEL("(GPR) Read - and test data writted"); |
---|
| 445 | |
---|
| 446 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 447 | { |
---|
| 448 | gpr_address_next = _param->_nb_gpr_read; |
---|
| 449 | nb_port_gpr_active = _param->_nb_gpr_read; |
---|
| 450 | |
---|
| 451 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 452 | { |
---|
| 453 | gpr_address[j] = j; |
---|
| 454 | if (j >= _param->_nb_general_register [i]) |
---|
| 455 | nb_port_gpr_active --; |
---|
| 456 | } |
---|
| 457 | |
---|
| 458 | while (nb_port_gpr_active > 0) |
---|
| 459 | { |
---|
| 460 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 461 | { |
---|
| 462 | in_GPR_READ_VAL [j]->write((gpr_address[j] < _param->_nb_general_register [i]) and |
---|
| 463 | ((rand() % 100) < percent_transaction_read)); |
---|
| 464 | in_GPR_READ_OOO_ENGINE_ID [j]->write(i); |
---|
| 465 | in_GPR_READ_NUM_REG [j]->write(gpr_address[j]); |
---|
| 466 | } |
---|
| 467 | |
---|
| 468 | SC_START(1); |
---|
| 469 | |
---|
| 470 | // Test if read |
---|
| 471 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 472 | if (in_GPR_READ_VAL [j]->read() and out_GPR_READ_ACK [j]->read()) |
---|
| 473 | { |
---|
| 474 | TEST(Tgeneral_data_t, out_GPR_READ_DATA [j]->read(), gpr [i][gpr_address[j]]); |
---|
| 475 | TEST(Tcontrol_t , out_GPR_READ_DATA_VAL[j]->read(), gpr_status [i][gpr_address[j]]); |
---|
| 476 | |
---|
| 477 | gpr_address[j] = gpr_address_next; |
---|
| 478 | |
---|
| 479 | if (gpr_address_next >= _param->_nb_general_register [i]) |
---|
| 480 | nb_port_gpr_active --; |
---|
| 481 | |
---|
| 482 | gpr_address_next ++; |
---|
| 483 | } |
---|
| 484 | } |
---|
| 485 | } |
---|
| 486 | |
---|
| 487 | for (uint32_t i=0; i<_param->_nb_gpr_read; i++) |
---|
| 488 | in_GPR_READ_VAL [i]->write(0); |
---|
| 489 | |
---|
| 490 | LABEL("(SPR) Write default value"); |
---|
| 491 | |
---|
| 492 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 493 | for(uint32_t j=0; j<max_nb_special_register; j++) |
---|
| 494 | { |
---|
| 495 | spr [i][j] = rand()%_param->_size_special_data; |
---|
| 496 | spr_status [i][j] = 1; |
---|
| 497 | } |
---|
| 498 | |
---|
| 499 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 500 | { |
---|
| 501 | spr_address_next = _param->_nb_spr_write; |
---|
| 502 | nb_port_spr_active = _param->_nb_spr_write; |
---|
| 503 | |
---|
| 504 | for (uint32_t j=0; j<_param->_nb_spr_write; j++) |
---|
| 505 | { |
---|
| 506 | spr_address[j] = j; |
---|
| 507 | if (j >= _param->_nb_special_register [i]) |
---|
| 508 | nb_port_spr_active --; |
---|
| 509 | } |
---|
| 510 | |
---|
| 511 | while (nb_port_spr_active > 0) |
---|
| 512 | { |
---|
| 513 | for (uint32_t j=0; j<_param->_nb_spr_write; j++) |
---|
| 514 | { |
---|
| 515 | in_SPR_WRITE_VAL [j]->write((spr_address[j] < _param->_nb_special_register [i]) and |
---|
| 516 | ((rand() % 100) < percent_transaction_write)); |
---|
| 517 | in_SPR_WRITE_OOO_ENGINE_ID [j]->write(i); |
---|
| 518 | in_SPR_WRITE_NUM_REG [j]->write(spr_address[j]); |
---|
| 519 | in_SPR_WRITE_DATA [j]->write(spr [i][spr_address[j]]); |
---|
| 520 | } |
---|
| 521 | |
---|
| 522 | SC_START(1); |
---|
| 523 | |
---|
| 524 | // Test if write |
---|
| 525 | for (uint32_t j=0; j<_param->_nb_spr_write; j++) |
---|
| 526 | if (in_SPR_WRITE_VAL [j]->read() and out_SPR_WRITE_ACK [j]->read()) |
---|
| 527 | { |
---|
| 528 | spr_address[j] = spr_address_next; |
---|
| 529 | |
---|
| 530 | if (spr_address_next >= _param->_nb_special_register [i]) |
---|
| 531 | nb_port_spr_active --; |
---|
| 532 | |
---|
| 533 | spr_address_next ++; |
---|
| 534 | } |
---|
| 535 | } |
---|
| 536 | } |
---|
| 537 | |
---|
| 538 | for (uint32_t i=0; i<_param->_nb_spr_write; i++) |
---|
| 539 | in_SPR_WRITE_VAL [i]->write(0); |
---|
| 540 | |
---|
| 541 | LABEL("(SPR) Read - and test data writted"); |
---|
| 542 | |
---|
| 543 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 544 | { |
---|
| 545 | spr_address_next = _param->_nb_spr_read; |
---|
| 546 | nb_port_spr_active = _param->_nb_spr_read; |
---|
| 547 | |
---|
| 548 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 549 | { |
---|
| 550 | spr_address[j] = j; |
---|
| 551 | if (j >= _param->_nb_special_register [i]) |
---|
| 552 | nb_port_spr_active --; |
---|
| 553 | } |
---|
| 554 | |
---|
| 555 | while (nb_port_spr_active > 0) |
---|
| 556 | { |
---|
| 557 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 558 | { |
---|
| 559 | in_SPR_READ_VAL [j]->write((spr_address[j] < _param->_nb_special_register [i]) and |
---|
| 560 | ((rand() % 100) < percent_transaction_read)); |
---|
| 561 | in_SPR_READ_OOO_ENGINE_ID [j]->write(i); |
---|
| 562 | in_SPR_READ_NUM_REG [j]->write(spr_address[j]); |
---|
| 563 | } |
---|
| 564 | |
---|
| 565 | SC_START(1); |
---|
| 566 | |
---|
| 567 | // Test if read |
---|
| 568 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 569 | if (in_SPR_READ_VAL [j]->read() and out_SPR_READ_ACK [j]->read()) |
---|
| 570 | { |
---|
| 571 | TEST(Tspecial_data_t, out_SPR_READ_DATA [j]->read(), spr [i][spr_address[j]]); |
---|
| 572 | TEST(Tcontrol_t , out_SPR_READ_DATA_VAL[j]->read(), spr_status [i][spr_address[j]]); |
---|
| 573 | |
---|
| 574 | spr_address[j] = spr_address_next; |
---|
| 575 | |
---|
| 576 | if (spr_address_next >= _param->_nb_special_register [i]) |
---|
| 577 | nb_port_spr_active --; |
---|
| 578 | |
---|
| 579 | spr_address_next ++; |
---|
| 580 | } |
---|
| 581 | } |
---|
| 582 | } |
---|
| 583 | |
---|
| 584 | for (uint32_t i=0; i<_param->_nb_spr_read; i++) |
---|
| 585 | in_SPR_READ_VAL [i]->write(0); |
---|
| 586 | |
---|
| 587 | LABEL("insert rob"); |
---|
| 588 | |
---|
| 589 | uint32_t cpt = 0; |
---|
| 590 | |
---|
| 591 | while (cpt < nb_request) |
---|
| 592 | { |
---|
| 593 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 594 | { |
---|
| 595 | uint32_t x=_param->_nb_inst_insert_rob [i]; |
---|
| 596 | for (uint32_t j=0; j<x; j++) |
---|
| 597 | { |
---|
| 598 | in_INSERT_ROB_VAL [i][j]->write((rand() % 100) < percent_transaction_insert); |
---|
| 599 | in_INSERT_ROB_RD_USE [i][j]->write((rand() % 100) < percent_transaction_insert_use); |
---|
| 600 | in_INSERT_ROB_RD_NUM_REG [i][j]->write(rand() % _param->_nb_general_register [i]); |
---|
| 601 | in_INSERT_ROB_RE_USE [i][j]->write((rand() % 100) < percent_transaction_insert_use); |
---|
| 602 | in_INSERT_ROB_RE_NUM_REG [i][j]->write(rand() % _param->_nb_special_register [i]); |
---|
| 603 | } |
---|
| 604 | } |
---|
| 605 | |
---|
| 606 | SC_START(1); |
---|
| 607 | |
---|
| 608 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 609 | { |
---|
| 610 | uint32_t x=_param->_nb_inst_insert_rob [i]; |
---|
| 611 | for (uint32_t j=0; j<x; j++) |
---|
| 612 | { |
---|
| 613 | if (in_INSERT_ROB_VAL [i][j]->read() and out_INSERT_ROB_ACK [i][j]->read()) |
---|
| 614 | { |
---|
| 615 | cpt ++; |
---|
| 616 | |
---|
| 617 | if (in_INSERT_ROB_RD_USE [i][j]->read()) |
---|
| 618 | gpr_status [i][in_INSERT_ROB_RD_NUM_REG [i][j]->read()] = 0; |
---|
| 619 | |
---|
| 620 | if (in_INSERT_ROB_RE_USE [i][j]->read()) |
---|
| 621 | spr_status [i][in_INSERT_ROB_RE_NUM_REG [i][j]->read()] = 0; |
---|
| 622 | } |
---|
| 623 | } |
---|
| 624 | } |
---|
| 625 | } |
---|
| 626 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 627 | for (uint32_t j=0; j<_param->_nb_inst_insert_rob [i]; j++) |
---|
| 628 | in_INSERT_ROB_VAL [i][j]->write(0); |
---|
| 629 | |
---|
| 630 | LABEL("(GPR) Read - and test data writted"); |
---|
| 631 | |
---|
| 632 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 633 | { |
---|
| 634 | gpr_address_next = _param->_nb_gpr_read; |
---|
| 635 | nb_port_gpr_active = _param->_nb_gpr_read; |
---|
| 636 | |
---|
| 637 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 638 | { |
---|
| 639 | gpr_address[j] = j; |
---|
| 640 | if (j >= _param->_nb_general_register [i]) |
---|
| 641 | nb_port_gpr_active --; |
---|
| 642 | } |
---|
| 643 | |
---|
| 644 | while (nb_port_gpr_active > 0) |
---|
| 645 | { |
---|
| 646 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 647 | { |
---|
| 648 | in_GPR_READ_VAL [j]->write((gpr_address[j] < _param->_nb_general_register [i]) and |
---|
| 649 | ((rand() % 100) < percent_transaction_read)); |
---|
| 650 | in_GPR_READ_OOO_ENGINE_ID [j]->write(i); |
---|
| 651 | in_GPR_READ_NUM_REG [j]->write(gpr_address[j]); |
---|
| 652 | } |
---|
| 653 | |
---|
| 654 | SC_START(1); |
---|
| 655 | |
---|
| 656 | // Test if read |
---|
| 657 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 658 | if (in_GPR_READ_VAL [j]->read() and out_GPR_READ_ACK [j]->read()) |
---|
| 659 | { |
---|
| 660 | TEST(Tgeneral_data_t, out_GPR_READ_DATA [j]->read(), gpr [i][gpr_address[j]]); |
---|
| 661 | TEST(Tcontrol_t , out_GPR_READ_DATA_VAL[j]->read(), gpr_status [i][gpr_address[j]]); |
---|
| 662 | |
---|
| 663 | gpr_address[j] = gpr_address_next; |
---|
| 664 | |
---|
| 665 | if (gpr_address_next >= _param->_nb_general_register [i]) |
---|
| 666 | nb_port_gpr_active --; |
---|
| 667 | |
---|
| 668 | gpr_address_next ++; |
---|
| 669 | } |
---|
| 670 | } |
---|
| 671 | } |
---|
| 672 | |
---|
| 673 | for (uint32_t i=0; i<_param->_nb_gpr_read; i++) |
---|
| 674 | in_GPR_READ_VAL [i]->write(0); |
---|
| 675 | |
---|
| 676 | LABEL("(SPR) Read - and test data writted"); |
---|
| 677 | |
---|
| 678 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 679 | { |
---|
| 680 | spr_address_next = _param->_nb_spr_read; |
---|
| 681 | nb_port_spr_active = _param->_nb_spr_read; |
---|
| 682 | |
---|
| 683 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 684 | { |
---|
| 685 | spr_address[j] = j; |
---|
| 686 | if (j >= _param->_nb_special_register [i]) |
---|
| 687 | nb_port_spr_active --; |
---|
| 688 | } |
---|
| 689 | |
---|
| 690 | while (nb_port_spr_active > 0) |
---|
| 691 | { |
---|
| 692 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 693 | { |
---|
| 694 | in_SPR_READ_VAL [j]->write((spr_address[j] < _param->_nb_special_register [i]) and |
---|
| 695 | ((rand() % 100) < percent_transaction_read)); |
---|
| 696 | in_SPR_READ_OOO_ENGINE_ID [j]->write(i); |
---|
| 697 | in_SPR_READ_NUM_REG [j]->write(spr_address[j]); |
---|
| 698 | } |
---|
| 699 | |
---|
| 700 | SC_START(1); |
---|
| 701 | |
---|
| 702 | // Test if read |
---|
| 703 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 704 | if (in_SPR_READ_VAL [j]->read() and out_SPR_READ_ACK [j]->read()) |
---|
| 705 | { |
---|
| 706 | TEST(Tspecial_data_t, out_SPR_READ_DATA [j]->read(), spr [i][spr_address[j]]); |
---|
| 707 | TEST(Tcontrol_t , out_SPR_READ_DATA_VAL[j]->read(), spr_status [i][spr_address[j]]); |
---|
| 708 | |
---|
| 709 | spr_address[j] = spr_address_next; |
---|
| 710 | |
---|
| 711 | if (spr_address_next >= _param->_nb_special_register [i]) |
---|
| 712 | nb_port_spr_active --; |
---|
| 713 | |
---|
| 714 | spr_address_next ++; |
---|
| 715 | } |
---|
| 716 | } |
---|
| 717 | } |
---|
| 718 | |
---|
[88] | 719 | // LABEL("retire rob"); |
---|
[64] | 720 | |
---|
[88] | 721 | // cpt = 0; |
---|
[64] | 722 | |
---|
[88] | 723 | // while (cpt < nb_request) |
---|
| 724 | // { |
---|
| 725 | // for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 726 | // { |
---|
| 727 | // uint32_t x=_param->_nb_inst_retire_rob [i]; |
---|
| 728 | // for (uint32_t j=0; j<x; j++) |
---|
| 729 | // { |
---|
| 730 | // in_RETIRE_ROB_VAL [i][j]->write((rand() % 100) < percent_transaction_retire); |
---|
| 731 | // in_RETIRE_ROB_RD_OLD_USE [i][j]->write((rand() % 100) < percent_transaction_retire_use); |
---|
| 732 | // in_RETIRE_ROB_RD_OLD_NUM_REG [i][j]->write(rand() % _param->_nb_general_register [i]); |
---|
| 733 | // in_RETIRE_ROB_RD_NEW_USE [i][j]->write((rand() % 100) < percent_transaction_retire_use); |
---|
| 734 | // in_RETIRE_ROB_RD_NEW_NUM_REG [i][j]->write(rand() % _param->_nb_general_register [i]); |
---|
| 735 | // in_RETIRE_ROB_RE_OLD_USE [i][j]->write((rand() % 100) < percent_transaction_retire_use); |
---|
| 736 | // in_RETIRE_ROB_RE_OLD_NUM_REG [i][j]->write(rand() % _param->_nb_special_register [i]); |
---|
| 737 | // in_RETIRE_ROB_RE_NEW_USE [i][j]->write((rand() % 100) < percent_transaction_retire_use); |
---|
| 738 | // in_RETIRE_ROB_RE_NEW_NUM_REG [i][j]->write(rand() % _param->_nb_special_register [i]); |
---|
| 739 | // } |
---|
| 740 | // } |
---|
[64] | 741 | |
---|
[88] | 742 | // SC_START(1); |
---|
[64] | 743 | |
---|
[88] | 744 | // for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 745 | // { |
---|
| 746 | // uint32_t x=_param->_nb_inst_retire_rob [i]; |
---|
| 747 | // for (uint32_t j=0; j<x; j++) |
---|
| 748 | // { |
---|
| 749 | // if (in_RETIRE_ROB_VAL [i][j]->read() and out_RETIRE_ROB_ACK [i][j]->read()) |
---|
| 750 | // { |
---|
| 751 | // cpt ++; |
---|
[64] | 752 | |
---|
[88] | 753 | // if (in_RETIRE_ROB_RD_OLD_USE [i][j]->read()) |
---|
| 754 | // gpr_status [i][in_RETIRE_ROB_RD_OLD_NUM_REG [i][j]->read()] = 0; |
---|
| 755 | // if (in_RETIRE_ROB_RD_NEW_USE [i][j]->read()) |
---|
| 756 | // gpr_status [i][in_RETIRE_ROB_RD_NEW_NUM_REG [i][j]->read()] = 1; |
---|
| 757 | // if (in_RETIRE_ROB_RE_OLD_USE [i][j]->read()) |
---|
| 758 | // spr_status [i][in_RETIRE_ROB_RE_OLD_NUM_REG [i][j]->read()] = 0; |
---|
| 759 | // if (in_RETIRE_ROB_RE_NEW_USE [i][j]->read()) |
---|
| 760 | // spr_status [i][in_RETIRE_ROB_RE_NEW_NUM_REG [i][j]->read()] = 1; |
---|
| 761 | // } |
---|
| 762 | // } |
---|
| 763 | // } |
---|
| 764 | // } |
---|
| 765 | // for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 766 | // for (uint32_t j=0; j<_param->_nb_inst_retire_rob [i]; j++) |
---|
| 767 | // in_RETIRE_ROB_VAL [i][j]->write(0); |
---|
[64] | 768 | |
---|
| 769 | LABEL("(GPR) Read - and test data writted"); |
---|
| 770 | |
---|
| 771 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 772 | { |
---|
| 773 | gpr_address_next = _param->_nb_gpr_read; |
---|
| 774 | nb_port_gpr_active = _param->_nb_gpr_read; |
---|
| 775 | |
---|
| 776 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 777 | { |
---|
| 778 | gpr_address[j] = j; |
---|
| 779 | if (j >= _param->_nb_general_register [i]) |
---|
| 780 | nb_port_gpr_active --; |
---|
| 781 | } |
---|
| 782 | |
---|
| 783 | while (nb_port_gpr_active > 0) |
---|
| 784 | { |
---|
| 785 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 786 | { |
---|
| 787 | in_GPR_READ_VAL [j]->write((gpr_address[j] < _param->_nb_general_register [i]) and |
---|
| 788 | ((rand() % 100) < percent_transaction_read)); |
---|
| 789 | in_GPR_READ_OOO_ENGINE_ID [j]->write(i); |
---|
| 790 | in_GPR_READ_NUM_REG [j]->write(gpr_address[j]); |
---|
| 791 | } |
---|
| 792 | |
---|
| 793 | SC_START(1); |
---|
| 794 | |
---|
| 795 | // Test if read |
---|
| 796 | for (uint32_t j=0; j<_param->_nb_gpr_read; j++) |
---|
| 797 | if (in_GPR_READ_VAL [j]->read() and out_GPR_READ_ACK [j]->read()) |
---|
| 798 | { |
---|
| 799 | TEST(Tgeneral_data_t, out_GPR_READ_DATA [j]->read(), gpr [i][gpr_address[j]]); |
---|
| 800 | TEST(Tcontrol_t , out_GPR_READ_DATA_VAL[j]->read(), gpr_status [i][gpr_address[j]]); |
---|
| 801 | |
---|
| 802 | gpr_address[j] = gpr_address_next; |
---|
| 803 | |
---|
| 804 | if (gpr_address_next >= _param->_nb_general_register [i]) |
---|
| 805 | nb_port_gpr_active --; |
---|
| 806 | |
---|
| 807 | gpr_address_next ++; |
---|
| 808 | } |
---|
| 809 | } |
---|
| 810 | } |
---|
| 811 | |
---|
| 812 | for (uint32_t i=0; i<_param->_nb_gpr_read; i++) |
---|
| 813 | in_GPR_READ_VAL [i]->write(0); |
---|
| 814 | |
---|
| 815 | LABEL("(SPR) Read - and test data writted"); |
---|
| 816 | |
---|
| 817 | for (uint32_t i=0; i<_param->_nb_ooo_engine; i++) |
---|
| 818 | { |
---|
| 819 | spr_address_next = _param->_nb_spr_read; |
---|
| 820 | nb_port_spr_active = _param->_nb_spr_read; |
---|
| 821 | |
---|
| 822 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 823 | { |
---|
| 824 | spr_address[j] = j; |
---|
| 825 | if (j >= _param->_nb_special_register [i]) |
---|
| 826 | nb_port_spr_active --; |
---|
| 827 | } |
---|
| 828 | |
---|
| 829 | while (nb_port_spr_active > 0) |
---|
| 830 | { |
---|
| 831 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 832 | { |
---|
| 833 | in_SPR_READ_VAL [j]->write((spr_address[j] < _param->_nb_special_register [i]) and |
---|
| 834 | ((rand() % 100) < percent_transaction_read)); |
---|
| 835 | in_SPR_READ_OOO_ENGINE_ID [j]->write(i); |
---|
| 836 | in_SPR_READ_NUM_REG [j]->write(spr_address[j]); |
---|
| 837 | } |
---|
| 838 | |
---|
| 839 | SC_START(1); |
---|
| 840 | |
---|
| 841 | // Test if read |
---|
| 842 | for (uint32_t j=0; j<_param->_nb_spr_read; j++) |
---|
| 843 | if (in_SPR_READ_VAL [j]->read() and out_SPR_READ_ACK [j]->read()) |
---|
| 844 | { |
---|
| 845 | TEST(Tspecial_data_t, out_SPR_READ_DATA [j]->read(), spr [i][spr_address[j]]); |
---|
| 846 | TEST(Tcontrol_t , out_SPR_READ_DATA_VAL[j]->read(), spr_status [i][spr_address[j]]); |
---|
| 847 | |
---|
| 848 | spr_address[j] = spr_address_next; |
---|
| 849 | |
---|
| 850 | if (spr_address_next >= _param->_nb_special_register [i]) |
---|
| 851 | nb_port_spr_active --; |
---|
| 852 | |
---|
| 853 | spr_address_next ++; |
---|
| 854 | } |
---|
| 855 | } |
---|
| 856 | } |
---|
| 857 | |
---|
[60] | 858 | } |
---|
| 859 | |
---|
| 860 | /******************************************************** |
---|
| 861 | * Simulation - End |
---|
| 862 | ********************************************************/ |
---|
| 863 | |
---|
| 864 | TEST_OK ("End of Simulation"); |
---|
| 865 | delete _time; |
---|
| 866 | cout << "<" << name << "> ............ Stop Simulation" << endl; |
---|
| 867 | |
---|
| 868 | delete in_CLOCK; |
---|
| 869 | delete in_NRESET; |
---|
| 870 | |
---|
| 871 | delete [] in_GPR_READ_VAL ; |
---|
| 872 | delete [] out_GPR_READ_ACK ; |
---|
| 873 | delete [] in_GPR_READ_OOO_ENGINE_ID ; |
---|
| 874 | delete [] in_GPR_READ_NUM_REG ; |
---|
| 875 | delete [] out_GPR_READ_DATA ; |
---|
| 876 | delete [] out_GPR_READ_DATA_VAL ; |
---|
| 877 | delete [] in_GPR_WRITE_VAL ; |
---|
| 878 | delete [] out_GPR_WRITE_ACK ; |
---|
| 879 | delete [] in_GPR_WRITE_OOO_ENGINE_ID ; |
---|
| 880 | delete [] in_GPR_WRITE_NUM_REG ; |
---|
| 881 | delete [] in_GPR_WRITE_DATA ; |
---|
| 882 | delete [] in_SPR_READ_VAL ; |
---|
| 883 | delete [] out_SPR_READ_ACK ; |
---|
| 884 | delete [] in_SPR_READ_OOO_ENGINE_ID ; |
---|
| 885 | delete [] in_SPR_READ_NUM_REG ; |
---|
| 886 | delete [] out_SPR_READ_DATA ; |
---|
| 887 | delete [] out_SPR_READ_DATA_VAL ; |
---|
| 888 | delete [] in_SPR_WRITE_VAL ; |
---|
| 889 | delete [] out_SPR_WRITE_ACK ; |
---|
| 890 | delete [] in_SPR_WRITE_OOO_ENGINE_ID ; |
---|
| 891 | delete [] in_SPR_WRITE_NUM_REG ; |
---|
| 892 | delete [] in_SPR_WRITE_DATA ; |
---|
| 893 | delete [] in_INSERT_ROB_VAL ; |
---|
| 894 | delete [] out_INSERT_ROB_ACK ; |
---|
| 895 | delete [] in_INSERT_ROB_RD_USE ; |
---|
| 896 | delete [] in_INSERT_ROB_RD_NUM_REG ; |
---|
| 897 | delete [] in_INSERT_ROB_RE_USE ; |
---|
| 898 | delete [] in_INSERT_ROB_RE_NUM_REG ; |
---|
[88] | 899 | // delete [] in_RETIRE_ROB_VAL ; |
---|
| 900 | // delete [] out_RETIRE_ROB_ACK ; |
---|
| 901 | // delete [] in_RETIRE_ROB_RD_OLD_USE ; |
---|
| 902 | // delete [] in_RETIRE_ROB_RD_OLD_NUM_REG ; |
---|
| 903 | // delete [] in_RETIRE_ROB_RD_NEW_USE ; |
---|
| 904 | // delete [] in_RETIRE_ROB_RD_NEW_NUM_REG ; |
---|
| 905 | // delete [] in_RETIRE_ROB_RE_OLD_USE ; |
---|
| 906 | // delete [] in_RETIRE_ROB_RE_OLD_NUM_REG ; |
---|
| 907 | // delete [] in_RETIRE_ROB_RE_NEW_USE ; |
---|
| 908 | // delete [] in_RETIRE_ROB_RE_NEW_NUM_REG ; |
---|
[60] | 909 | #endif |
---|
| 910 | |
---|
| 911 | delete _Register_unit; |
---|
| 912 | #ifdef STATISTICS |
---|
| 913 | delete _parameters_statistics; |
---|
| 914 | #endif |
---|
| 915 | } |
---|