source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/src/main.cpp @ 83

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

Add component : Context_State (manage miss prediction, exception , decod_enable, synchronisation instruction ...)

  • Property svn:keywords set to Id
File size: 4.0 KB
Line 
1/*
2 * $Id: main.cpp 83 2008-05-09 18:00:21Z rosiere $
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Core/Multi_Front_end/Front_end/Context_State/SelfTest/include/test.h"
9
10#define NB_PARAMS 5
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_decod_unit                                 (uint32_t)\n"));
18  err (_(" * nb_ooo_engine                                 (uint32_t)\n"));
19  err (_(" * nb_inst_branch_complete                       (uint32_t)\n"));
20  err (_(" * size_depth                    [nb_context]    (uint32_t)\n"));
21  err (_(" * size_address                                  (uint32_t)\n"));
22  err (_(" * size_inst_decod               [nb_decod_unit] (uint32_t)\n"));
23  err (_(" * size_inst_commit              [nb_ooo_engine] (uint32_t)\n"));
24  err (_(" * link_context_to_decod_unit    [nb_context]    (uint32_t)\n"));
25  err (_(" * link_decod_unit_to_ooo_engine [nb_decod_unit] (uint32_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//const uint32_t size_data = atoi(argv[x++]);
43//const uint32_t nb_port   = atoi(argv[x++]);
44
45  uint32_t   _nb_context              = fromString<uint32_t>(argv[x++]);
46  uint32_t   _nb_decod_unit           = fromString<uint32_t>(argv[x++]);
47  uint32_t   _nb_ooo_engine           = fromString<uint32_t>(argv[x++]);
48  uint32_t   _nb_inst_branch_complete = fromString<uint32_t>(argv[x++]);
49
50  if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context+2*_nb_decod_unit+1*_nb_ooo_engine))
51    usage (argc, argv);
52
53  uint32_t * _size_depth                    = new uint32_t [_nb_context];
54  for (uint32_t i=0; i<_nb_context; i++)
55    _size_depth [i] = fromString<uint32_t>(argv[x++]);
56
57  uint32_t   _size_address  = fromString<uint32_t>(argv[x++]);
58
59  uint32_t * _size_inst_decod               = new uint32_t [_nb_decod_unit];
60  for (uint32_t i=0; i<_nb_decod_unit; i++)
61    _size_inst_decod [i] = fromString<uint32_t>(argv[x++]);
62  uint32_t * _size_inst_commit              = new uint32_t [_nb_ooo_engine];
63  for (uint32_t i=0; i<_nb_ooo_engine; i++)
64    _size_inst_commit [i] = fromString<uint32_t>(argv[x++]);
65  uint32_t * _link_context_to_decod_unit    = new uint32_t [_nb_context];
66  for (uint32_t i=0; i<_nb_context; i++)
67    _link_context_to_decod_unit [i] = fromString<uint32_t>(argv[x++]);
68  uint32_t * _link_decod_unit_to_ooo_engine = new uint32_t [_nb_decod_unit];
69  for (uint32_t i=0; i<_nb_decod_unit; i++)
70    _link_decod_unit_to_ooo_engine [i] = fromString<uint32_t>(argv[x++]);
71
72  int _return = EXIT_SUCCESS;
73  try 
74    {
75      morpheo::behavioural::core::multi_front_end::front_end::context_state::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::context_state::Parameters
76        (_nb_context                   ,
77         _nb_decod_unit                ,
78         _nb_ooo_engine                ,
79         _nb_inst_branch_complete      ,
80         _size_depth                   ,
81         _size_address                 ,
82         _size_inst_decod              ,
83         _size_inst_commit             ,
84         _link_context_to_decod_unit   ,
85         _link_decod_unit_to_ooo_engine
86         );
87     
88      msg(_("%s"),param->print(1).c_str());
89     
90      test (name,param);
91    }
92  catch (morpheo::ErrorMorpheo & error)
93    {
94      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
95      _return = EXIT_FAILURE;
96    }
97
98  delete [] _size_depth;                   
99  delete [] _size_inst_decod;             
100  delete [] _size_inst_commit;             
101  delete [] _link_context_to_decod_unit;   
102  delete [] _link_decod_unit_to_ooo_engine;
103
104  try 
105    {
106      if (_return == EXIT_SUCCESS)
107        TEST_OK("Context_State : no error");
108      else
109        TEST_KO("Context_State : a lot of error");
110    }
111  catch (morpheo::ErrorMorpheo & error)
112    {
113      msg (_("<%s> :\n%s\n"),name.c_str(), error.what ());
114      _return = EXIT_FAILURE;
115    }
116
117  return (_return);
118}
Note: See TracBrowser for help on using the repository browser.