source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit/SelfTest/src/main.cpp @ 115

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

1) Write queue with mealy
2) Network : fix bug
3) leak memory

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1/*
2 * $Id: main.cpp 115 2009-04-20 21:29:17Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit/SelfTest/include/test.h"
9
10#define NB_PARAMS 2
11
12void usage (int argc, char * argv[])
13{
14  err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
15  err (_("list_params is :\n"));
16  err (_(" * nb_front_end                     (uint32_t)\n"));
17  err (_(" * nb_context        [nb_front_end] (uint32_t)\n"));
18  err (_(" * nb_inst_reexecute                (uint32_t)\n"));
19 
20  exit (1);
21}
22
23#ifndef SYSTEMC
24int main    (int argc, char * argv[])
25#else
26int sc_main (int argc, char * argv[])
27#endif
28{
29  if (argc <= static_cast<int>(2+NB_PARAMS))
30    usage (argc, argv);
31
32  uint32_t x = 1;
33
34  string name = argv[x++];
35
36  uint32_t     _nb_front_end          = fromString<uint32_t>(argv[x++]);
37
38  if (argc != static_cast<int>(2+NB_PARAMS+_nb_front_end))
39    usage (argc, argv);
40
41  uint32_t   * _nb_context            = new uint32_t [_nb_front_end];
42  for (uint32_t i=0; i<_nb_front_end; i++)
43    _nb_context [i] = fromString<uint32_t>(argv[x++]);
44
45  uint32_t     _nb_inst_reexecute     = fromString<uint32_t>(argv[x++]);
46
47  bool     *** _implement_group       = new bool ** [_nb_front_end];
48  for (uint32_t i=0; i<_nb_front_end; i++)
49    {
50      _implement_group [i] = new bool * [_nb_context[i]];
51      for (uint32_t j=0; j<_nb_context[i]; j++)
52        {
53          _implement_group [i][j] = new bool [NB_GROUP];
54
55          for (uint32_t k=0; k<NB_GROUP; k++)
56            _implement_group [i][j][k] = false;
57
58          _implement_group [i][j][GROUP_SYSTEM_AND_CONTROL] = true;
59          _implement_group [i][j][GROUP_DCACHE            ] = true;
60        }
61    }
62
63  int _return = EXIT_SUCCESS;
64  try 
65    {
66      morpheo::behavioural::core::multi_ooo_engine::ooo_engine::special_register_unit::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::special_register_unit::Parameters
67        (
68         _nb_front_end      ,
69         _nb_context        ,
70         _nb_inst_reexecute ,
71         _implement_group   ,
72         true //is_toplevel
73        );
74     
75      msg(_("%s"),param->print(0).c_str());
76     
77      test (name,param);
78
79      delete param;
80    }
81  catch (morpheo::ErrorMorpheo & error)
82    {
83      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
84      _return = EXIT_FAILURE;
85    }
86 
87  try 
88    {
89      if (_return == EXIT_SUCCESS)
90        TEST_OK("Special_Register_unit : no error");
91      else
92        TEST_KO("Special_Register_unit : a lot of error");
93    }
94  catch (morpheo::ErrorMorpheo & error)
95    {
96//       msg (_("<%s> :\n%s"),name.c_str(), error.what ());
97      _return = EXIT_FAILURE;
98    }
99
100  for (uint32_t i=0; i<_nb_front_end; i++)
101    {
102      for (uint32_t j=0; j<_nb_context[i]; j++)
103        delete [] _implement_group [i][j];
104      delete [] _implement_group [i];
105    }
106  delete [] _implement_group;
107
108  delete [] _nb_context;
109
110  return (_return);
111}
Note: See TracBrowser for help on using the repository browser.