source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/SelfTest/src/main.cpp @ 131

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

1) add constant method
2) test with systemc 2.2.0

  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1/*
2 * $Id: main.cpp 131 2009-07-08 18:40:08Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/SelfTest/include/test.h"
9
10#define NB_PARAMS 13
11
12void usage (int argc, char * argv[])
13{
14  cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl
15       << "list_params is :" << endl
16       << " - nb_ooo_engine                             (uint32_t)" << endl
17       << " - size_general_data                         (uint32_t)" << endl
18       << " - size_special_data                         (uint32_t)" << endl
19       << " - nb_gpr_read                               (uint32_t)" << endl
20       << " - nb_gpr_write                              (uint32_t)" << endl
21       << " - nb_gpr_bank                               (uint32_t)" << endl
22       << " - nb_gpr_port_read_by_bank                  (uint32_t)" << endl
23       << " - nb_gpr_port_write_by_bank                 (uint32_t)" << endl
24       << " - nb_spr_read                               (uint32_t)" << endl
25       << " - nb_spr_write                              (uint32_t)" << endl
26       << " - nb_spr_bank                               (uint32_t)" << endl
27       << " - nb_spr_port_read_by_bank                  (uint32_t)" << endl
28       << " - nb_spr_port_write_by_bank                 (uint32_t)" << endl
29       << " - nb_general_register       [nb_ooo_engine] (uint32_t)" << endl
30       << " - nb_special_register       [nb_ooo_engine] (uint32_t)" << endl
31       << " - nb_inst_insert_rob        [nb_ooo_engine] (uint32_t)" << endl
32       << " - nb_inst_retire_rob        [nb_ooo_engine] (uint32_t)" << endl
33       << "" << endl;
34
35  for (int i=0; i<argc; i++)
36    cerr << argv[i] << " ";
37  cerr << endl;
38
39  exit (1);
40}
41
42#ifndef SYSTEMC
43int main    (int argc, char * argv[])
44#else
45int sc_main (int argc, char * argv[])
46#endif
47{
48  if (argc < 2+NB_PARAMS)
49    usage (argc, argv);
50
51  const string   name      = argv[1];
52//const uint32_t size_data = atoi(argv[2]);
53//const uint32_t nb_port   = atoi(argv[3]);
54  uint32_t    _nb_ooo_engine             = atoi(argv[ 2]);
55  uint32_t    _size_general_data         = atoi(argv[ 3]);
56  uint32_t    _size_special_data         = atoi(argv[ 4]);
57  uint32_t    _nb_gpr_read               = atoi(argv[ 5]);
58  uint32_t    _nb_gpr_write              = atoi(argv[ 6]);
59  uint32_t    _nb_gpr_bank               = atoi(argv[ 7]);
60  uint32_t    _nb_gpr_port_read_by_bank  = atoi(argv[ 8]);
61  uint32_t    _nb_gpr_port_write_by_bank = atoi(argv[ 9]);
62  uint32_t    _nb_spr_read               = atoi(argv[10]);
63  uint32_t    _nb_spr_write              = atoi(argv[11]);
64  uint32_t    _nb_spr_bank               = atoi(argv[12]);
65  uint32_t    _nb_spr_port_read_by_bank  = atoi(argv[13]);
66  uint32_t    _nb_spr_port_write_by_bank = atoi(argv[14]);
67 
68  if (argc != 2+NB_PARAMS+static_cast<int>(4*_nb_ooo_engine))
69    usage (argc, argv);
70 
71  uint32_t  * _nb_general_register       = new uint32_t [_nb_ooo_engine];
72  uint32_t  * _nb_special_register       = new uint32_t [_nb_ooo_engine];
73  uint32_t  * _nb_inst_insert_rob        = new uint32_t [_nb_ooo_engine];
74  uint32_t  * _nb_inst_retire_rob        = new uint32_t [_nb_ooo_engine];
75
76  uint32_t    x = 15;
77
78  for (uint32_t i=0; i<_nb_ooo_engine; i++)
79    _nb_general_register [i] = atoi(argv[x++]);
80  for (uint32_t i=0; i<_nb_ooo_engine; i++)
81    _nb_special_register [i] = atoi(argv[x++]);
82  for (uint32_t i=0; i<_nb_ooo_engine; i++)
83    _nb_inst_insert_rob  [i] = atoi(argv[x++]);
84  for (uint32_t i=0; i<_nb_ooo_engine; i++)
85    _nb_inst_retire_rob  [i] = atoi(argv[x++]);
86 
87  int _return = EXIT_SUCCESS;
88  try 
89    {
90      morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters * param = new morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters
91        (_nb_ooo_engine             ,
92         _size_general_data         ,
93         _size_special_data         ,
94         _nb_gpr_read               ,
95         _nb_gpr_write              ,
96         _nb_gpr_bank               ,
97         _nb_gpr_port_read_by_bank  ,
98         _nb_gpr_port_write_by_bank ,
99         _nb_spr_read               ,
100         _nb_spr_write              ,
101         _nb_spr_bank               ,
102         _nb_spr_port_read_by_bank  ,
103         _nb_spr_port_write_by_bank ,
104         _nb_general_register       ,
105         _nb_special_register       ,
106         _nb_inst_insert_rob        ,
107         _nb_inst_retire_rob        ,
108         true //is_toplevel
109         );
110     
111      cout << param->print(1);
112     
113      test (name,param);
114    }
115  catch (morpheo::ErrorMorpheo & error)
116    {
117      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
118      _return = EXIT_FAILURE;
119    }
120
121  try 
122    {
123      if (_return == EXIT_SUCCESS)
124        TEST_OK("OOO_Engine : no error");
125      else
126        TEST_KO("OOO_Engine : a lot of error");
127    }
128  catch (morpheo::ErrorMorpheo & error)
129    {
130//       msg (_("<%s> :\n%s"),name.c_str(), error.what ());
131      _return = EXIT_FAILURE;
132    }
133
134  return (_return);
135}
136
Note: See TracBrowser for help on using the repository browser.