[77] | 1 | /* |
---|
| 2 | * $Id: test.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | * Test |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Network/Execution_unit_to_Write_unit/SelfTest/include/test.h" |
---|
| 10 | #include "Common/include/Test.h" |
---|
| 11 | #include "Common/include/BitManipulation.h" |
---|
| 12 | #include "Behavioural/include/Allocation.h" |
---|
| 13 | #include <set> |
---|
| 14 | |
---|
| 15 | #define NB_ITERATION 1 |
---|
| 16 | #define CYCLE_MAX (128*NB_ITERATION) |
---|
| 17 | |
---|
| 18 | #define LABEL(str...) \ |
---|
| 19 | { \ |
---|
| 20 | msg (_("{%d} "),static_cast<uint32_t>(sc_simulation_time())); \ |
---|
| 21 | msg (str); \ |
---|
| 22 | msg (_("\n")); \ |
---|
| 23 | } while(0) |
---|
| 24 | |
---|
| 25 | #define SC_START(cycle_offset) \ |
---|
| 26 | do \ |
---|
| 27 | { \ |
---|
| 28 | /*cout << "SC_START (begin)" << endl;*/ \ |
---|
| 29 | \ |
---|
| 30 | uint32_t cycle_current = static_cast<uint32_t>(sc_simulation_time()); \ |
---|
| 31 | if (cycle_offset != 0) \ |
---|
| 32 | { \ |
---|
| 33 | cout << "##########[ cycle "<< cycle_current+cycle_offset << " ]" << endl; \ |
---|
| 34 | } \ |
---|
| 35 | \ |
---|
| 36 | if (cycle_current > CYCLE_MAX) \ |
---|
| 37 | { \ |
---|
| 38 | TEST_KO("Maximal cycles Reached"); \ |
---|
| 39 | } \ |
---|
| 40 | \ |
---|
| 41 | sc_start(cycle_offset); \ |
---|
| 42 | \ |
---|
| 43 | /*cout << "SC_START (end )" << endl;*/ \ |
---|
| 44 | } while(0) |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | class entry_t |
---|
| 48 | { |
---|
| 49 | public : Tcontext_t _context_id ; |
---|
| 50 | public : Tcontext_t _front_end_id ; |
---|
| 51 | public : Tcontext_t _ooo_engine_id ; |
---|
| 52 | public : Tpacket_t _packet_id ; |
---|
| 53 | //public : Toperation_t _operation ; |
---|
[78] | 54 | public : Ttype_t _type ; |
---|
[77] | 55 | public : Tcontrol_t _write_rd ; |
---|
| 56 | public : Tgeneral_address_t _num_reg_rd ; |
---|
| 57 | public : Tgeneral_data_t _data_rd ; |
---|
| 58 | public : Tcontrol_t _write_re ; |
---|
| 59 | public : Tspecial_address_t _num_reg_re ; |
---|
| 60 | public : Tspecial_data_t _data_re ; |
---|
| 61 | public : Texception_t _exception ; |
---|
| 62 | public : Tcontrol_t _no_sequence ; |
---|
| 63 | public : Tgeneral_data_t _address ; |
---|
| 64 | |
---|
| 65 | public : entry_t (Tcontext_t context_id , |
---|
| 66 | Tcontext_t front_end_id , |
---|
| 67 | Tcontext_t ooo_engine_id , |
---|
| 68 | Tpacket_t packet_id , |
---|
| 69 | // Toperation_t operation , |
---|
[78] | 70 | Ttype_t type , |
---|
[77] | 71 | Tcontrol_t write_rd , |
---|
| 72 | Tgeneral_address_t num_reg_rd , |
---|
| 73 | Tgeneral_data_t data_rd , |
---|
| 74 | Tcontrol_t write_re , |
---|
| 75 | Tspecial_address_t num_reg_re , |
---|
| 76 | Tspecial_data_t data_re , |
---|
| 77 | Texception_t exception , |
---|
| 78 | Tcontrol_t no_sequence , |
---|
| 79 | Tgeneral_data_t address ) |
---|
| 80 | { |
---|
| 81 | _context_id = context_id ; |
---|
| 82 | _front_end_id = front_end_id ; |
---|
| 83 | _ooo_engine_id = ooo_engine_id; |
---|
| 84 | _packet_id = packet_id ; |
---|
| 85 | // _operation = operation ; |
---|
[78] | 86 | _type = type ; |
---|
[77] | 87 | _write_rd = write_rd ; |
---|
| 88 | _num_reg_rd = num_reg_rd ; |
---|
| 89 | _data_rd = data_rd ; |
---|
| 90 | _write_re = write_re ; |
---|
| 91 | _num_reg_re = num_reg_re ; |
---|
| 92 | _data_re = data_re ; |
---|
| 93 | _exception = exception ; |
---|
| 94 | _no_sequence = no_sequence ; |
---|
| 95 | _address = address ; |
---|
| 96 | } |
---|
| 97 | }; |
---|
| 98 | |
---|
| 99 | void test (string name, |
---|
| 100 | morpheo::behavioural::core::multi_execute_loop::execute_loop::network::execution_unit_to_write_unit::Parameters * _param) |
---|
| 101 | { |
---|
| 102 | msg(_("<%s> : Simulation SystemC.\n"),name.c_str()); |
---|
| 103 | |
---|
| 104 | #ifdef STATISTICS |
---|
| 105 | morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50); |
---|
| 106 | #endif |
---|
| 107 | |
---|
| 108 | Execution_unit_to_Write_unit * _Execution_unit_to_Write_unit = new Execution_unit_to_Write_unit (name.c_str(), |
---|
| 109 | #ifdef STATISTICS |
---|
| 110 | _parameters_statistics, |
---|
| 111 | #endif |
---|
| 112 | _param); |
---|
| 113 | |
---|
| 114 | #ifdef SYSTEMC |
---|
| 115 | /********************************************************************* |
---|
| 116 | * Déclarations des signaux |
---|
| 117 | *********************************************************************/ |
---|
| 118 | string rename; |
---|
| 119 | |
---|
| 120 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
| 121 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
| 122 | |
---|
| 123 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_VAL ," in_EXECUTE_UNIT_OUT_VAL ",Tcontrol_t ,_param->_nb_execute_unit); |
---|
| 124 | ALLOC1_SC_SIGNAL(out_EXECUTE_UNIT_OUT_ACK ,"out_EXECUTE_UNIT_OUT_ACK ",Tcontrol_t ,_param->_nb_execute_unit); |
---|
| 125 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_CONTEXT_ID ," in_EXECUTE_UNIT_OUT_CONTEXT_ID ",Tcontext_t ,_param->_nb_execute_unit); |
---|
| 126 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_FRONT_END_ID ," in_EXECUTE_UNIT_OUT_FRONT_END_ID ",Tcontext_t ,_param->_nb_execute_unit); |
---|
| 127 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID," in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID",Tcontext_t ,_param->_nb_execute_unit); |
---|
| 128 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_PACKET_ID ," in_EXECUTE_UNIT_OUT_PACKET_ID ",Tpacket_t ,_param->_nb_execute_unit); |
---|
| 129 | //ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_OPERATION ," in_EXECUTE_UNIT_OUT_OPERATION ",Toperation_t ,_param->_nb_execute_unit); |
---|
[78] | 130 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_TYPE ," in_EXECUTE_UNIT_OUT_TYPE ",Ttype_t ,_param->_nb_execute_unit); |
---|
[77] | 131 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_WRITE_RD ," in_EXECUTE_UNIT_OUT_WRITE_RD ",Tcontrol_t ,_param->_nb_execute_unit); |
---|
| 132 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_NUM_REG_RD ," in_EXECUTE_UNIT_OUT_NUM_REG_RD ",Tgeneral_address_t,_param->_nb_execute_unit); |
---|
| 133 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_DATA_RD ," in_EXECUTE_UNIT_OUT_DATA_RD ",Tgeneral_data_t ,_param->_nb_execute_unit); |
---|
| 134 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_WRITE_RE ," in_EXECUTE_UNIT_OUT_WRITE_RE ",Tcontrol_t ,_param->_nb_execute_unit); |
---|
| 135 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_NUM_REG_RE ," in_EXECUTE_UNIT_OUT_NUM_REG_RE ",Tspecial_address_t,_param->_nb_execute_unit); |
---|
| 136 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_DATA_RE ," in_EXECUTE_UNIT_OUT_DATA_RE ",Tspecial_data_t ,_param->_nb_execute_unit); |
---|
| 137 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_EXCEPTION ," in_EXECUTE_UNIT_OUT_EXCEPTION ",Texception_t ,_param->_nb_execute_unit); |
---|
| 138 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_NO_SEQUENCE ," in_EXECUTE_UNIT_OUT_NO_SEQUENCE ",Tcontrol_t ,_param->_nb_execute_unit); |
---|
| 139 | ALLOC1_SC_SIGNAL( in_EXECUTE_UNIT_OUT_ADDRESS ," in_EXECUTE_UNIT_OUT_ADDRESS ",Tgeneral_data_t ,_param->_nb_execute_unit); |
---|
| 140 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_VAL ,"out_WRITE_UNIT_IN_VAL ",Tcontrol_t ,_param->_nb_write_unit ); |
---|
| 141 | ALLOC1_SC_SIGNAL( in_WRITE_UNIT_IN_ACK ," in_WRITE_UNIT_IN_ACK ",Tcontrol_t ,_param->_nb_write_unit ); |
---|
| 142 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_CONTEXT_ID ,"out_WRITE_UNIT_IN_CONTEXT_ID ",Tcontext_t ,_param->_nb_write_unit ); |
---|
| 143 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_FRONT_END_ID ,"out_WRITE_UNIT_IN_FRONT_END_ID ",Tcontext_t ,_param->_nb_write_unit ); |
---|
| 144 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_OOO_ENGINE_ID ,"out_WRITE_UNIT_IN_OOO_ENGINE_ID ",Tcontext_t ,_param->_nb_write_unit ); |
---|
| 145 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_PACKET_ID ,"out_WRITE_UNIT_IN_PACKET_ID ",Tpacket_t ,_param->_nb_write_unit ); |
---|
| 146 | //ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_OPERATION ,"out_WRITE_UNIT_IN_OPERATION ",Toperation_t ,_param->_nb_write_unit ); |
---|
[78] | 147 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_TYPE ,"out_WRITE_UNIT_IN_TYPE ",Ttype_t ,_param->_nb_write_unit ); |
---|
[77] | 148 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_WRITE_RD ,"out_WRITE_UNIT_IN_WRITE_RD ",Tcontrol_t ,_param->_nb_write_unit ); |
---|
| 149 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_NUM_REG_RD ,"out_WRITE_UNIT_IN_NUM_REG_RD ",Tgeneral_address_t,_param->_nb_write_unit ); |
---|
| 150 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_DATA_RD ,"out_WRITE_UNIT_IN_DATA_RD ",Tgeneral_data_t ,_param->_nb_write_unit ); |
---|
| 151 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_WRITE_RE ,"out_WRITE_UNIT_IN_WRITE_RE ",Tcontrol_t ,_param->_nb_write_unit ); |
---|
| 152 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_NUM_REG_RE ,"out_WRITE_UNIT_IN_NUM_REG_RE ",Tspecial_address_t,_param->_nb_write_unit ); |
---|
| 153 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_DATA_RE ,"out_WRITE_UNIT_IN_DATA_RE ",Tspecial_data_t ,_param->_nb_write_unit ); |
---|
| 154 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_EXCEPTION ,"out_WRITE_UNIT_IN_EXCEPTION ",Texception_t ,_param->_nb_write_unit ); |
---|
| 155 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_NO_SEQUENCE ,"out_WRITE_UNIT_IN_NO_SEQUENCE ",Tcontrol_t ,_param->_nb_write_unit ); |
---|
| 156 | ALLOC1_SC_SIGNAL(out_WRITE_UNIT_IN_ADDRESS ,"out_WRITE_UNIT_IN_ADDRESS ",Tgeneral_data_t ,_param->_nb_write_unit ); |
---|
| 157 | |
---|
| 158 | /******************************************************** |
---|
| 159 | * Instanciation |
---|
| 160 | ********************************************************/ |
---|
| 161 | |
---|
| 162 | msg(_("<%s> : Instanciation of _Execution_unit_to_Write_unit.\n"),name.c_str()); |
---|
| 163 | |
---|
| 164 | (*(_Execution_unit_to_Write_unit->in_CLOCK)) (*(in_CLOCK)); |
---|
| 165 | (*(_Execution_unit_to_Write_unit->in_NRESET)) (*(in_NRESET)); |
---|
| 166 | |
---|
| 167 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_VAL ,_param->_nb_execute_unit); |
---|
| 168 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_EXECUTE_UNIT_OUT_ACK ,_param->_nb_execute_unit); |
---|
| 169 | if (_param->_have_port_context_id) |
---|
| 170 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_CONTEXT_ID ,_param->_nb_execute_unit); |
---|
| 171 | if (_param->_have_port_front_end_id) |
---|
| 172 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_FRONT_END_ID ,_param->_nb_execute_unit); |
---|
| 173 | if (_param->_have_port_ooo_engine_id) |
---|
| 174 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID,_param->_nb_execute_unit); |
---|
| 175 | if (_param->_have_port_packet_id) |
---|
| 176 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_PACKET_ID ,_param->_nb_execute_unit); |
---|
| 177 | //INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_OPERATION ,_param->_nb_execute_unit); |
---|
[78] | 178 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_TYPE ,_param->_nb_execute_unit); |
---|
[77] | 179 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_WRITE_RD ,_param->_nb_execute_unit); |
---|
| 180 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_NUM_REG_RD ,_param->_nb_execute_unit); |
---|
| 181 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_DATA_RD ,_param->_nb_execute_unit); |
---|
| 182 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_WRITE_RE ,_param->_nb_execute_unit); |
---|
| 183 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_NUM_REG_RE ,_param->_nb_execute_unit); |
---|
| 184 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_DATA_RE ,_param->_nb_execute_unit); |
---|
| 185 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_EXCEPTION ,_param->_nb_execute_unit); |
---|
| 186 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_NO_SEQUENCE ,_param->_nb_execute_unit); |
---|
| 187 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_EXECUTE_UNIT_OUT_ADDRESS ,_param->_nb_execute_unit); |
---|
| 188 | |
---|
| 189 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_VAL ,_param->_nb_write_unit ); |
---|
| 190 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit, in_WRITE_UNIT_IN_ACK ,_param->_nb_write_unit ); |
---|
| 191 | if (_param->_have_port_context_id) |
---|
| 192 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_CONTEXT_ID ,_param->_nb_write_unit ); |
---|
| 193 | if (_param->_have_port_front_end_id) |
---|
| 194 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_FRONT_END_ID ,_param->_nb_write_unit ); |
---|
| 195 | if (_param->_have_port_ooo_engine_id) |
---|
| 196 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_OOO_ENGINE_ID ,_param->_nb_write_unit ); |
---|
| 197 | if (_param->_have_port_packet_id) |
---|
| 198 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_PACKET_ID ,_param->_nb_write_unit ); |
---|
| 199 | //INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_OPERATION ,_param->_nb_write_unit ); |
---|
[78] | 200 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_TYPE ,_param->_nb_write_unit ); |
---|
[77] | 201 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_WRITE_RD ,_param->_nb_write_unit ); |
---|
| 202 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_NUM_REG_RD ,_param->_nb_write_unit ); |
---|
| 203 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_DATA_RD ,_param->_nb_write_unit ); |
---|
| 204 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_WRITE_RE ,_param->_nb_write_unit ); |
---|
| 205 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_NUM_REG_RE ,_param->_nb_write_unit ); |
---|
| 206 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_DATA_RE ,_param->_nb_write_unit ); |
---|
| 207 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_EXCEPTION ,_param->_nb_write_unit ); |
---|
| 208 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_NO_SEQUENCE ,_param->_nb_write_unit ); |
---|
| 209 | INSTANCE1_SC_SIGNAL(_Execution_unit_to_Write_unit,out_WRITE_UNIT_IN_ADDRESS ,_param->_nb_write_unit ); |
---|
| 210 | |
---|
| 211 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
| 212 | |
---|
| 213 | Time * _time = new Time(); |
---|
| 214 | |
---|
| 215 | /******************************************************** |
---|
| 216 | * Simulation - Begin |
---|
| 217 | ********************************************************/ |
---|
| 218 | |
---|
| 219 | // Initialisation |
---|
| 220 | |
---|
| 221 | const uint32_t seed = 0; |
---|
| 222 | // const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 223 | |
---|
| 224 | srand(seed); |
---|
| 225 | |
---|
| 226 | const int32_t percent_transaction_in = 75; |
---|
| 227 | const int32_t percent_transaction_out = 75; |
---|
| 228 | |
---|
| 229 | set<Tcontext_t> execute_unit_thread [_param->_nb_execute_unit]; |
---|
| 230 | |
---|
| 231 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
| 232 | for (uint32_t j=0; j<_param->_nb_write_unit; j++) |
---|
| 233 | if (_param->_table_routing[i][j]) |
---|
| 234 | for (uint32_t k=0; k<_param->_nb_thread; k++) |
---|
| 235 | if (_param->_table_thread[j][k]) |
---|
| 236 | { |
---|
| 237 | execute_unit_thread [i].insert(k); |
---|
| 238 | } |
---|
| 239 | SC_START(0); |
---|
| 240 | LABEL("Initialisation"); |
---|
| 241 | |
---|
| 242 | LABEL("Reset"); |
---|
| 243 | in_NRESET->write(0); |
---|
| 244 | SC_START(5); |
---|
| 245 | in_NRESET->write(1); |
---|
| 246 | |
---|
| 247 | LABEL("Loop of Test"); |
---|
| 248 | |
---|
| 249 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
| 250 | { |
---|
| 251 | LABEL("Iteration %d",iteration); |
---|
| 252 | |
---|
| 253 | list<entry_t> request [_param->_nb_execute_unit]; |
---|
| 254 | |
---|
| 255 | uint32_t nb_request_in; |
---|
| 256 | for (nb_request_in=0; nb_request_in < _param->_nb_packet; ) |
---|
| 257 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
| 258 | { |
---|
| 259 | if (nb_request_in >= _param->_nb_packet) |
---|
| 260 | break; |
---|
| 261 | |
---|
| 262 | Tcontext_t context_id ; |
---|
| 263 | Tcontext_t front_end_id ; |
---|
| 264 | Tcontext_t ooo_engine_id; |
---|
| 265 | Tcontext_t num_thread ; |
---|
| 266 | |
---|
| 267 | // Find compatible thread |
---|
| 268 | do |
---|
| 269 | { |
---|
| 270 | context_id = range<Tcontext_t> (rand(), _param->_size_context_id ); |
---|
| 271 | front_end_id = range<Tcontext_t> (rand(), _param->_size_front_end_id ); |
---|
| 272 | ooo_engine_id = range<Tcontext_t> (rand(), _param->_size_ooo_engine_id); |
---|
| 273 | num_thread = get_num_thread (context_id , _param->_size_context_id , |
---|
| 274 | front_end_id , _param->_size_front_end_id , |
---|
| 275 | ooo_engine_id, _param->_size_ooo_engine_id); |
---|
| 276 | } |
---|
| 277 | while (execute_unit_thread[i].find(num_thread) == execute_unit_thread[i].end()); |
---|
| 278 | |
---|
| 279 | request[i].push_back(entry_t (context_id , |
---|
| 280 | front_end_id , |
---|
| 281 | ooo_engine_id, |
---|
| 282 | nb_request_in, |
---|
| 283 | //range<Toperation_t > (rand(), _param->_size_operation ), |
---|
[78] | 284 | range<Ttype_t > (rand(), _param->_size_type ), |
---|
[77] | 285 | range<Tcontrol_t > (rand(), 2 ), |
---|
| 286 | range<Tgeneral_address_t> (rand(), _param->_size_general_register), |
---|
| 287 | range<Tgeneral_data_t > (rand(), _param->_size_general_data ), |
---|
| 288 | range<Tcontrol_t > (rand(), 2 ), |
---|
| 289 | range<Tspecial_address_t> (rand(), _param->_size_special_register), |
---|
| 290 | range<Tspecial_data_t > (rand(), _param->_size_special_data ), |
---|
| 291 | range<Texception_t > (rand(), _param->_size_exception ), |
---|
| 292 | range<Tcontrol_t > (rand(), 2 ), |
---|
| 293 | range<Tgeneral_data_t > (rand(), _param->_size_general_data ) |
---|
| 294 | )); |
---|
| 295 | |
---|
| 296 | nb_request_in++; |
---|
| 297 | } |
---|
| 298 | |
---|
| 299 | uint32_t nb_request_out = 0; |
---|
| 300 | |
---|
| 301 | while (nb_request_out < nb_request_in) |
---|
| 302 | { |
---|
| 303 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
| 304 | { |
---|
| 305 | bool val = not request[i].empty() and ((rand()%100) < percent_transaction_in); |
---|
| 306 | |
---|
| 307 | in_EXECUTE_UNIT_OUT_VAL [i]->write(val); |
---|
| 308 | |
---|
| 309 | if (val) |
---|
| 310 | { |
---|
| 311 | in_EXECUTE_UNIT_OUT_CONTEXT_ID [i] ->write(request[i].front()._context_id ); |
---|
| 312 | in_EXECUTE_UNIT_OUT_FRONT_END_ID [i] ->write(request[i].front()._front_end_id ); |
---|
| 313 | in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID [i] ->write(request[i].front()._ooo_engine_id ); |
---|
| 314 | in_EXECUTE_UNIT_OUT_PACKET_ID [i] ->write(request[i].front()._packet_id ); |
---|
| 315 | // in_EXECUTE_UNIT_OUT_OPERATION [i] ->write(request[i].front()._operation ); |
---|
[78] | 316 | in_EXECUTE_UNIT_OUT_TYPE [i] ->write(request[i].front()._type ); |
---|
[77] | 317 | in_EXECUTE_UNIT_OUT_WRITE_RD [i] ->write(request[i].front()._write_rd ); |
---|
| 318 | in_EXECUTE_UNIT_OUT_NUM_REG_RD [i] ->write(request[i].front()._num_reg_rd ); |
---|
| 319 | in_EXECUTE_UNIT_OUT_DATA_RD [i] ->write(request[i].front()._data_rd ); |
---|
| 320 | in_EXECUTE_UNIT_OUT_WRITE_RE [i] ->write(request[i].front()._write_re ); |
---|
| 321 | in_EXECUTE_UNIT_OUT_NUM_REG_RE [i] ->write(request[i].front()._num_reg_re ); |
---|
| 322 | in_EXECUTE_UNIT_OUT_DATA_RE [i] ->write(request[i].front()._data_re ); |
---|
| 323 | in_EXECUTE_UNIT_OUT_EXCEPTION [i] ->write(request[i].front()._exception ); |
---|
| 324 | in_EXECUTE_UNIT_OUT_NO_SEQUENCE [i] ->write(request[i].front()._no_sequence ); |
---|
| 325 | in_EXECUTE_UNIT_OUT_ADDRESS [i] ->write(request[i].front()._address ); |
---|
| 326 | } |
---|
| 327 | } |
---|
| 328 | |
---|
| 329 | for (uint32_t i=0; i<_param->_nb_write_unit; i++) |
---|
| 330 | in_WRITE_UNIT_IN_ACK [i]->write((rand()%100) < percent_transaction_out); |
---|
| 331 | |
---|
| 332 | SC_START(0); |
---|
| 333 | |
---|
| 334 | for (uint32_t i=0; i<_param->_nb_execute_unit; i++) |
---|
| 335 | if (in_EXECUTE_UNIT_OUT_VAL [i]->read() and out_EXECUTE_UNIT_OUT_ACK [i]->read()) |
---|
| 336 | { |
---|
| 337 | LABEL("EXECUTE_UNIT_OUT [%d] - Transaction accepted",i); |
---|
| 338 | } |
---|
| 339 | |
---|
| 340 | for (uint32_t i=0; i<_param->_nb_write_unit; i++) |
---|
| 341 | if (out_WRITE_UNIT_IN_VAL [i]->read() and in_WRITE_UNIT_IN_ACK [i]->read()) |
---|
| 342 | { |
---|
| 343 | LABEL("WRITE_UNIT_IN [%d] - Transaction accepted (%d)",i,nb_request_out); |
---|
| 344 | nb_request_out ++; |
---|
| 345 | |
---|
| 346 | Tpacket_t packet = (_param->_have_port_packet_id)?out_WRITE_UNIT_IN_PACKET_ID[i]->read():0; |
---|
| 347 | LABEL(" * packet : %d",packet); |
---|
| 348 | uint32_t execute_unit; |
---|
| 349 | |
---|
| 350 | // find execute_unit |
---|
| 351 | for (execute_unit=0; execute_unit<_param->_nb_execute_unit; execute_unit++) |
---|
| 352 | if (packet == ((_param->_have_port_packet_id)?request[execute_unit].front()._packet_id:0)) |
---|
| 353 | break; |
---|
| 354 | |
---|
| 355 | LABEL(" * execute_unit source : %d",execute_unit); |
---|
| 356 | |
---|
| 357 | if (_param->_have_port_packet_id) |
---|
| 358 | TEST(Tcontext_t ,out_WRITE_UNIT_IN_PACKET_ID [i]->read(), request[execute_unit].front()._packet_id ); |
---|
| 359 | |
---|
| 360 | // Authorised link ? execute_unit -> write_unit |
---|
| 361 | TEST(bool, _param->_table_routing[execute_unit][i], true); |
---|
| 362 | |
---|
| 363 | if (_param->_have_port_context_id) |
---|
| 364 | TEST(Tcontext_t ,out_WRITE_UNIT_IN_CONTEXT_ID [i]->read(), request[execute_unit].front()._context_id ); |
---|
| 365 | if (_param->_have_port_front_end_id) |
---|
| 366 | TEST(Tcontext_t ,out_WRITE_UNIT_IN_FRONT_END_ID [i]->read(), request[execute_unit].front()._front_end_id ); |
---|
| 367 | if (_param->_have_port_ooo_engine_id) |
---|
| 368 | TEST(Tcontext_t ,out_WRITE_UNIT_IN_OOO_ENGINE_ID [i]->read(), request[execute_unit].front()._ooo_engine_id ); |
---|
| 369 | // TEST(Toperation_t ,out_WRITE_UNIT_IN_OPERATION [i]->read(), request[execute_unit].front()._operation ); |
---|
[78] | 370 | TEST(Ttype_t ,out_WRITE_UNIT_IN_TYPE [i]->read(), request[execute_unit].front()._type ); |
---|
[77] | 371 | TEST(Tcontrol_t ,out_WRITE_UNIT_IN_WRITE_RD [i]->read(), request[execute_unit].front()._write_rd ); |
---|
| 372 | TEST(Tgeneral_address_t,out_WRITE_UNIT_IN_NUM_REG_RD [i]->read(), request[execute_unit].front()._num_reg_rd ); |
---|
| 373 | TEST(Tgeneral_data_t ,out_WRITE_UNIT_IN_DATA_RD [i]->read(), request[execute_unit].front()._data_rd ); |
---|
| 374 | TEST(Tcontrol_t ,out_WRITE_UNIT_IN_WRITE_RE [i]->read(), request[execute_unit].front()._write_re ); |
---|
| 375 | TEST(Tspecial_address_t,out_WRITE_UNIT_IN_NUM_REG_RE [i]->read(), request[execute_unit].front()._num_reg_re ); |
---|
| 376 | TEST(Tspecial_data_t ,out_WRITE_UNIT_IN_DATA_RE [i]->read(), request[execute_unit].front()._data_re ); |
---|
| 377 | TEST(Texception_t ,out_WRITE_UNIT_IN_EXCEPTION [i]->read(), request[execute_unit].front()._exception ); |
---|
| 378 | TEST(Tcontrol_t ,out_WRITE_UNIT_IN_NO_SEQUENCE [i]->read(), request[execute_unit].front()._no_sequence ); |
---|
| 379 | TEST(Tgeneral_data_t ,out_WRITE_UNIT_IN_ADDRESS [i]->read(), request[execute_unit].front()._address ); |
---|
| 380 | |
---|
| 381 | request[execute_unit].pop_front(); |
---|
| 382 | } |
---|
| 383 | SC_START(1); |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | } |
---|
| 387 | |
---|
| 388 | /******************************************************** |
---|
| 389 | * Simulation - End |
---|
| 390 | ********************************************************/ |
---|
| 391 | |
---|
| 392 | TEST_OK ("End of Simulation"); |
---|
| 393 | delete _time; |
---|
| 394 | |
---|
| 395 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
| 396 | |
---|
| 397 | delete in_CLOCK; |
---|
| 398 | delete in_NRESET; |
---|
| 399 | |
---|
| 400 | delete [] in_EXECUTE_UNIT_OUT_VAL ; |
---|
| 401 | delete [] out_EXECUTE_UNIT_OUT_ACK ; |
---|
| 402 | delete [] in_EXECUTE_UNIT_OUT_CONTEXT_ID ; |
---|
| 403 | delete [] in_EXECUTE_UNIT_OUT_FRONT_END_ID ; |
---|
| 404 | delete [] in_EXECUTE_UNIT_OUT_OOO_ENGINE_ID; |
---|
| 405 | delete [] in_EXECUTE_UNIT_OUT_PACKET_ID ; |
---|
| 406 | //delete [] in_EXECUTE_UNIT_OUT_OPERATION ; |
---|
[78] | 407 | delete [] in_EXECUTE_UNIT_OUT_TYPE ; |
---|
[77] | 408 | delete [] in_EXECUTE_UNIT_OUT_WRITE_RD ; |
---|
| 409 | delete [] in_EXECUTE_UNIT_OUT_NUM_REG_RD ; |
---|
| 410 | delete [] in_EXECUTE_UNIT_OUT_DATA_RD ; |
---|
| 411 | delete [] in_EXECUTE_UNIT_OUT_WRITE_RE ; |
---|
| 412 | delete [] in_EXECUTE_UNIT_OUT_NUM_REG_RE ; |
---|
| 413 | delete [] in_EXECUTE_UNIT_OUT_DATA_RE ; |
---|
| 414 | delete [] in_EXECUTE_UNIT_OUT_EXCEPTION ; |
---|
| 415 | delete [] in_EXECUTE_UNIT_OUT_NO_SEQUENCE ; |
---|
| 416 | delete [] in_EXECUTE_UNIT_OUT_ADDRESS ; |
---|
| 417 | |
---|
| 418 | delete [] out_WRITE_UNIT_IN_VAL ; |
---|
| 419 | delete [] in_WRITE_UNIT_IN_ACK ; |
---|
| 420 | delete [] out_WRITE_UNIT_IN_CONTEXT_ID ; |
---|
| 421 | delete [] out_WRITE_UNIT_IN_FRONT_END_ID ; |
---|
| 422 | delete [] out_WRITE_UNIT_IN_OOO_ENGINE_ID ; |
---|
| 423 | delete [] out_WRITE_UNIT_IN_PACKET_ID ; |
---|
| 424 | //delete [] out_WRITE_UNIT_IN_OPERATION ; |
---|
[78] | 425 | delete [] out_WRITE_UNIT_IN_TYPE ; |
---|
[77] | 426 | delete [] out_WRITE_UNIT_IN_WRITE_RD ; |
---|
| 427 | delete [] out_WRITE_UNIT_IN_NUM_REG_RD ; |
---|
| 428 | delete [] out_WRITE_UNIT_IN_DATA_RD ; |
---|
| 429 | delete [] out_WRITE_UNIT_IN_WRITE_RE ; |
---|
| 430 | delete [] out_WRITE_UNIT_IN_NUM_REG_RE ; |
---|
| 431 | delete [] out_WRITE_UNIT_IN_DATA_RE ; |
---|
| 432 | delete [] out_WRITE_UNIT_IN_EXCEPTION ; |
---|
| 433 | delete [] out_WRITE_UNIT_IN_NO_SEQUENCE ; |
---|
| 434 | delete [] out_WRITE_UNIT_IN_ADDRESS ; |
---|
| 435 | #endif |
---|
| 436 | |
---|
| 437 | delete _Execution_unit_to_Write_unit; |
---|
| 438 | #ifdef STATISTICS |
---|
| 439 | delete _parameters_statistics; |
---|
| 440 | #endif |
---|
| 441 | } |
---|