source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/SelfTest/src/main.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 16 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1/*
2 * $Id: main.cpp 88 2008-12-10 18:31:39Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/SelfTest/include/test.h"
9
10#define NB_PARAMS 4
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_load_store_queue                                        (uint32_t)\n"));
19  err (_(" * size_store_queue                 [nb_load_store_queue]     (uint32_t)\n"));
20  err (_(" * size_load_queue                  [nb_load_store_queue]     (uint32_t)\n"));
21  err (_(" * link_load_store_unit_with_thread [nb_front_end][nb_context](uint32_t)\n"));
22  err (_(" * nb_inst_insert                                             (uint32_t)\n"));
23  err (_(" * nb_inst_retire                                             (uint32_t)\n"));
24  exit (1);
25}
26
27#ifndef SYSTEMC
28int main    (int argc, char * argv[])
29#else
30int sc_main (int argc, char * argv[])
31#endif
32{
33  if (argc < static_cast<int>(2+NB_PARAMS))
34    usage (argc, argv);
35
36  uint32_t x = 1;
37
38  string name = argv[x++];
39
40  uint32_t    _nb_front_end                     = atoi(argv[x++]);
41
42  if (argc < static_cast<int>(2+NB_PARAMS+_nb_front_end))
43    usage (argc, argv);
44
45  uint32_t  * _nb_context                       = new uint32_t [_nb_front_end];
46  uint32_t    nb_thread = 0;
47  for (uint32_t i=0; i<_nb_front_end; i++)
48    {
49      _nb_context [i] = atoi(argv[x++]);
50      nb_thread += _nb_context [i];
51    }
52
53  uint32_t    _nb_load_store_queue              = fromString<uint32_t>(argv[x++]);
54 
55  if (argc != static_cast<int>(2+NB_PARAMS+_nb_front_end+2*_nb_load_store_queue+nb_thread))
56    usage (argc, argv);
57
58  uint32_t  * _size_store_queue                 = new uint32_t [_nb_load_store_queue];
59  uint32_t  * _size_load_queue                  = new uint32_t [_nb_load_store_queue];
60 
61  for (uint32_t i=0; i<_nb_load_store_queue; i++)
62    _size_store_queue [i] = atoi(argv[x++]);
63  for (uint32_t i=0; i<_nb_load_store_queue; i++)
64    _size_load_queue  [i] = atoi(argv[x++]);
65 
66  uint32_t ** _link_load_store_unit_with_thread = new uint32_t * [_nb_front_end];
67  for (uint32_t i=0; i<_nb_front_end; i++)
68    {
69      _link_load_store_unit_with_thread [i] = new uint32_t [_nb_context[i]];
70      for (uint32_t j=0; j<_nb_context[i]; j++)
71        _link_load_store_unit_with_thread [i][j] = atoi(argv[x++]);
72    }
73
74  uint32_t _nb_inst_insert = atoi(argv[x++]);
75  uint32_t _nb_inst_retire = atoi(argv[x++]);
76
77  int _return = EXIT_SUCCESS;
78  try 
79    {
80      morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters
81        (_nb_front_end                    ,
82         _nb_context                      ,
83         _nb_load_store_queue             ,
84         _size_store_queue                ,
85         _size_load_queue                 ,
86         _link_load_store_unit_with_thread,
87         _nb_inst_insert                  ,
88         _nb_inst_retire                  ,
89         true //is_toplevel
90         );
91     
92      msg(_("%s"),param->print(1).c_str());
93     
94      test (name,param);
95    }
96  catch (morpheo::ErrorMorpheo & error)
97    {
98      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
99      _return = EXIT_FAILURE;
100    }
101  catch (...)
102    {
103      err (_("<%s> : This test must generate a error.\n"),name.c_str());
104      _return = EXIT_FAILURE;
105    }
106
107  return (_return);
108}
Note: See TracBrowser for help on using the repository browser.