source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/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: 4.0 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_Front_end/Front_end/Decod_unit/Decod/SelfTest/include/test.h"
9#include "Behavioural/Custom/include/Custom_example.h"
10
11#define NB_PARAMS 6
12
13void usage (int argc, char * argv[])
14{
15  err (_("<Usage> %s name_instance list_params.\n"),argv[0]);
16  err (_("list_params is :\n"));
17  err (_(" * nb_context                                 (uint32_t         )\n"));
18  err (_(" * nb_inst_fetch                 [nb_context] (uint32_t         )\n"));
19  err (_(" * nb_inst_decod                              (uint32_t         )\n"));
20  err (_(" * nb_branch_speculated          [nb_context] (uint32_t         )\n"));
21  err (_(" * nb_context_select                          (uint32_t         )\n"));
22  err (_(" * size_general_data                          (uint32_t         )\n"));
23  err (_(" * priority                                   (Tpriority_t      )\n"));
24  err (_(" * load_balancing                             (Tload_balancing_t)\n"));
25
26  exit (1);
27}
28
29#ifndef SYSTEMC
30int main    (int argc, char * argv[])
31#else
32int sc_main (int argc, char * argv[])
33#endif
34{
35  if (argc < static_cast<int>(2+NB_PARAMS))
36    usage (argc, argv);
37
38  uint32_t x = 1;
39
40  string name = argv[x++];
41  uint32_t            _nb_context           = fromString<uint32_t         >(argv[x++]);
42
43  if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context))
44    usage (argc, argv);
45 
46  uint32_t          * _nb_inst_fetch                = new uint32_t [_nb_context];
47  for (uint32_t i=0;i<_nb_context; i++)
48    _nb_inst_fetch [i] = fromString<uint32_t>(argv[x++]);
49
50  uint32_t            _nb_inst_decod                = fromString<uint32_t         >(argv[x++]);
51
52  uint32_t          * _nb_branch_speculated         = new uint32_t [_nb_context];
53  for (uint32_t i=0;i<_nb_context; i++)
54    _nb_branch_speculated [i] = fromString<uint32_t>(argv[x++]);
55
56//   uint32_t          * _size_branch_update_prediction= new uint32_t [_nb_context];
57//   for (uint32_t i=0;i<_nb_context; i++)
58//     _size_branch_update_prediction[i] = fromString<uint32_t>(argv[x++]);
59
60  uint32_t            _nb_context_select            = fromString<uint32_t         >(argv[x++]);
61  uint32_t            _size_general_data            = fromString<uint32_t         >(argv[x++]);
62  Tpriority_t         _priority                     = fromString<Tpriority_t      >(argv[x++]);
63  Tload_balancing_t   _load_balancing               = fromString<Tload_balancing_t>(argv[x++]);
64
65  bool             ** _instruction_implemeted = new bool * [_nb_context];
66  for (uint32_t i=0; i<_nb_context; i++)
67    {
68      _instruction_implemeted [i] = new bool [NB_INSTRUCTION];
69     
70      for (uint32_t j=0; j<NB_INSTRUCTION; j++)
71        _instruction_implemeted [i][j] = true;
72    }
73
74  int _return = EXIT_SUCCESS;
75  try 
76    {
77      morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod::Parameters
78        (_nb_context                   ,
79         _nb_inst_fetch                ,
80         _nb_inst_decod                ,
81         _nb_branch_speculated         ,
82//          _size_branch_update_prediction,
83         _nb_context_select            ,
84         _size_general_data            ,
85         _priority                     ,
86         _load_balancing               ,
87         _instruction_implemeted       ,
88         &(morpheo::behavioural::custom::example_get_custom_information),
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  delete _nb_inst_fetch;
108  delete _instruction_implemeted;
109  delete _nb_branch_speculated;
110//   delete _size_branch_update_prediction;
111
112  return (_return);
113}
Note: See TracBrowser for help on using the repository browser.