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

Last change on this file since 112 was 112, checked in by rosiere, 15 years ago

1) Stat_list : fix retire old and new register bug
2) Stat_list : remove read_counter and valid flag, because validation of destination is in retire step (not in commit step)
3) Model : add class Model (cf Morpheo.sim)
4) Allocation : alloc_interface_begin and alloc_interface_end to delete temporary array.
5) Script : add distexe.sh
6) Add Comparator, Multiplier, Divider. But this component are not implemented
7) Software : add Dhrystone

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