source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/SelfTest/src/main.cpp @ 82

Last change on this file since 82 was 82, checked in by rosiere, 16 years ago
  • support locale (now must "just" translate)
  • update all component with new test format
  • update all component with usage
  • New component : decod queue and prediction_unit
  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/*
2 * $Id: main.cpp 82 2008-05-01 16:48:45Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/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_context                        (uint32_t)\n"));
17  err (_(" * nb_inst_decod                     (uint32_t)\n"));
18  err (_(" * size_queue                        (uint32_t)\n"));
19  err (_(" * size_general_data                 (uint32_t)\n"));
20  err (_(" * nb_branch_speculated [nb_context] (uint32_t)\n"));
21
22  exit (1);
23}
24
25#ifndef SYSTEMC
26int main    (int argc, char * argv[])
27#else
28int sc_main (int argc, char * argv[])
29#endif
30{
31  if (argc < static_cast<int>(2+NB_PARAMS))
32    usage (argc, argv);
33
34  uint32_t x = 1;
35
36  string name = argv[x++];
37  uint32_t _nb_context        = fromString<uint32_t>(argv[x++]);
38  uint32_t _nb_inst_decod     = fromString<uint32_t>(argv[x++]);
39  uint32_t _size_queue        = fromString<uint32_t>(argv[x++]);
40  uint32_t _size_general_data = fromString<uint32_t>(argv[x++]);
41
42  if (argc != static_cast<int>(2+NB_PARAMS+_nb_context))
43    usage (argc, argv);
44
45  uint32_t * _nb_branch_speculated = new uint32_t [_nb_context];
46  for (uint32_t i=0; i<_nb_context; i++)
47    _nb_branch_speculated [i] = fromString<uint32_t>(argv[x++]);
48
49  int _return = EXIT_SUCCESS;
50  try 
51    {
52      morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod_queue::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod_queue::Parameters
53        (_nb_context       ,
54         _nb_inst_decod    ,
55         _size_queue       ,
56         _size_general_data,
57         _nb_branch_speculated);
58     
59      msg(_("%s"),param->print(1).c_str());
60     
61      test (name,param);
62    }
63  catch (morpheo::ErrorMorpheo & error)
64    {
65      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
66      _return = EXIT_FAILURE;
67    }
68  catch (...)
69    {
70      err (_("<%s> : This test must generate a error.\n"),name.c_str());
71      _return = EXIT_FAILURE;
72    }
73
74  delete [] _nb_branch_speculated;
75
76  return (_return);
77}
Note: See TracBrowser for help on using the repository browser.