source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Generic/Victim/SelfTest/src/test.cpp @ 82

Last change on this file since 82 was 82, checked in by rosiere, 16 years ago
  • support locale (now must "just" translate)
  • update all component with new test format
  • update all component with usage
  • New component : decod queue and prediction_unit
  • Property svn:keywords set to Id
File size: 3.5 KB
Line 
1/*
2 * $Id: test.cpp 82 2008-05-01 16:48:45Z rosiere $
3 *
4 * [ Description ]
5 *
6 * Test
7 */
8
9#define NB_ITERATION  10
10#define CYCLE_MAX     (128*NB_ITERATION)
11
12#include "Behavioural/Generic/Victim/SelfTest/include/test.h"
13#include "Common/include/Test.h"
14#include "Behavioural/include/Allocation.h"
15
16void test (string name,
17           morpheo::behavioural::generic::victim::Parameters * _param)
18{
19  msg(_("<%s> : Simulation SystemC.\n"),name.c_str());
20
21#ifdef STATISTICS
22  morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50);
23#endif
24
25  Victim * _Victim = new Victim (name.c_str(),
26#ifdef STATISTICS
27                                 _parameters_statistics,
28#endif
29                                 _param,
30                                 USE_ALL);
31 
32#ifdef SYSTEMC
33  /*********************************************************************
34   * Déclarations des signaux
35   *********************************************************************/
36  string rename;
37
38  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
39  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
40
41  ALLOC1_SC_SIGNAL( in_ACCESS_VAL    ," in_ACCESS_VAL    ",Tcontrol_t,_param->_nb_access);
42  ALLOC1_SC_SIGNAL(out_ACCESS_ACK    ,"out_ACCESS_ACK    ",Tcontrol_t,_param->_nb_access);
43  ALLOC1_SC_SIGNAL( in_ACCESS_ADDRESS," in_ACCESS_ADDRESS",Taddress_t,_param->_nb_access);
44  ALLOC1_SC_SIGNAL( in_ACCESS_HIT    ," in_ACCESS_HIT    ",Tcontrol_t,_param->_nb_access);
45  ALLOC1_SC_SIGNAL( in_ACCESS_ENTITY ," in_ACCESS_ENTITY ",Tentity_t ,_param->_nb_access);
46  ALLOC1_SC_SIGNAL(out_ACCESS_VICTIM ,"out_ACCESS_VICTIM ",Tentity_t ,_param->_nb_access);
47 
48  /********************************************************
49   * Instanciation
50   ********************************************************/
51 
52  msg(_("<%s> : Instanciation of _Victim.\n"),name.c_str());
53
54  (*(_Victim->in_CLOCK))        (*(in_CLOCK));
55  (*(_Victim->in_NRESET))       (*(in_NRESET));
56
57  INSTANCE1_SC_SIGNAL(_Victim, in_ACCESS_VAL    ,_param->_nb_access);
58  INSTANCE1_SC_SIGNAL(_Victim,out_ACCESS_ACK    ,_param->_nb_access);
59  if (_param->_have_port_address)
60  INSTANCE1_SC_SIGNAL(_Victim, in_ACCESS_ADDRESS,_param->_nb_access);
61  INSTANCE1_SC_SIGNAL(_Victim, in_ACCESS_HIT    ,_param->_nb_access);
62  INSTANCE1_SC_SIGNAL(_Victim, in_ACCESS_ENTITY ,_param->_nb_access);
63  INSTANCE1_SC_SIGNAL(_Victim,out_ACCESS_VICTIM ,_param->_nb_access);
64
65  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
66   
67  Time * _time = new Time();
68
69  /********************************************************
70   * Simulation - Begin
71   ********************************************************/
72
73  // Initialisation
74
75  const uint32_t seed = 0;
76//const uint32_t seed = static_cast<uint32_t>(time(NULL));
77
78  srand(seed);
79
80  SC_START(0);
81  LABEL("Initialisation");
82
83  LABEL("Reset");
84  in_NRESET->write(0);
85  SC_START(5);
86  in_NRESET->write(1); 
87
88  LABEL("Loop of Test");
89
90  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
91    {
92      LABEL("Iteration %d",iteration);
93
94      SC_START(1);
95    }
96
97  /********************************************************
98   * Simulation - End
99   ********************************************************/
100
101  TEST_OK ("End of Simulation");
102  delete _time;
103
104  msg(_("<%s> : ............ Stop Simulation\n"),name.c_str());
105
106  delete _Victim;
107
108  delete in_CLOCK;
109  delete in_NRESET;
110
111  delete []  in_ACCESS_VAL    ;
112  delete [] out_ACCESS_ACK    ;
113  delete []  in_ACCESS_ADDRESS;
114  delete []  in_ACCESS_HIT    ;
115  delete []  in_ACCESS_ENTITY ;
116  delete [] out_ACCESS_VICTIM ;
117#endif
118
119#ifdef STATISTICS
120  delete _parameters_statistics;
121#endif
122}
Note: See TracBrowser for help on using the repository browser.