source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/SelfTest/src/test.cpp

Last change on this file was 112, checked in by rosiere, 15 years ago

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

  • Property svn:keywords set to Id
File size: 21.8 KB
Line 
1/*
2 * $Id: test.cpp 112 2009-03-18 22:36:26Z rosiere $
3 *
4 * [ Description ]
5 *
6 * Test
7 */
8
9#define NB_ITERATION  1024
10#define CYCLE_MAX     (128*NB_ITERATION)
11
12#include "Behavioural/Core/Multi_Front_end/Front_end/Ifetch_unit/SelfTest/include/test.h"
13#include "../../../../../../../../Environment/Queue/include/Sort_Queue.h"
14#include "Common/include/Test.h"
15#include "Behavioural/include/Allocation.h"
16
17//using namespace environment;
18using namespace environment::queue;
19
20class cache_req_t
21{
22public : Tpacket_t  packet;
23public : Taddress_t address;
24
25public : cache_req_t (Tpacket_t  packet,
26                      Taddress_t address)
27  {
28    this->packet  = packet ;
29    this->address = address;
30  }
31};
32
33void test (string name,
34           morpheo::behavioural::core::multi_front_end::front_end::ifetch_unit::Parameters * _param)
35{
36  msg(_("<%s> : Simulation SystemC.\n"),name.c_str());
37
38#ifdef STATISTICS
39  morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,1024);
40#endif
41
42  Tusage_t _usage = USE_ALL;
43//   _usage = usage_unset(_usage,USE_SYSTEMC              );
44//   _usage = usage_unset(_usage,USE_VHDL                 );
45//   _usage = usage_unset(_usage,USE_VHDL_TESTBENCH       );
46//   _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT);
47//   _usage = usage_unset(_usage,USE_POSITION             );
48  _usage = usage_unset(_usage,USE_STATISTICS           );
49//   _usage = usage_unset(_usage,USE_INFORMATION          );
50
51  Ifetch_unit * _Ifetch_unit = new Ifetch_unit
52    (name.c_str(),
53#ifdef STATISTICS
54     _parameters_statistics,
55#endif
56     _param,
57     _usage);
58 
59#ifdef SYSTEMC
60  /*********************************************************************
61   * Déclarations des signaux
62   *********************************************************************/
63  string rename;
64
65  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
66  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
67
68  ALLOC0_SC_SIGNAL(out_ICACHE_REQ_VAL                     ,"out_ICACHE_REQ_VAL                     ",Tcontrol_t           );
69  ALLOC0_SC_SIGNAL( in_ICACHE_REQ_ACK                     ," in_ICACHE_REQ_ACK                     ",Tcontrol_t           );
70//ALLOC0_SC_SIGNAL(out_ICACHE_REQ_THREAD_ID               ,"out_ICACHE_REQ_THREAD_ID               ",Tcontext_t           );
71  ALLOC0_SC_SIGNAL(out_ICACHE_REQ_PACKET_ID               ,"out_ICACHE_REQ_PACKET_ID               ",Tpacket_t            );
72  ALLOC0_SC_SIGNAL(out_ICACHE_REQ_ADDRESS                 ,"out_ICACHE_REQ_ADDRESS                 ",Ticache_instruction_t);
73  ALLOC0_SC_SIGNAL(out_ICACHE_REQ_TYPE                    ,"out_ICACHE_REQ_TYPE                    ",Ticache_type_t       );
74  ALLOC0_SC_SIGNAL( in_ICACHE_RSP_VAL                     ," in_ICACHE_RSP_VAL                     ",Tcontrol_t           );
75  ALLOC0_SC_SIGNAL(out_ICACHE_RSP_ACK                     ,"out_ICACHE_RSP_ACK                     ",Tcontrol_t           );
76//ALLOC0_SC_SIGNAL( in_ICACHE_RSP_THREAD_ID               ," in_ICACHE_RSP_THREAD_ID               ",Tcontext_t           );
77  ALLOC0_SC_SIGNAL( in_ICACHE_RSP_PACKET_ID               ," in_ICACHE_RSP_PACKET_ID               ",Tpacket_t            );
78  ALLOC1_SC_SIGNAL( in_ICACHE_RSP_INSTRUCTION             ," in_ICACHE_RSP_INSTRUCTION             ",Ticache_instruction_t,_param->_nb_instruction);
79  ALLOC0_SC_SIGNAL( in_ICACHE_RSP_ERROR                   ," in_ICACHE_RSP_ERROR                   ",Ticache_error_t      );
80  ALLOC0_SC_SIGNAL(out_PREDICT_VAL                        ,"out_PREDICT_VAL                        ",Tcontrol_t           );
81  ALLOC0_SC_SIGNAL( in_PREDICT_ACK                        ," in_PREDICT_ACK                        ",Tcontrol_t           );
82  ALLOC0_SC_SIGNAL(out_PREDICT_PC_PREVIOUS                ,"out_PREDICT_PC_PREVIOUS                ",Tgeneral_address_t   );
83  ALLOC0_SC_SIGNAL(out_PREDICT_PC_CURRENT                 ,"out_PREDICT_PC_CURRENT                 ",Tgeneral_address_t   );
84  ALLOC0_SC_SIGNAL(out_PREDICT_PC_CURRENT_IS_DS_TAKE      ,"out_PREDICT_PC_CURRENT_IS_DS_TAKE      ",Tcontrol_t           );
85  ALLOC0_SC_SIGNAL( in_PREDICT_PC_NEXT                    ," in_PREDICT_PC_NEXT                    ",Tgeneral_address_t   );
86  ALLOC0_SC_SIGNAL( in_PREDICT_PC_NEXT_IS_DS_TAKE         ," in_PREDICT_PC_NEXT_IS_DS_TAKE         ",Tcontrol_t           );
87  ALLOC1_SC_SIGNAL( in_PREDICT_INSTRUCTION_ENABLE         ," in_PREDICT_INSTRUCTION_ENABLE         ",Tcontrol_t           ,_param->_nb_instruction);
88  ALLOC0_SC_SIGNAL( in_PREDICT_INST_IFETCH_PTR            ," in_PREDICT_INST_IFETCH_PTR            ",Tinst_ifetch_ptr_t   );
89  ALLOC0_SC_SIGNAL( in_PREDICT_BRANCH_STATE               ," in_PREDICT_BRANCH_STATE               ",Tbranch_state_t      );
90  ALLOC0_SC_SIGNAL( in_PREDICT_BRANCH_UPDATE_PREDICTION_ID," in_PREDICT_BRANCH_UPDATE_PREDICTION_ID",Tprediction_ptr_t    );
91  ALLOC1_SC_SIGNAL(out_DECOD_VAL                          ,"out_DECOD_VAL                          ",Tcontrol_t           ,_param->_nb_instruction);
92  ALLOC1_SC_SIGNAL( in_DECOD_ACK                          ," in_DECOD_ACK                          ",Tcontrol_t           ,_param->_nb_instruction);
93  ALLOC1_SC_SIGNAL(out_DECOD_INSTRUCTION                  ,"out_DECOD_INSTRUCTION                  ",Tinstruction_t       ,_param->_nb_instruction);
94//ALLOC0_SC_SIGNAL(out_DECOD_CONTEXT_ID                   ,"out_DECOD_CONTEXT_ID                   ",Tcontext_t           );
95  ALLOC0_SC_SIGNAL(out_DECOD_ADDRESS                      ,"out_DECOD_ADDRESS                      ",Tgeneral_address_t   );
96  ALLOC0_SC_SIGNAL(out_DECOD_INST_IFETCH_PTR              ,"out_DECOD_INST_IFETCH_PTR              ",Tinst_ifetch_ptr_t   );
97  ALLOC0_SC_SIGNAL(out_DECOD_BRANCH_STATE                 ,"out_DECOD_BRANCH_STATE                 ",Tbranch_state_t      );
98  ALLOC0_SC_SIGNAL(out_DECOD_BRANCH_UPDATE_PREDICTION_ID  ,"out_DECOD_BRANCH_UPDATE_PREDICTION_ID  ",Tprediction_ptr_t    );
99  ALLOC0_SC_SIGNAL(out_DECOD_EXCEPTION                    ,"out_DECOD_EXCEPTION                    ",Texception_t         );
100  ALLOC0_SC_SIGNAL( in_EVENT_VAL                          ," in_EVENT_VAL                          ",Tcontrol_t           );
101  ALLOC0_SC_SIGNAL(out_EVENT_ACK                          ,"out_EVENT_ACK                          ",Tcontrol_t           );
102  ALLOC0_SC_SIGNAL( in_EVENT_ADDRESS                      ," in_EVENT_ADDRESS                      ",Tgeneral_address_t   );
103  ALLOC0_SC_SIGNAL( in_EVENT_ADDRESS_NEXT                 ," in_EVENT_ADDRESS_NEXT                 ",Tgeneral_address_t   );
104  ALLOC0_SC_SIGNAL( in_EVENT_ADDRESS_NEXT_VAL             ," in_EVENT_ADDRESS_NEXT_VAL             ",Tcontrol_t           );
105  ALLOC0_SC_SIGNAL( in_EVENT_IS_DS_TAKE                   ," in_EVENT_IS_DS_TAKE                   ",Tcontrol_t           );
106 
107  /********************************************************
108   * Instanciation
109   ********************************************************/
110 
111  msg(_("<%s> : Instanciation of _Ifetch_unit.\n"),name.c_str());
112
113  (*(_Ifetch_unit->in_CLOCK))        (*(in_CLOCK));
114  (*(_Ifetch_unit->in_NRESET))       (*(in_NRESET));
115
116  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_ICACHE_REQ_VAL                     );
117  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_ICACHE_REQ_ACK                     );
118//INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_ICACHE_REQ_THREAD_ID               );
119  if (_param->_have_port_ifetch_queue_ptr)
120  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_ICACHE_REQ_PACKET_ID               );
121  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_ICACHE_REQ_ADDRESS                 );
122  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_ICACHE_REQ_TYPE                    );
123  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_ICACHE_RSP_VAL                     );
124  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_ICACHE_RSP_ACK                     );
125//INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_ICACHE_RSP_THREAD_ID               );
126  if (_param->_have_port_ifetch_queue_ptr)
127  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_ICACHE_RSP_PACKET_ID               );
128  INSTANCE1_SC_SIGNAL(_Ifetch_unit, in_ICACHE_RSP_INSTRUCTION             ,_param->_nb_instruction);
129  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_ICACHE_RSP_ERROR                   );
130  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_PREDICT_VAL                        );
131  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_PREDICT_ACK                        );
132  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_PREDICT_PC_PREVIOUS                );
133  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_PREDICT_PC_CURRENT                 );
134  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_PREDICT_PC_CURRENT_IS_DS_TAKE      );
135  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_PREDICT_PC_NEXT                    );
136  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_PREDICT_PC_NEXT_IS_DS_TAKE         );
137  INSTANCE1_SC_SIGNAL(_Ifetch_unit, in_PREDICT_INSTRUCTION_ENABLE         ,_param->_nb_instruction);
138  if (_param->_have_port_inst_ifetch_ptr)
139  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_PREDICT_INST_IFETCH_PTR            );
140  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_PREDICT_BRANCH_STATE               );
141  if (_param->_have_port_depth)
142  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_PREDICT_BRANCH_UPDATE_PREDICTION_ID);
143  INSTANCE1_SC_SIGNAL(_Ifetch_unit,out_DECOD_VAL                          ,_param->_nb_instruction);
144  INSTANCE1_SC_SIGNAL(_Ifetch_unit, in_DECOD_ACK                          ,_param->_nb_instruction);
145  INSTANCE1_SC_SIGNAL(_Ifetch_unit,out_DECOD_INSTRUCTION                  ,_param->_nb_instruction);
146//INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_DECOD_CONTEXT_ID                   );
147  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_DECOD_ADDRESS                      );
148  if (_param->_have_port_inst_ifetch_ptr)
149  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_DECOD_INST_IFETCH_PTR              );
150  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_DECOD_BRANCH_STATE                 );
151  if (_param->_have_port_depth)
152  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_DECOD_BRANCH_UPDATE_PREDICTION_ID  );
153  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_DECOD_EXCEPTION                    );
154  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_EVENT_VAL                          );
155  INSTANCE0_SC_SIGNAL(_Ifetch_unit,out_EVENT_ACK                          );
156  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_EVENT_ADDRESS                      );
157  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_EVENT_ADDRESS_NEXT                 );
158  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_EVENT_ADDRESS_NEXT_VAL             );
159  INSTANCE0_SC_SIGNAL(_Ifetch_unit, in_EVENT_IS_DS_TAKE                   );
160
161  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
162   
163  Time * _time = new Time();
164
165  /********************************************************
166   * Simulation - Begin
167   ********************************************************/
168
169  // Initialisation
170
171  const uint32_t seed = 0;
172//const uint32_t seed = static_cast<uint32_t>(time(NULL));
173
174  srand(seed);
175
176  const  int32_t percent_transaction_icache_req = 75;
177  const  int32_t percent_transaction_icache_rsp = 75;
178  const  int32_t percent_transaction_predict    = 75;
179  const  int32_t percent_transaction_event      =  5;
180  const  int32_t percent_hit                    = 90;
181  const uint32_t delay_miss_min                 =  5;
182  const uint32_t delay_miss_max                 = 10;
183
184  SC_START(0);
185  LABEL("Initialisation");
186
187  uint32_t        jump          = 7 ;// packet
188  uint32_t        nb_packet_in  = 1;
189  uint32_t        nb_packet_out = 1;
190
191  Tcontrol_t      c_val   = false;
192  Tcontrol_t      n_val   = false;
193  Tcontrol_t      nn_val  = false;
194
195  Tgeneral_data_t c_addr  = 0x100>>2;
196  Tgeneral_data_t n_addr  = 0x100>>2;
197  Tgeneral_data_t nn_addr = 0x100>>2;
198
199  Tcontrol_t      c_enable [_param->_nb_instruction];
200  Tcontrol_t      n_enable [_param->_nb_instruction];
201
202  Tcontrol_t      c_is_ds_take   = 0;
203  Tcontrol_t      n_is_ds_take   = 0;           
204  Tcontrol_t      nn_is_ds_take  = 0;
205
206  bool            slot_use [_param->_size_queue];
207
208  environment::queue::Parameters * param_cache = new environment::queue::Parameters(_param->_size_queue);
209  Sort_Queue<cache_req_t*>       * cache       = new Sort_Queue<cache_req_t*>      ("cache",param_cache);
210
211  cache->reset();
212
213  for (uint32_t i=0; i<_param->_size_queue; i++)
214    slot_use [i] = false;
215
216  c_enable [0] = 1;
217  for (uint32_t i=1; i<_param->_nb_instruction; i++)
218    c_enable [i] = 0;
219
220  LABEL("Reset");
221  in_NRESET->write(0);
222  SC_START(5);
223  in_NRESET->write(1); 
224
225  LABEL("Test no out val/ack");
226 
227  TEST(Tcontrol_t,out_ICACHE_REQ_VAL->read(), 0);
228  TEST(Tcontrol_t,out_ICACHE_RSP_ACK->read(), 1);
229  TEST(Tcontrol_t,out_PREDICT_VAL   ->read(), 1);
230  TEST(Tcontrol_t,out_EVENT_ACK     ->read(), 1);
231
232  for (uint32_t i=0; i<_param->_nb_instruction; i++)
233    TEST(Tcontrol_t,out_DECOD_VAL [i]->read(), 0);
234
235//   LABEL("Send Reset");
236//   do
237//     {
238//       in_EVENT_VAL    ->write(1);
239//       in_EVENT_ADDRESS->write(n_addr);
240//       SC_START(1); 
241//     } while (out_EVENT_ACK->read() == false);
242//   in_EVENT_VAL    ->write(0);
243
244  n_val = 1;
245
246  LABEL("Loop of Test");
247
248  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
249    {
250      LABEL("Iteration %d",iteration);
251
252//       // PREDICT
253//       {
254//      in_PREDICT_ACK  ->write((rand()%100)<percent_transaction_predict);
255       
256//      SC_START(0);
257
258//      Taddress_t addr  = (out_PREDICT_PC_CURRENT_IS_DS_TAKE->read())?out_PREDICT_PC_PREVIOUS->read():out_PREDICT_PC_CURRENT->read();
259
260//      uint32_t   begin = addr%_param->_nb_instruction;
261//      uint32_t   end   = ((begin<<1)>_param->_nb_instruction)?(_param->_nb_instruction-1):(begin<<1);
262//      Tcontrol_t take  = (nb_packet_in%jump)==0;
263       
264//      if (take)
265//        addr += 0x100;
266//      else
267//        addr += end-begin+1;
268
269//      for (uint32_t i=0; i<_param->_nb_instruction; i++)
270//      in_PREDICT_INSTRUCTION_ENABLE     [i] ->write((i>=begin) and (i<=end));
271//      in_PREDICT_PC_NEXT                    ->write(addr);
272//      in_PREDICT_PC_NEXT_IS_DS_TAKE         ->write(take);
273//      in_PREDICT_INST_IFETCH_PTR            ->write(0);
274//      in_PREDICT_BRANCH_STATE               ->write(0);
275//      in_PREDICT_BRANCH_UPDATE_PREDICTION_ID->write(0);
276//       }
277
278//       // DECOD
279//       {
280//      uint32_t nb_decod = (rand()%_param->_nb_instruction);
281
282//      for (uint32_t i=0; i<_param->_nb_instruction; i++)
283//        in_DECOD_ACK [i]->write(i<=nb_decod);
284//       }
285
286//       // EVENT
287//       in_EVENT_VAL             ->write((rand()%100)<percent_transaction_event  );
288//       in_EVENT_ADDRESS         ->write(0x77);
289//       in_EVENT_ADDRESS_NEXT    ->write(0x171);
290//       Tcontrol_t is_ds_take = rand();
291//       in_EVENT_ADDRESS_NEXT_VAL->write(is_ds_take);
292//       in_EVENT_IS_DS_TAKE      ->write(is_ds_take);
293
294//       // ICACHE_REQ
295//       in_ICACHE_REQ_ACK->write((rand()%100)<percent_transaction_icache_req);
296
297//       // ICACHE_RSP
298//       {
299//      Tcontrol_t val = false;
300//      if (not cache->empty())
301//        {
302//          slot_t<cache_req_t *> cache_rsp = cache->read();
303
304//          val = (cache_rsp._delay == 0);
305           
306//          Tpacket_t  packet  = cache_rsp._data->packet ;
307//          Taddress_t address = cache_rsp._data->address;
308           
309//          in_ICACHE_RSP_PACKET_ID      ->write(packet);
310//          for (uint32_t i=0; i<_param->_nb_instruction; i++)
311//          in_ICACHE_RSP_INSTRUCTION [i]->write(address+i);
312//          in_ICACHE_RSP_ERROR          ->write(0);
313//        }
314
315//      in_ICACHE_RSP_VAL->write(val);
316//       }
317
318//       //-------------------------------------------------
319//       SC_START(0);
320//       //-------------------------------------------------
321
322//       if (out_ICACHE_REQ_VAL->read() and in_ICACHE_REQ_ACK->read())
323//      {
324//        LABEL("ICACHE_REQ : Transaction accepted");
325
326//        Tpacket_t  packet  = (_param->_have_port_ifetch_queue_ptr)?out_ICACHE_REQ_PACKET_ID->read():0;
327//        Taddress_t address = out_ICACHE_REQ_ADDRESS->read();
328
329//        TEST(bool      ,slot_use[packet], false);
330//        TEST(Taddress_t,address         ,c_addr);
331
332//        slot_use[packet] = true;
333
334//        uint32_t delay;
335//        if ((rand()%100)<percent_hit)
336//          delay = 1;
337//        else
338//          delay = delay_miss_min + (rand()%(delay_miss_max-delay_miss_min+1));
339
340//        cache_req_t * cache_req = new cache_req_t(packet,address);
341//        cache->push(delay,cache_req);
342
343//        c_val = 0;
344//        nb_packet_in ++;
345//      }
346
347//       {
348//      bool find=false;
349
350//      Taddress_t addr=out_DECOD_ADDRESS->read();
351//      for (uint32_t i=0; i<_param->_nb_instruction; i++)
352//        if (out_DECOD_VAL[i]->read() and in_DECOD_ACK [i]->read())
353//          {
354//            Tinstruction_t inst = out_DECOD_INSTRUCTION[i]->read();
355//            LABEL("DECOD [%d]  : Transaction accepted",i);
356//            LABEL("  address     : 0x%x",addr);
357//            LABEL("  instruction : 0x%x",inst);
358
359//            find = true;
360//            TEST(Tinstruction_t,inst,addr+i);
361//          }
362
363//      if (find)
364//        {
365//          if (_param->_have_port_inst_ifetch_ptr)
366//          TEST(Tinst_ifetch_ptr_t, out_DECOD_INST_IFETCH_PTR            ->read(), 0);
367//          TEST(Tbranch_state_t   , out_DECOD_BRANCH_STATE               ->read(), 0);
368//          if (_param->_have_port_depth)
369//          TEST(Tprediction_ptr_t , out_DECOD_BRANCH_UPDATE_PREDICTION_ID->read(), 0);
370//          TEST(Texception_t      , out_DECOD_EXCEPTION                  ->read(), 0);
371//        }
372//       }
373     
374//       if (in_ICACHE_RSP_VAL->read() and out_ICACHE_RSP_ACK->read())
375//      {
376//        LABEL("ICACHE_RSP : Transaction accepted");
377
378//        slot_use[cache->read()._data->packet] = false;
379
380//        cache->pop();
381//      }
382
383//       if (out_PREDICT_VAL->read() and in_PREDICT_ACK->read())
384//      {
385//        LABEL("PREDICT    : Transaction accepted");
386
387//        if (c_val)
388//        TEST(Tgeneral_address_t,out_PREDICT_PC_PREVIOUS          ->read(),c_addr      );
389//        TEST(Tgeneral_address_t,out_PREDICT_PC_CURRENT           ->read(),n_addr      );
390//        TEST(Tcontrol_t        ,out_PREDICT_PC_CURRENT_IS_DS_TAKE->read(),n_is_ds_take);
391
392//        nn_val        = true;
393//        nn_addr       = in_PREDICT_PC_NEXT           ->read();
394//        nn_is_ds_take = in_PREDICT_PC_NEXT_IS_DS_TAKE->read();
395       
396//        for (uint32_t i=0; i<_param->_nb_instruction; i++)
397//        n_enable [i]  = in_PREDICT_INSTRUCTION_ENABLE [i]->read();
398//      }
399
400//       if (not c_val)
401//      {
402//        if (n_val and nn_val)
403//          {
404//            c_val        = 1;
405//            c_addr       = n_addr;
406//            c_is_ds_take = n_is_ds_take;
407
408//            for (uint32_t i=0; i<_param->_nb_instruction; i++)
409//              c_enable [i] = n_enable [i];
410             
411//            n_val        = 1;
412//            n_addr       = nn_addr;
413//            n_is_ds_take = nn_is_ds_take;
414             
415//            nn_val       = 0;
416//          }
417//      }
418
419//       if (in_EVENT_VAL->read() and out_EVENT_ACK->read())
420//      {
421//        LABEL("EVENT      : Transaction accepted");
422
423//        c_val           = false;
424//        n_val           = true;
425
426//        n_addr          = in_EVENT_ADDRESS->read();
427//        n_is_ds_take    = in_EVENT_IS_DS_TAKE->read();
428//        nn_val          = in_EVENT_ADDRESS_NEXT_VAL->read();
429//        nn_addr         = in_EVENT_ADDRESS_NEXT    ->read();
430//           nn_is_ds_take   = 0;
431
432//        n_enable [0] = 1;
433//        for (uint32_t i=1; i<_param->_nb_instruction; i++)
434//          n_enable [i] = 0;
435//      }
436
437     
438//       {
439//      string str_c_enable = "";
440//      string str_n_enable = "";
441
442//      for (uint32_t i=0; i<_param->_nb_instruction; i++)
443//        {
444//          str_c_enable += " " + toString(c_enable [i]);
445//          str_n_enable += " " + toString(n_enable [i]);
446//        }
447
448//      LABEL("-----------------------------------");
449//      LABEL("  * nb_packet_in  : %d",nb_packet_in);
450//      LABEL("  * nb_packet_out : %d",nb_packet_out);
451//      LABEL("  * pc   : %d %d %.8x %s",c_val  ,c_is_ds_take , c_addr ,str_c_enable.c_str());
452//      if (nn_val)
453//        {
454//      LABEL("  * pc+4 : %d %d %.8x %s",n_val  ,n_is_ds_take , n_addr ,str_n_enable.c_str());
455//        }
456//      else
457//        {
458//      LABEL("  * pc+4 : %d %d %.8x"   ,n_val  ,n_is_ds_take , n_addr );
459//        }
460//      LABEL("  * pc+8 : %d %d %.8x"   ,nn_val ,nn_is_ds_take, nn_addr);
461//      LABEL("-----------------------------------");
462//       }
463
464//       SC_START(1);
465//       cache->transition();
466    }
467
468  /********************************************************
469   * Simulation - End
470   ********************************************************/
471
472  TEST_OK ("End of Simulation");
473  delete _time;
474
475  msg(_("<%s> : ............ Stop Simulation\n"),name.c_str());
476
477  delete in_CLOCK;
478  delete in_NRESET;
479
480  delete    out_ICACHE_REQ_VAL                      ;
481  delete     in_ICACHE_REQ_ACK                      ;
482//delete    out_ICACHE_REQ_THREAD_ID                ;
483  delete    out_ICACHE_REQ_PACKET_ID                ;
484  delete    out_ICACHE_REQ_ADDRESS                  ;
485  delete    out_ICACHE_REQ_TYPE                     ;
486
487  delete     in_ICACHE_RSP_VAL                      ;
488  delete    out_ICACHE_RSP_ACK                      ;
489//delete     in_ICACHE_RSP_THREAD_ID                ;
490  delete     in_ICACHE_RSP_PACKET_ID                ;
491  delete []  in_ICACHE_RSP_INSTRUCTION              ;
492  delete     in_ICACHE_RSP_ERROR                    ;
493
494  delete    out_PREDICT_VAL                         ;
495  delete     in_PREDICT_ACK                         ;
496  delete    out_PREDICT_PC_PREVIOUS                 ;
497  delete    out_PREDICT_PC_CURRENT                  ;
498  delete    out_PREDICT_PC_CURRENT_IS_DS_TAKE       ;
499  delete     in_PREDICT_PC_NEXT                     ;
500  delete     in_PREDICT_PC_NEXT_IS_DS_TAKE          ;
501  delete []  in_PREDICT_INSTRUCTION_ENABLE          ;
502  delete     in_PREDICT_INST_IFETCH_PTR             ;
503  delete     in_PREDICT_BRANCH_STATE                ;
504  delete     in_PREDICT_BRANCH_UPDATE_PREDICTION_ID ;
505
506  delete [] out_DECOD_VAL                           ;
507  delete []  in_DECOD_ACK                           ;
508  delete [] out_DECOD_INSTRUCTION                   ;
509//delete    out_DECOD_CONTEXT_ID                    ;
510  delete    out_DECOD_ADDRESS                       ;
511  delete    out_DECOD_INST_IFETCH_PTR               ;
512  delete    out_DECOD_BRANCH_STATE                  ;
513  delete    out_DECOD_BRANCH_UPDATE_PREDICTION_ID   ;
514  delete    out_DECOD_EXCEPTION                     ;
515
516  delete     in_EVENT_VAL                           ;
517  delete    out_EVENT_ACK                           ;
518  delete     in_EVENT_ADDRESS                       ;
519  delete     in_EVENT_ADDRESS_NEXT                  ;
520  delete     in_EVENT_ADDRESS_NEXT_VAL              ;
521  delete     in_EVENT_IS_DS_TAKE                    ;
522
523  delete    param_cache;
524  delete    cache;
525#endif
526
527  delete _Ifetch_unit;
528#ifdef STATISTICS
529  delete _parameters_statistics;
530#endif
531}
Note: See TracBrowser for help on using the repository browser.