source: trunk/IPs/systemC/processor/Morpheo/Behavioural/New_Component_vst/SelfTest/src/test.cpp @ 83

Last change on this file since 83 was 83, checked in by rosiere, 16 years ago

Add component : Context_State (manage miss prediction, exception , decod_enable, synchronisation instruction ...)

File size: 2.8 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 * Test
7 */
8
9#include "Behavioural/@DIRECTORY/SelfTest/include/test.h"
10#include "Behavioural/include/Allocation.h"
11
12void test (string name,
13           morpheo::behavioural::@NAMESPACE_USE::Parameters * _param)
14{
15  msg(_("<%s> : Simulation SystemC.\n"),name.c_str());
16
17#ifdef STATISTICS
18  morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50);
19#endif
20
21  Tusage_t _usage = USE_ALL;
22
23//   _usage = usage_unset(_usage,USE_SYSTEMC              );
24//   _usage = usage_unset(_usage,USE_VHDL                 );
25//   _usage = usage_unset(_usage,USE_VHDL_TESTBENCH       );
26//   _usage = usage_unset(_usage,USE_VHDL_TESTBENCH_ASSERT);
27//   _usage = usage_unset(_usage,USE_POSITION             );
28//   _usage = usage_unset(_usage,USE_STATISTICS           );
29//   _usage = usage_unset(_usage,USE_INFORMATION          );
30
31  @COMPONENT * _@COMPONENT = new @COMPONENT
32    (name.c_str(),
33#ifdef STATISTICS
34     _parameters_statistics,
35#endif
36     _param,
37     _usage);
38 
39#ifdef SYSTEMC
40  if (usage_is_set(_usage,USE_SYSTEMC))
41    {
42  /*********************************************************************
43   * Déclarations des signaux
44   *********************************************************************/
45  string rename;
46
47  sc_clock              *  in_CLOCK  = new sc_clock ("clock", 1.0, 0.5);         
48  sc_signal<Tcontrol_t> *  in_NRESET = new sc_signal<Tcontrol_t> ("NRESET");
49 
50  /********************************************************
51   * Instanciation
52   ********************************************************/
53 
54  msg(_("<%s> : Instanciation of _@COMPONENT.\n"),name.c_str());
55
56  (*(_@COMPONENT->in_CLOCK))        (*(in_CLOCK));
57  (*(_@COMPONENT->in_NRESET))       (*(in_NRESET));
58
59
60  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
61   
62  Time * _time = new Time();
63
64  /********************************************************
65   * Simulation - Begin
66   ********************************************************/
67
68  // Initialisation
69
70  const uint32_t seed = 0;
71//const uint32_t seed = static_cast<uint32_t>(time(NULL));
72
73  srand(seed);
74
75  SC_START(0);
76  LABEL("Initialisation");
77
78  LABEL("Reset");
79  in_NRESET->write(0);
80  SC_START(5);
81  in_NRESET->write(1); 
82
83  LABEL("Loop of Test");
84
85  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
86    {
87      LABEL("Iteration %d",iteration);
88
89      SC_START(1);
90    }
91
92  /********************************************************
93   * Simulation - End
94   ********************************************************/
95
96  TEST_OK ("End of Simulation");
97  delete _time;
98
99  msg(_("<%s> : ............ Stop Simulation\n"),name.c_str());
100
101  delete in_CLOCK;
102  delete in_NRESET;
103    }
104#endif
105
106  delete _@COMPONENT;
107#ifdef STATISTICS
108  delete _parameters_statistics;
109#endif
110}
Note: See TracBrowser for help on using the repository browser.