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

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

Add :

  • Execute_loop (must be test systemC)
  • Prediction
    • Direction : predifined scheme
    • Branch Target Buffer
  • iFetch_unit
    • ifetch_queue
    • pc management
  • Decod_unit
    • coming soon : support for custom operation
  • Rename_unit
    • RAT
    • Free_list
    • Dependence RAW check
    • Load store unit pointer
  • New Environnement (hierarchy_memory will remove in a next version)


Modif :

  • Manage Custom Operation
  • All component in execute_loop to use the new statistics management

Not Finish :

  • Return Address Stack
  • Environnement
File size: 2.6 KB
Line 
1/*
2 * $Id$
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     
74      msg(_("%s"),param->print(1).c_str());
75     
76      test (name,param);
77    }
78  catch (morpheo::ErrorMorpheo & error)
79    {
80      msg (_("<%s> :\n%s"),name.c_str(), error.what ());
81      _return = EXIT_FAILURE;
82    }
83  catch (...)
84    {
85      err (_("<%s> : This test must generate a error.\n"),name.c_str());
86      _return = EXIT_FAILURE;
87    }
88
89  delete _nb_instruction;
90
91  return (_return);
92}
Note: See TracBrowser for help on using the repository browser.