source: trunk/IPs/systemC/processor/Morpheo/Behavioural/New_Component/SelfTest/src/test.cpp @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 2.1 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 * Test
7 */
8
9#define NB_ITERATION 1
10
11#include "Behavioural/@DIRECTORY/SelfTest/include/test.h"
12#include "Include/Test.h"
13
14void test (string name,
15           morpheo::behavioural::@NAMESPACE_USE::Parameters param)
16{
17  cout << "<" << name << "> : Simulation SystemC" << endl;
18
19  @COMPONENT * _@COMPONENT = new @COMPONENT (name.c_str(),
20#ifdef STATISTICS
21                                             morpheo::behavioural::Parameters_Statistics(5,50),
22#endif
23                                             param);
24 
25#ifdef SYSTEMC
26  /*********************************************************************
27   * Déclarations des signaux
28   *********************************************************************/
29  sc_clock                               * CLOCK;
30
31
32  string rename;
33
34  CLOCK                                  = new sc_clock ("clock", 1.0, 0.5);
35 
36  /********************************************************
37   * Instanciation
38   ********************************************************/
39 
40  cout << "<" << name << "> Instanciation of _@COMPONENT" << endl;
41 
42  (*(_@COMPONENT->in_CLOCK))        (*(CLOCK));
43
44  /********************************************************
45   * Simulation - Begin
46   ********************************************************/
47
48  cout << "<" << name << "> Start Simulation ............" << endl;
49  // Initialisation
50
51  const uint32_t seed = 0;
52//const uint32_t seed = static_cast<uint32_t>(time(NULL));
53
54  srand(seed);
55
56  sc_start(0);
57  _@COMPONENT->vhdl_testbench_label("Initialisation");
58  cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Initialisation" << endl;
59
60
61  _@COMPONENT->vhdl_testbench_label("Loop of Test");
62  cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} Loop of Test" << endl;
63
64  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
65    {
66      _@COMPONENT->vhdl_testbench_label("Iteration "+toString(iteration));
67
68      sc_start(1);
69    }
70
71  /********************************************************
72   * Simulation - End
73   ********************************************************/
74
75  cout << "<" << name << "> ............ Stop Simulation" << endl;
76
77#endif
78
79  delete _@COMPONENT;
80}
Note: See TracBrowser for help on using the repository browser.