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

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

Decod :

  • Correct selftest
  • Set Instruction address on (32/64)-2 bits,
  • Decod Custom Instruction : valid and tested. (add an test to verify the decod information)
  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1/*
2 * $Id: main.cpp 86 2008-05-14 17:08:56Z 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 8
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                      (uint32_t         )\n"));
21  err (_(" * size_branch_update_prediction             (uint32_t         )\n"));
22  err (_(" * nb_context_select                         (uint32_t         )\n"));
23  err (_(" * size_general_data                         (uint32_t         )\n"));
24  err (_(" * priority                                  (Tpriority_t      )\n"));
25  err (_(" * load_balancing                            (Tload_balancing_t)\n"));
26
27  exit (1);
28}
29
30#ifndef SYSTEMC
31int main    (int argc, char * argv[])
32#else
33int sc_main (int argc, char * argv[])
34#endif
35{
36  if (argc < static_cast<int>(2+NB_PARAMS))
37    usage (argc, argv);
38
39  uint32_t x = 1;
40
41  string name = argv[x++];
42  uint32_t            _nb_context           = fromString<uint32_t         >(argv[x++]);
43
44  if (argc != static_cast<int>(2+NB_PARAMS+_nb_context))
45    usage (argc, argv);
46 
47  uint32_t          * _nb_inst_fetch        = new uint32_t [_nb_context];
48  for (uint32_t i=0;i<_nb_context; i++)
49    _nb_inst_fetch [i] = fromString<uint32_t>(argv[x++]);
50
51  uint32_t            _nb_inst_decod                = fromString<uint32_t         >(argv[x++]);
52  uint32_t            _nb_branch_speculated         = fromString<uint32_t         >(argv[x++]);
53  uint32_t            _size_branch_update_prediction= fromString<uint32_t         >(argv[x++]);
54  uint32_t            _nb_context_select            = fromString<uint32_t         >(argv[x++]);
55  uint32_t            _size_general_data            = fromString<uint32_t         >(argv[x++]);
56  Tpriority_t         _priority                     = fromString<Tpriority_t      >(argv[x++]);
57  Tload_balancing_t   _load_balancing               = fromString<Tload_balancing_t>(argv[x++]);
58
59  bool             ** _instruction_implemeted = new bool * [_nb_context];
60  for (uint32_t i=0; i<_nb_context; i++)
61    {
62      _instruction_implemeted [i] = new bool [NB_INSTRUCTION];
63     
64      for (uint32_t j=0; j<NB_INSTRUCTION; j++)
65        _instruction_implemeted [i][j] = true;
66    }
67
68  int _return = EXIT_SUCCESS;
69  try 
70    {
71      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
72        (_nb_context                   ,
73         _nb_inst_fetch                ,
74         _nb_inst_decod                ,
75         _nb_branch_speculated         ,
76         _size_branch_update_prediction,
77         _nb_context_select            ,
78         _size_general_data            ,
79         _priority                     ,
80         _load_balancing               ,
81         _instruction_implemeted       ,
82         &(morpheo::behavioural::custom::example_get_custom_information)
83);
84     
85      msg(_("%s"),param->print(1).c_str());
86     
87      test (name,param);
88    }
89  catch (morpheo::ErrorMorpheo & error)
90    {
91      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
92      _return = EXIT_FAILURE;
93    }
94  catch (...)
95    {
96      err (_("<%s> : This test must generate a error.\n"),name.c_str());
97      _return = EXIT_FAILURE;
98    }
99
100  delete _nb_inst_fetch;
101  delete _instruction_implemeted;
102  return (_return);
103}
Note: See TracBrowser for help on using the repository browser.