source: trunk/IPs/systemC/processor/Morpheo/Behavioural/New_Component_vbe/SelfTest/src/test.cpp @ 86

Last change on this file since 86 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
RevLine 
[2]1/*
2 * $Id$
3 *
[73]4 * [ Description ]
[2]5 *
6 * Test
7 */
8
9#include "Behavioural/@DIRECTORY/SelfTest/include/test.h"
[73]10#include "Behavioural/include/Allocation.h"
[2]11
12void test (string name,
[50]13           morpheo::behavioural::@NAMESPACE_USE::Parameters * _param)
[2]14{
[71]15  msg(_("<%s> : Simulation SystemC.\n"),name.c_str());
[2]16
[53]17#ifdef STATISTICS
18  morpheo::behavioural::Parameters_Statistics * _parameters_statistics = new morpheo::behavioural::Parameters_Statistics (5,50);
19#endif
20
[81]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(),
[2]33#ifdef STATISTICS
[81]34     _parameters_statistics,
[2]35#endif
[81]36     _param,
37     _usage);
[2]38 
39#ifdef SYSTEMC
[81]40  if (usage_is_set(_usage,USE_SYSTEMC))
41    {
[2]42  /*********************************************************************
43   * Déclarations des signaux
44   *********************************************************************/
45  string rename;
46
[67]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");
[2]49 
50  /********************************************************
51   * Instanciation
52   ********************************************************/
53 
[71]54  msg(_("<%s> : Instanciation of _@COMPONENT.\n"),name.c_str());
55
[53]56  (*(_@COMPONENT->in_CLOCK))        (*(in_CLOCK));
57  (*(_@COMPONENT->in_NRESET))       (*(in_NRESET));
[2]58
[15]59
[71]60  msg(_("<%s> : Start Simulation ............\n"),name.c_str());
61   
[50]62  Time * _time = new Time();
[15]63
[2]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
[50]75  SC_START(0);
[15]76  LABEL("Initialisation");
[2]77
[67]78  LABEL("Reset");
79  in_NRESET->write(0);
80  SC_START(5);
81  in_NRESET->write(1); 
82
[15]83  LABEL("Loop of Test");
[2]84
85  for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++)
86    {
[72]87      LABEL("Iteration %d",iteration);
[2]88
[50]89      SC_START(1);
[2]90    }
91
92  /********************************************************
93   * Simulation - End
94   ********************************************************/
95
[50]96  TEST_OK ("End of Simulation");
97  delete _time;
[2]98
[71]99  msg(_("<%s> : ............ Stop Simulation\n"),name.c_str());
100
[55]101  delete in_CLOCK;
102  delete in_NRESET;
[81]103    }
[2]104#endif
105
106  delete _@COMPONENT;
[55]107#ifdef STATISTICS
[53]108  delete _parameters_statistics;
109#endif
[2]110}
Note: See TracBrowser for help on using the repository browser.