[78] | 1 | /* |
---|
| 2 | * $Id: test.cpp 117 2009-05-16 14:42:39Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | * Test |
---|
| 7 | */ |
---|
| 8 | |
---|
[82] | 9 | #define NB_ITERATION 256 |
---|
| 10 | #define CYCLE_MAX (128*NB_ITERATION) |
---|
| 11 | |
---|
[78] | 12 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/SelfTest/include/test.h" |
---|
| 13 | #include "Common/include/Test.h" |
---|
| 14 | #include "Common/include/Max.h" |
---|
| 15 | #include "Behavioural/include/Allocation.h" |
---|
| 16 | #include <list> |
---|
| 17 | |
---|
| 18 | class request_t |
---|
| 19 | { |
---|
| 20 | public : Tcontext_t _front_end_id ; |
---|
| 21 | public : Tcontext_t _context_id ; |
---|
| 22 | public : Ttype_t _type ; |
---|
| 23 | public : Toperation_t _operation ; |
---|
| 24 | public : Tlsq_ptr_t _store_queue_ptr_write; |
---|
| 25 | public : Tlsq_ptr_t _load_queue_ptr_write ; |
---|
| 26 | |
---|
| 27 | public : request_t (Tcontext_t front_end_id , |
---|
| 28 | Tcontext_t context_id , |
---|
| 29 | Ttype_t type , |
---|
| 30 | Toperation_t operation , |
---|
| 31 | Tlsq_ptr_t store_queue_ptr_write, |
---|
| 32 | Tlsq_ptr_t load_queue_ptr_write ) |
---|
| 33 | { |
---|
| 34 | _front_end_id = front_end_id ; |
---|
| 35 | _context_id = context_id ; |
---|
| 36 | _type = type ; |
---|
| 37 | _operation = operation ; |
---|
| 38 | _store_queue_ptr_write = store_queue_ptr_write; |
---|
| 39 | _load_queue_ptr_write = load_queue_ptr_write ; |
---|
| 40 | } |
---|
| 41 | }; |
---|
| 42 | |
---|
| 43 | void test (string name, |
---|
| 44 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters * _param) |
---|
| 45 | { |
---|
| 46 | msg(_("<%s> : Simulation SystemC.\n"),name.c_str()); |
---|
| 47 | |
---|
| 48 | #ifdef STATISTICS |
---|
| 49 | morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50); |
---|
| 50 | #endif |
---|
| 51 | |
---|
[88] | 52 | Tusage_t _usage = USE_ALL; |
---|
| 53 | |
---|
| 54 | // _usage = usage_unset(_usage,USE_SYSTEMC ); |
---|
| 55 | // _usage = usage_unset(_usage,USE_VHDL ); |
---|
| 56 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH ); |
---|
| 57 | // _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT); |
---|
| 58 | // _usage = usage_unset(_usage,USE_POSITION ); |
---|
| 59 | _usage = usage_unset(_usage,USE_STATISTICS ); |
---|
| 60 | // _usage = usage_unset(_usage,USE_INFORMATION ); |
---|
| 61 | |
---|
[82] | 62 | Load_Store_pointer_unit * _Load_Store_pointer_unit = new Load_Store_pointer_unit |
---|
| 63 | (name.c_str(), |
---|
[78] | 64 | #ifdef STATISTICS |
---|
[82] | 65 | _parameters_statistics, |
---|
[78] | 66 | #endif |
---|
[82] | 67 | _param, |
---|
[88] | 68 | _usage); |
---|
[78] | 69 | |
---|
| 70 | #ifdef SYSTEMC |
---|
| 71 | /********************************************************************* |
---|
| 72 | * Déclarations des signaux |
---|
| 73 | *********************************************************************/ |
---|
| 74 | string rename; |
---|
| 75 | |
---|
| 76 | sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); |
---|
| 77 | sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); |
---|
| 78 | |
---|
[117] | 79 | sc_signal<Tcontrol_t > ** in_INSERT_VAL ; |
---|
| 80 | sc_signal<Tcontrol_t > ** out_INSERT_ACK ; |
---|
| 81 | sc_signal<Tcontext_t > ** in_INSERT_FRONT_END_ID ; |
---|
| 82 | sc_signal<Tcontext_t > ** in_INSERT_CONTEXT_ID ; |
---|
| 83 | sc_signal<Ttype_t > ** in_INSERT_TYPE ; |
---|
| 84 | sc_signal<Toperation_t> ** in_INSERT_OPERATION ; |
---|
| 85 | sc_signal<Tlsq_ptr_t > ** out_INSERT_STORE_QUEUE_PTR_WRITE; |
---|
| 86 | sc_signal<Tlsq_ptr_t > ** out_INSERT_LOAD_QUEUE_PTR_WRITE ; |
---|
| 87 | sc_signal<Tcontrol_t > ** in_RETIRE_VAL ; |
---|
| 88 | sc_signal<Tcontrol_t > ** out_RETIRE_ACK ; |
---|
| 89 | sc_signal<Tcontext_t > ** in_RETIRE_FRONT_END_ID ; |
---|
| 90 | sc_signal<Tcontext_t > ** in_RETIRE_CONTEXT_ID ; |
---|
| 91 | //sc_signal<Ttype_t > ** in_RETIRE_TYPE ; |
---|
| 92 | //sc_signal<Toperation_t> ** in_RETIRE_OPERATION ; |
---|
| 93 | sc_signal<Tcontrol_t > ** in_RETIRE_USE_STORE_QUEUE ; |
---|
| 94 | sc_signal<Tcontrol_t > ** in_RETIRE_USE_LOAD_QUEUE ; |
---|
| 95 | sc_signal<Tlsq_ptr_t > ** in_RETIRE_STORE_QUEUE_PTR_WRITE; |
---|
| 96 | sc_signal<Tlsq_ptr_t > ** in_RETIRE_LOAD_QUEUE_PTR_WRITE ; |
---|
| 97 | |
---|
[78] | 98 | ALLOC1_SC_SIGNAL( in_INSERT_VAL ," in_INSERT_VAL ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 99 | ALLOC1_SC_SIGNAL(out_INSERT_ACK ,"out_INSERT_ACK ",Tcontrol_t ,_param->_nb_inst_insert); |
---|
| 100 | ALLOC1_SC_SIGNAL( in_INSERT_FRONT_END_ID ," in_INSERT_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 101 | ALLOC1_SC_SIGNAL( in_INSERT_CONTEXT_ID ," in_INSERT_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_insert); |
---|
| 102 | ALLOC1_SC_SIGNAL( in_INSERT_TYPE ," in_INSERT_TYPE ",Ttype_t ,_param->_nb_inst_insert); |
---|
| 103 | ALLOC1_SC_SIGNAL( in_INSERT_OPERATION ," in_INSERT_OPERATION ",Toperation_t,_param->_nb_inst_insert); |
---|
| 104 | ALLOC1_SC_SIGNAL(out_INSERT_STORE_QUEUE_PTR_WRITE,"out_INSERT_STORE_QUEUE_PTR_WRITE",Tlsq_ptr_t ,_param->_nb_inst_insert); |
---|
| 105 | ALLOC1_SC_SIGNAL(out_INSERT_LOAD_QUEUE_PTR_WRITE ,"out_INSERT_LOAD_QUEUE_PTR_WRITE ",Tlsq_ptr_t ,_param->_nb_inst_insert); |
---|
| 106 | ALLOC1_SC_SIGNAL( in_RETIRE_VAL ," in_RETIRE_VAL ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 107 | ALLOC1_SC_SIGNAL(out_RETIRE_ACK ,"out_RETIRE_ACK ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 108 | ALLOC1_SC_SIGNAL( in_RETIRE_FRONT_END_ID ," in_RETIRE_FRONT_END_ID ",Tcontext_t ,_param->_nb_inst_retire); |
---|
| 109 | ALLOC1_SC_SIGNAL( in_RETIRE_CONTEXT_ID ," in_RETIRE_CONTEXT_ID ",Tcontext_t ,_param->_nb_inst_retire); |
---|
[117] | 110 | //ALLOC1_SC_SIGNAL( in_RETIRE_TYPE ," in_RETIRE_TYPE ",Ttype_t ,_param->_nb_inst_retire); |
---|
| 111 | //ALLOC1_SC_SIGNAL( in_RETIRE_OPERATION ," in_RETIRE_OPERATION ",Toperation_t,_param->_nb_inst_retire); |
---|
[88] | 112 | ALLOC1_SC_SIGNAL( in_RETIRE_USE_STORE_QUEUE ," in_RETIRE_USE_STORE_QUEUE ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
| 113 | ALLOC1_SC_SIGNAL( in_RETIRE_USE_LOAD_QUEUE ," in_RETIRE_USE_LOAD_QUEUE ",Tcontrol_t ,_param->_nb_inst_retire); |
---|
[78] | 114 | ALLOC1_SC_SIGNAL( in_RETIRE_STORE_QUEUE_PTR_WRITE," in_RETIRE_STORE_QUEUE_PTR_WRITE",Tlsq_ptr_t ,_param->_nb_inst_retire); |
---|
| 115 | ALLOC1_SC_SIGNAL( in_RETIRE_LOAD_QUEUE_PTR_WRITE ," in_RETIRE_LOAD_QUEUE_PTR_WRITE ",Tlsq_ptr_t ,_param->_nb_inst_retire); |
---|
| 116 | |
---|
| 117 | /******************************************************** |
---|
| 118 | * Instanciation |
---|
| 119 | ********************************************************/ |
---|
| 120 | |
---|
| 121 | msg(_("<%s> : Instanciation of _Load_Store_pointer_unit.\n"),name.c_str()); |
---|
| 122 | |
---|
| 123 | (*(_Load_Store_pointer_unit->in_CLOCK)) (*(in_CLOCK)); |
---|
| 124 | (*(_Load_Store_pointer_unit->in_NRESET)) (*(in_NRESET)); |
---|
| 125 | |
---|
| 126 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_INSERT_VAL ,_param->_nb_inst_insert); |
---|
| 127 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit,out_INSERT_ACK ,_param->_nb_inst_insert); |
---|
| 128 | if (_param->_have_port_front_end_id) |
---|
| 129 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_INSERT_FRONT_END_ID ,_param->_nb_inst_insert); |
---|
| 130 | if (_param->_have_port_context_id) |
---|
| 131 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_INSERT_CONTEXT_ID ,_param->_nb_inst_insert); |
---|
| 132 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_INSERT_TYPE ,_param->_nb_inst_insert); |
---|
| 133 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_INSERT_OPERATION ,_param->_nb_inst_insert); |
---|
| 134 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit,out_INSERT_STORE_QUEUE_PTR_WRITE,_param->_nb_inst_insert); |
---|
| 135 | if (_param->_have_port_load_queue_ptr) |
---|
| 136 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit,out_INSERT_LOAD_QUEUE_PTR_WRITE ,_param->_nb_inst_insert); |
---|
| 137 | |
---|
| 138 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_VAL ,_param->_nb_inst_retire); |
---|
| 139 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit,out_RETIRE_ACK ,_param->_nb_inst_retire); |
---|
| 140 | if (_param->_have_port_front_end_id) |
---|
| 141 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_FRONT_END_ID ,_param->_nb_inst_retire); |
---|
| 142 | if (_param->_have_port_context_id) |
---|
| 143 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_CONTEXT_ID ,_param->_nb_inst_retire); |
---|
[88] | 144 | // INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_TYPE ,_param->_nb_inst_retire); |
---|
| 145 | // INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_OPERATION ,_param->_nb_inst_retire); |
---|
| 146 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_USE_STORE_QUEUE ,_param->_nb_inst_retire); |
---|
| 147 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_USE_LOAD_QUEUE ,_param->_nb_inst_retire); |
---|
[78] | 148 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_STORE_QUEUE_PTR_WRITE,_param->_nb_inst_retire); |
---|
| 149 | if (_param->_have_port_load_queue_ptr) |
---|
| 150 | INSTANCE1_SC_SIGNAL(_Load_Store_pointer_unit, in_RETIRE_LOAD_QUEUE_PTR_WRITE ,_param->_nb_inst_retire); |
---|
| 151 | |
---|
| 152 | msg(_("<%s> : Start Simulation ............\n"),name.c_str()); |
---|
| 153 | |
---|
| 154 | Time * _time = new Time(); |
---|
| 155 | |
---|
| 156 | /******************************************************** |
---|
| 157 | * Simulation - Begin |
---|
| 158 | ********************************************************/ |
---|
| 159 | |
---|
| 160 | // Initialisation |
---|
| 161 | |
---|
| 162 | const uint32_t seed = 0; |
---|
| 163 | //const uint32_t seed = static_cast<uint32_t>(time(NULL)); |
---|
| 164 | |
---|
| 165 | srand(seed); |
---|
| 166 | |
---|
| 167 | const int32_t percent_transaction_insert = 75; |
---|
| 168 | const int32_t percent_transaction_retire = 75; |
---|
| 169 | |
---|
| 170 | Ttype_t type [2]; |
---|
| 171 | type [0] = TYPE_MEMORY; |
---|
| 172 | type [1] = TYPE_ALU; |
---|
| 173 | |
---|
| 174 | Toperation_t operation[2]; |
---|
| 175 | operation [0] = OPERATION_MEMORY_LOAD_8_Z; |
---|
| 176 | operation [1] = OPERATION_MEMORY_STORE_32; |
---|
| 177 | |
---|
| 178 | list<request_t> rob; |
---|
| 179 | list<request_t>::iterator it; |
---|
| 180 | |
---|
| 181 | Tlsq_ptr_t _STORE_QUEUE_PTR_WRITE [_param->_nb_load_store_queue]; |
---|
| 182 | bool _STORE_QUEUE_USE [_param->_nb_load_store_queue][max<uint32_t>(_param->_size_store_queue,_param->_nb_load_store_queue)]; |
---|
| 183 | Tlsq_ptr_t _STORE_QUEUE_NB_USE [_param->_nb_load_store_queue]; |
---|
| 184 | Tlsq_ptr_t _LOAD_QUEUE_PTR_WRITE [_param->_nb_load_store_queue]; |
---|
| 185 | bool _LOAD_QUEUE_USE [_param->_nb_load_store_queue][max<uint32_t>(_param->_size_load_queue,_param->_nb_load_store_queue)]; |
---|
| 186 | |
---|
| 187 | for (uint32_t i=0; i<_param->_nb_load_store_queue; i++) |
---|
| 188 | { |
---|
| 189 | _STORE_QUEUE_PTR_WRITE [i] = 0; |
---|
| 190 | _STORE_QUEUE_NB_USE [i] = 0; |
---|
| 191 | _LOAD_QUEUE_PTR_WRITE [i] = 0; |
---|
| 192 | |
---|
| 193 | for (uint32_t j=0; j<max<uint32_t>(_param->_size_store_queue,_param->_nb_load_store_queue); j++) |
---|
| 194 | _STORE_QUEUE_USE [i][j] = false; |
---|
| 195 | for (uint32_t j=0; j<max<uint32_t>(_param->_size_load_queue,_param->_nb_load_store_queue); j++) |
---|
| 196 | _LOAD_QUEUE_USE [i][j] = false; |
---|
| 197 | } |
---|
| 198 | |
---|
| 199 | SC_START(0); |
---|
| 200 | LABEL("Initialisation"); |
---|
| 201 | |
---|
| 202 | LABEL("Reset"); |
---|
| 203 | in_NRESET->write(0); |
---|
| 204 | SC_START(5); |
---|
| 205 | in_NRESET->write(1); |
---|
| 206 | |
---|
| 207 | LABEL("Loop of Test"); |
---|
| 208 | |
---|
| 209 | for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) |
---|
| 210 | { |
---|
| 211 | LABEL("Iteration %d",iteration); |
---|
| 212 | |
---|
| 213 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 214 | { |
---|
| 215 | in_INSERT_VAL [i] ->write((rand()%100)<percent_transaction_insert); |
---|
| 216 | Tcontext_t front_end_id = rand()%_param->_nb_front_end; |
---|
| 217 | in_INSERT_FRONT_END_ID [i] ->write(front_end_id); |
---|
| 218 | in_INSERT_CONTEXT_ID [i] ->write(rand()%_param->_nb_context[front_end_id]); |
---|
| 219 | in_INSERT_TYPE [i] ->write(type [rand()%2]); |
---|
| 220 | in_INSERT_OPERATION [i] ->write(operation[rand()%2]); |
---|
| 221 | } |
---|
| 222 | |
---|
| 223 | it = rob.begin(); |
---|
| 224 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 225 | { |
---|
| 226 | in_RETIRE_VAL [i] ->write(((rand()%100)<percent_transaction_retire) and (i< rob.size())); |
---|
| 227 | |
---|
| 228 | if (i< rob.size()) |
---|
| 229 | { |
---|
| 230 | in_RETIRE_FRONT_END_ID [i]->write(it->_front_end_id ); |
---|
| 231 | in_RETIRE_CONTEXT_ID [i]->write(it->_context_id ); |
---|
[88] | 232 | // in_RETIRE_TYPE [i]->write(it->_type ); |
---|
| 233 | // in_RETIRE_OPERATION [i]->write(it->_operation ); |
---|
| 234 | in_RETIRE_USE_STORE_QUEUE [i]->write((it->_type == TYPE_MEMORY) and is_operation_memory_store(it->_operation)); |
---|
| 235 | in_RETIRE_USE_LOAD_QUEUE [i]->write((it->_type == TYPE_MEMORY) and not is_operation_memory_store(it->_operation)); |
---|
[78] | 236 | in_RETIRE_STORE_QUEUE_PTR_WRITE [i]->write(it->_store_queue_ptr_write); |
---|
| 237 | in_RETIRE_LOAD_QUEUE_PTR_WRITE [i]->write(it->_load_queue_ptr_write ); |
---|
| 238 | |
---|
| 239 | it++; |
---|
| 240 | } |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | SC_START(0); |
---|
| 244 | |
---|
| 245 | it = rob.begin(); |
---|
| 246 | for (uint32_t i=0; i<_param->_nb_inst_retire; i++) |
---|
| 247 | { |
---|
| 248 | bool pop = false; |
---|
| 249 | if (in_RETIRE_VAL[i]->read()) |
---|
| 250 | { |
---|
[88] | 251 | if (not (in_RETIRE_USE_STORE_QUEUE [i]->read() or |
---|
| 252 | in_RETIRE_USE_LOAD_QUEUE [i]->read())) |
---|
[78] | 253 | TEST(Tcontrol_t, out_RETIRE_ACK[i]->read(),true); |
---|
| 254 | |
---|
| 255 | if (out_RETIRE_ACK[i]->read()) |
---|
| 256 | { |
---|
| 257 | pop = true; |
---|
| 258 | |
---|
| 259 | LABEL("RETIRE[%d] Transaction accepted",i); |
---|
| 260 | if (it->_type == TYPE_MEMORY) |
---|
| 261 | { |
---|
| 262 | LABEL(" * Type MEMORY"); |
---|
| 263 | if (is_operation_memory_store(it->_operation)) |
---|
| 264 | { |
---|
| 265 | LABEL(" * Operation STORE"); |
---|
| 266 | uint32_t lsq = _param->_link_load_store_unit_with_thread[it->_front_end_id][it->_context_id]; |
---|
| 267 | uint32_t ptr = it->_store_queue_ptr_write; |
---|
| 268 | |
---|
| 269 | LABEL(" * lsq : %d",lsq); |
---|
| 270 | LABEL(" * ptr : %d",ptr); |
---|
| 271 | |
---|
| 272 | _STORE_QUEUE_NB_USE [lsq] --; |
---|
| 273 | _STORE_QUEUE_USE [lsq][ptr] = false; |
---|
| 274 | } |
---|
| 275 | else |
---|
| 276 | { |
---|
| 277 | LABEL(" * Operation LOAD"); |
---|
| 278 | uint32_t lsq = _param->_link_load_store_unit_with_thread[it->_front_end_id][it->_context_id]; |
---|
| 279 | uint32_t ptr = it->_load_queue_ptr_write; |
---|
| 280 | |
---|
| 281 | LABEL(" * lsq : %d",lsq); |
---|
| 282 | LABEL(" * ptr : %d",ptr); |
---|
| 283 | |
---|
| 284 | _LOAD_QUEUE_USE [lsq][ptr] = false; |
---|
| 285 | } |
---|
| 286 | } |
---|
| 287 | it = rob.erase(it); |
---|
| 288 | } |
---|
| 289 | } |
---|
| 290 | |
---|
| 291 | if ((pop == false) and (i< rob.size())) |
---|
| 292 | it++; |
---|
| 293 | } |
---|
| 294 | |
---|
| 295 | for (uint32_t i=0; i<_param->_nb_inst_insert; i++) |
---|
| 296 | if (in_INSERT_VAL[i]->read()) |
---|
| 297 | { |
---|
| 298 | if (in_INSERT_TYPE [i]->read() != TYPE_MEMORY) |
---|
| 299 | TEST(Tcontrol_t, out_INSERT_ACK[i]->read(),true); |
---|
| 300 | |
---|
| 301 | if (out_INSERT_ACK[i]->read()) |
---|
| 302 | { |
---|
| 303 | rob.push_back(request_t( in_INSERT_FRONT_END_ID [i]->read(), |
---|
| 304 | in_INSERT_CONTEXT_ID [i]->read(), |
---|
| 305 | in_INSERT_TYPE [i]->read(), |
---|
| 306 | in_INSERT_OPERATION [i]->read(), |
---|
| 307 | out_INSERT_STORE_QUEUE_PTR_WRITE [i]->read(), |
---|
| 308 | out_INSERT_LOAD_QUEUE_PTR_WRITE [i]->read())); |
---|
| 309 | |
---|
| 310 | LABEL("INSERT[%d] Transaction accepted",i); |
---|
| 311 | |
---|
| 312 | if (in_INSERT_TYPE [i]->read() == TYPE_MEMORY) |
---|
| 313 | { |
---|
| 314 | LABEL(" * Type MEMORY"); |
---|
| 315 | if (is_operation_memory_store(in_INSERT_OPERATION [i]->read())) |
---|
| 316 | { |
---|
| 317 | LABEL(" * Operation STORE"); |
---|
| 318 | uint32_t lsq = _param->_link_load_store_unit_with_thread[in_INSERT_FRONT_END_ID[i]->read()][in_INSERT_CONTEXT_ID[i]->read()]; |
---|
| 319 | uint32_t ptr = _STORE_QUEUE_PTR_WRITE [lsq]; |
---|
| 320 | |
---|
| 321 | LABEL(" * lsq : %d",lsq); |
---|
| 322 | LABEL(" * ptr : %d",ptr); |
---|
| 323 | |
---|
| 324 | TEST(bool , _STORE_QUEUE_USE [lsq][ptr], false); |
---|
| 325 | TEST(Tlsq_ptr_t, out_INSERT_STORE_QUEUE_PTR_WRITE [i]->read(),ptr ); |
---|
| 326 | TEST(Tlsq_ptr_t, out_INSERT_LOAD_QUEUE_PTR_WRITE [i]->read(),_LOAD_QUEUE_PTR_WRITE [lsq]); |
---|
| 327 | TEST(bool ,static_cast<uint32_t>(_STORE_QUEUE_NB_USE [lsq]+1)<_param->_size_store_queue[lsq], true); |
---|
| 328 | |
---|
| 329 | _STORE_QUEUE_PTR_WRITE [lsq] = (ptr+1)%_param->_size_store_queue[lsq]; |
---|
| 330 | _STORE_QUEUE_NB_USE [lsq] ++; |
---|
| 331 | _STORE_QUEUE_USE [lsq][ptr] = true; |
---|
| 332 | } |
---|
| 333 | else |
---|
| 334 | { |
---|
| 335 | LABEL(" * Operation LOAD"); |
---|
| 336 | uint32_t lsq = _param->_link_load_store_unit_with_thread[in_INSERT_FRONT_END_ID[i]->read()][in_INSERT_CONTEXT_ID[i]->read()]; |
---|
| 337 | uint32_t ptr = _LOAD_QUEUE_PTR_WRITE [lsq]; |
---|
| 338 | |
---|
| 339 | LABEL(" * lsq : %d",lsq); |
---|
| 340 | LABEL(" * ptr : %d",ptr); |
---|
| 341 | |
---|
| 342 | TEST(bool , _LOAD_QUEUE_USE [lsq][ptr], false); |
---|
| 343 | TEST(Tlsq_ptr_t, out_INSERT_STORE_QUEUE_PTR_WRITE [i]->read(),_STORE_QUEUE_PTR_WRITE [lsq]); |
---|
| 344 | TEST(Tlsq_ptr_t, out_INSERT_LOAD_QUEUE_PTR_WRITE [i]->read(),ptr ); |
---|
| 345 | |
---|
| 346 | _LOAD_QUEUE_PTR_WRITE [lsq] = (ptr+1)%_param->_size_load_queue[lsq]; |
---|
| 347 | _LOAD_QUEUE_USE [lsq][ptr] = true; |
---|
| 348 | } |
---|
| 349 | } |
---|
| 350 | } |
---|
| 351 | } |
---|
| 352 | |
---|
| 353 | |
---|
| 354 | for (uint32_t i=0; i<_param->_nb_load_store_queue; i++) |
---|
| 355 | { |
---|
| 356 | std::string str; |
---|
| 357 | |
---|
| 358 | LABEL("LOAD_STORE_QUEUE [%d]",i); |
---|
| 359 | |
---|
| 360 | LABEL(" * STORE_QUEUE_PTR_WRITE : %d",_STORE_QUEUE_PTR_WRITE [i]); |
---|
| 361 | LABEL(" * STORE_QUEUE_NB_USE : %d",_STORE_QUEUE_NB_USE [i]); |
---|
| 362 | |
---|
| 363 | str = ""; |
---|
| 364 | for (uint32_t j=0; j<_param->_size_store_queue[i]; j++) |
---|
| 365 | str += toString(_STORE_QUEUE_USE [i][j]) + " "; |
---|
| 366 | LABEL(" * %s",str.c_str()); |
---|
| 367 | |
---|
| 368 | LABEL(" * LOAD_QUEUE_PTR_WRITE : %d",_LOAD_QUEUE_PTR_WRITE [i]); |
---|
| 369 | |
---|
| 370 | str = ""; |
---|
| 371 | for (uint32_t j=0; j<_param->_size_load_queue[i]; j++) |
---|
| 372 | str += toString(_LOAD_QUEUE_USE [i][j]) + " "; |
---|
| 373 | LABEL(" * %s",str.c_str()); |
---|
| 374 | } |
---|
| 375 | |
---|
| 376 | |
---|
| 377 | SC_START(1); |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | /******************************************************** |
---|
| 381 | * Simulation - End |
---|
| 382 | ********************************************************/ |
---|
| 383 | |
---|
| 384 | TEST_OK ("End of Simulation"); |
---|
| 385 | delete _time; |
---|
| 386 | |
---|
| 387 | msg(_("<%s> : ............ Stop Simulation\n"),name.c_str()); |
---|
| 388 | |
---|
| 389 | delete in_CLOCK; |
---|
| 390 | delete in_NRESET; |
---|
| 391 | |
---|
| 392 | delete [] in_INSERT_VAL ; |
---|
| 393 | delete [] out_INSERT_ACK ; |
---|
| 394 | delete [] in_INSERT_FRONT_END_ID ; |
---|
| 395 | delete [] in_INSERT_CONTEXT_ID ; |
---|
| 396 | delete [] in_INSERT_TYPE ; |
---|
| 397 | delete [] in_INSERT_OPERATION ; |
---|
| 398 | delete [] out_INSERT_STORE_QUEUE_PTR_WRITE; |
---|
| 399 | delete [] out_INSERT_LOAD_QUEUE_PTR_WRITE ; |
---|
| 400 | delete [] in_RETIRE_VAL ; |
---|
| 401 | delete [] out_RETIRE_ACK ; |
---|
| 402 | delete [] in_RETIRE_FRONT_END_ID ; |
---|
| 403 | delete [] in_RETIRE_CONTEXT_ID ; |
---|
[88] | 404 | // delete [] in_RETIRE_TYPE ; |
---|
| 405 | // delete [] in_RETIRE_OPERATION ; |
---|
| 406 | delete [] in_RETIRE_USE_STORE_QUEUE ; |
---|
| 407 | delete [] in_RETIRE_USE_LOAD_QUEUE ; |
---|
[78] | 408 | delete [] in_RETIRE_STORE_QUEUE_PTR_WRITE; |
---|
| 409 | delete [] in_RETIRE_LOAD_QUEUE_PTR_WRITE ; |
---|
| 410 | |
---|
| 411 | #endif |
---|
| 412 | |
---|
| 413 | delete _Load_Store_pointer_unit; |
---|
| 414 | #ifdef STATISTICS |
---|
| 415 | delete _parameters_statistics; |
---|
| 416 | #endif |
---|
| 417 | } |
---|