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

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