source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Branch_Target_Buffer/SelfTest/src/main.cpp @ 88

Last change on this file since 88 was 88, checked in by rosiere, 15 years ago

Almost complete design
with Test and test platform

  • Property svn:keywords set to Id
File size: 2.7 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/Prediction_unit/Branch_Target_Buffer/SelfTest/include/test.h"
9
10#define NB_PARAMS 9
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 (_(" * size_buffer     (uint32_t )\n"));
18  err (_(" * associativity   (uint32_t )\n"));
19  err (_(" * size_address    (uint32_t )\n"));
20  err (_(" * size_counter    (uint32_t )\n"));
21  err (_(" * nb_inst_predict (uint32_t )\n"));
22  err (_(" * nb_inst_decod   (uint32_t )\n"));
23  err (_(" * nb_inst_commit  (uint32_t )\n"));
24  err (_(" * victim_scheme   (Tvictim_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+_nb_context))
44    usage (argc, argv);
45
46  uint32_t * _nb_instruction  = new uint32_t [_nb_context];
47  for (uint32_t i=0; i<_nb_context; i++)
48    _nb_instruction [i] = fromString<uint32_t>(argv[x++]);
49
50  uint32_t   _size_buffer     = fromString<uint32_t >(argv[x++]);
51  uint32_t   _associativity   = fromString<uint32_t >(argv[x++]);
52  uint32_t   _size_address    = fromString<uint32_t >(argv[x++]);
53  uint32_t   _size_counter    = fromString<uint32_t >(argv[x++]);
54  uint32_t   _nb_inst_predict = fromString<uint32_t >(argv[x++]);
55  uint32_t   _nb_inst_decod   = fromString<uint32_t >(argv[x++]);
56  uint32_t   _nb_inst_commit  = fromString<uint32_t >(argv[x++]);
57  Tvictim_t  _victim_scheme   = fromString<Tvictim_t>(argv[x++]);
58
59  int _return = EXIT_SUCCESS;
60  try 
61    {
62      morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::Parameters
63        (_nb_context     ,
64         _nb_instruction ,
65         _size_buffer    ,
66         _associativity  ,
67         _size_address   ,
68         _size_counter   ,
69         _nb_inst_predict,
70         _nb_inst_decod  ,
71         _nb_inst_commit ,
72         _victim_scheme  ,
73         true // is_toplevel
74         );
75     
76      msg(_("%s"),param->print(1).c_str());
77     
78      test (name,param);
79    }
80  catch (morpheo::ErrorMorpheo & error)
81    {
82      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
83      _return = EXIT_FAILURE;
84    }
85  catch (...)
86    {
87      err (_("<%s> : This test must generate a error.\n"),name.c_str());
88      _return = EXIT_FAILURE;
89    }
90
91  delete _nb_instruction;
92
93  return (_return);
94}
Note: See TracBrowser for help on using the repository browser.