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

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

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 2.9 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_Execute_loop/Execute_loop/Register_unit/Register_unit_Glue/SelfTest/include/test.h"
9
10#define NB_PARAMS 7
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_spr_read                               (uint32_t)" << endl
21       << " - nb_gpr_write                              (uint32_t)" << endl
22       << " - nb_spr_write                              (uint32_t)" << endl
23       << " - nb_inst_insert_rob        [nb_ooo_engine] (uint32_t)" << endl
24       << " - nb_inst_retire_rob        [nb_ooo_engine] (uint32_t)" << endl
25       << "" << endl;
26 
27  for (int i=0; i<argc; i++)
28    cerr << argv[i] << " ";
29  cerr << endl;
30
31  exit (1);
32}
33
34#ifndef SYSTEMC
35int main    (int argc, char * argv[])
36#else
37int sc_main (int argc, char * argv[])
38#endif
39{
40  if (argc < 2+NB_PARAMS)
41    usage (argc, argv);
42
43  uint32_t     x = 1;
44
45  string       name                 =      argv[x++];
46  uint32_t    _nb_ooo_engine        = atoi(argv[x++]);
47  uint32_t    _size_general_data    = atoi(argv[x++]);
48  uint32_t    _size_special_data    = atoi(argv[x++]);
49  uint32_t    _nb_gpr_read          = atoi(argv[x++]);
50  uint32_t    _nb_spr_read          = atoi(argv[x++]);   
51  uint32_t    _nb_gpr_write         = atoi(argv[x++]);
52  uint32_t    _nb_spr_write         = atoi(argv[x++]);
53
54  if (argc != 2+NB_PARAMS+static_cast<int>(2*_nb_ooo_engine))
55    usage (argc, argv);
56 
57  uint32_t  * _nb_inst_insert_rob = new uint32_t [_nb_ooo_engine];
58  uint32_t  * _nb_inst_retire_rob = new uint32_t [_nb_ooo_engine];
59
60  for (uint32_t i=0; i<_nb_ooo_engine; i++)
61    _nb_inst_insert_rob  [i] = atoi(argv[x++]);
62  for (uint32_t i=0; i<_nb_ooo_engine; i++)
63    _nb_inst_retire_rob  [i] = atoi(argv[x++]);
64
65  try 
66    {
67      morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::register_unit_glue::Parameters * param = new morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::register_unit_glue::Parameters
68        (_nb_ooo_engine    ,
69         _size_general_data,
70         _size_special_data,
71         _nb_gpr_read      ,
72         _nb_spr_read      ,
73         _nb_gpr_write     ,
74         _nb_spr_write     ,
75         _nb_inst_insert_rob,
76         _nb_inst_retire_rob,
77         true //is_toplevel
78         );
79     
80      cout << param->print(1);
81     
82      test (name,param);
83    }
84  catch (morpheo::ErrorMorpheo & error)
85    {
86      cout << "<" << name << "> : " <<  error.what ();
87      exit (EXIT_FAILURE);
88    }
89  catch (...)
90    {
91      cerr << "<" << name << "> : This test must generate a error" << endl;
92      exit (EXIT_FAILURE);
93    }
94
95  return (EXIT_SUCCESS);
96}
97
Note: See TracBrowser for help on using the repository browser.