source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/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: 6.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_OOO_Engine/OOO_Engine/Rename_unit/SelfTest/include/test.h"
9
10#define NB_PARAMS 14
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_front_end                                                 (uint32_t         )\n"));
17  err (_(" * nb_context                        [nb_front_end]             (uint32_t         )\n"));
18  err (_(" * nb_inst_decod                     [nb_front_end]             (uint32_t         )\n"));
19  err (_(" * nb_inst_insert                                               (uint32_t         )\n"));
20  err (_(" * nb_inst_retire                                               (uint32_t         )\n"));
21  err (_(" * nb_load_store_queue                                          (uint32_t         )\n"));
22  err (_(" * size_store_queue                  [nb_load_store_queue]      (uint32_t         )\n"));
23  err (_(" * size_load_queue                   [nb_load_store_queue]      (uint32_t         )\n"));
24  err (_(" * link_load_store_unit_with_thread  [nb_front_end][nb_context] (uint32_t         )\n"));
25  err (_(" * rename_select_priority                                       (Tpriority_t      )\n"));
26  err (_(" * rename_select_load_balancing                                 (Tload_balancing_t)\n"));
27  err (_(" * rename_select_nb_front_end_select                            (uint32_t         )\n"));
28  err (_(" * max_branch_speculated                                        (uint32_t         )\n"));
29  err (_(" * size_general_data                                            (uint32_t         )\n"));
30  err (_(" * nb_general_register                                          (uint32_t         )\n"));
31  err (_(" * nb_special_register                                          (uint32_t         )\n"));
32  err (_(" * nb_reg_free                                                  (uint32_t         )\n"));
33  err (_(" * nb_bank                                                      (uint32_t         )\n"));
34  err (_(" * size_read_counter                                            (uint32_t         )\n"));
35
36  exit (1);
37}
38
39#ifndef SYSTEMC
40int main    (int argc, char * argv[])
41#else
42int sc_main (int argc, char * argv[])
43#endif
44{
45  if (argc <= static_cast<int>(2+NB_PARAMS))
46    usage (argc, argv);
47
48  uint32_t x = 1;
49
50  string name = argv[x++];
51
52  uint32_t             _nb_front_end                      = fromString<uint32_t         >(argv[x++]);
53
54  if (argc <= static_cast<int>(2+NB_PARAMS+2*_nb_front_end))
55    usage (argc, argv);
56
57  uint32_t             _sum_nb_context = 0;
58
59  uint32_t           * _nb_context    = new uint32_t [_nb_front_end];
60  uint32_t           * _nb_inst_decod = new uint32_t [_nb_front_end];
61 
62  for (uint32_t i=0; i<_nb_front_end; i++)
63    {
64      _nb_context [i] = fromString<uint32_t>(argv[x++]);
65      _sum_nb_context += _nb_context [i];
66    }
67  for (uint32_t i=0; i<_nb_front_end; i++)
68    _nb_inst_decod [i] = fromString<uint32_t>(argv[x++]);
69  uint32_t             _nb_inst_insert                    = fromString<uint32_t         >(argv[x++]);
70  uint32_t             _nb_inst_retire                    = fromString<uint32_t         >(argv[x++]);
71  uint32_t             _nb_load_store_queue               = fromString<uint32_t         >(argv[x++]);
72
73  if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_front_end+2*_nb_load_store_queue+_sum_nb_context))
74    usage (argc, argv);
75
76  uint32_t           * _size_store_queue                  = new uint32_t [_nb_load_store_queue];
77  uint32_t           * _size_load_queue                   = new uint32_t [_nb_load_store_queue];
78
79  for (uint32_t i=0; i<_nb_load_store_queue; i++)
80    _size_store_queue [i] = fromString<uint32_t>(argv[x++]);
81  for (uint32_t i=0; i<_nb_load_store_queue; i++)
82    _size_load_queue  [i] = fromString<uint32_t>(argv[x++]);
83
84  uint32_t          ** _link_load_store_unit_with_thread  = new uint32_t * [_nb_front_end];
85  for (uint32_t i=0; i<_nb_front_end; i++)
86    {
87      _link_load_store_unit_with_thread [i] = new uint32_t [_nb_context[i]];
88      for (uint32_t j=0; j<_nb_context[i]; j++)
89        _link_load_store_unit_with_thread  [i][j] = fromString<uint32_t>(argv[x++]);
90    }
91
92  Tpriority_t          _rename_select_priority            = fromString<Tpriority_t      >(argv[x++]);
93  Tload_balancing_t    _rename_select_load_balancing      = fromString<Tload_balancing_t>(argv[x++]);
94  uint32_t             _rename_select_nb_front_end_select = fromString<uint32_t         >(argv[x++]);
95  uint32_t             _max_branch_speculated             = fromString<uint32_t         >(argv[x++]);
96  uint32_t             _size_general_data                 = fromString<uint32_t         >(argv[x++]);
97  uint32_t             _nb_general_register               = fromString<uint32_t         >(argv[x++]);
98  uint32_t             _nb_special_register               = fromString<uint32_t         >(argv[x++]);
99  uint32_t             _nb_reg_free                       = fromString<uint32_t         >(argv[x++]);
100  uint32_t             _nb_bank                           = fromString<uint32_t         >(argv[x++]);
101  uint32_t             _size_read_counter                 = fromString<uint32_t         >(argv[x++]);
102
103  int _return = EXIT_SUCCESS;
104  try 
105    {
106      morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::Parameters
107        (_nb_front_end                     ,
108         _nb_context                       ,
109         _nb_inst_decod                    ,
110         _nb_inst_insert                   ,
111         _nb_inst_retire                   ,
112         _nb_load_store_queue              ,
113         _size_store_queue                 ,
114         _size_load_queue                  ,
115         _link_load_store_unit_with_thread ,
116         _rename_select_priority           ,
117         _rename_select_load_balancing     ,
118         _rename_select_nb_front_end_select,
119         _max_branch_speculated            ,
120         _size_general_data                ,
121         _nb_general_register              ,
122         _nb_special_register              ,
123         _nb_reg_free                      ,
124         _nb_bank                          ,
125         _size_read_counter                ,
126         true //is_toplevel
127         );
128     
129      msg(_("%s"),param->print(0).c_str());
130     
131      test (name,param);
132    }
133  catch (morpheo::ErrorMorpheo & error)
134    {
135      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
136      _return = EXIT_FAILURE;
137    }
138
139  try 
140    {
141      if (_return == EXIT_SUCCESS)
142        TEST_OK("Rename_unit : no error");
143      else
144        TEST_KO("Rename_unit : a lot of error");
145    }
146  catch (morpheo::ErrorMorpheo & error)
147    {
148//       msg (_("<%s> :\n%s"),name.c_str(), error.what ());
149      _return = EXIT_FAILURE;
150    }
151
152  for (uint32_t i=0; i<_nb_front_end; i++)
153    delete [] _link_load_store_unit_with_thread [i];
154  delete [] _link_load_store_unit_with_thread;
155
156  delete [] _nb_inst_decod   ;
157  delete [] _size_store_queue;
158  delete [] _size_load_queue ;
159  delete [] _nb_context      ;
160
161  return (_return);
162}
Note: See TracBrowser for help on using the repository browser.