source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest/src/main.cpp @ 4

Last change on this file since 4 was 4, checked in by rosiere, 17 years ago
File size: 3.9 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Meta_Predictor_Glue/SelfTest/include/test.h"
9
10#define NB_PARAMS 15
11
12void usage (string exec)
13{
14  cerr << "<Usage> " << exec << " name_instance list_params" << endl
15       << "list_params is :" << endl
16       << " - have_meta_predictor                (bool    )" << endl
17       << " - predictor_0_have_bht               (bool    )" << endl
18       << " - predictor_0_bht_size_shifter       (uint32_t)" << endl
19       << " - predictor_0_have_pht               (bool    )" << endl
20       << " - predictor_0_pht_size_counter       (uint32_t)" << endl
21       << " - predictor_1_have_bht               (bool    )" << endl
22       << " - predictor_1_bht_size_shifter       (uint32_t)" << endl
23       << " - predictor_1_have_pht               (bool    )" << endl
24       << " - predictor_1_pht_size_counter       (uint32_t)" << endl
25       << " - predictor_2_have_bht               (bool    )" << endl
26       << " - predictor_2_bht_size_shifter       (uint32_t)" << endl
27       << " - predictor_2_have_pht               (bool    )" << endl
28       << " - predictor_2_pht_size_counter       (uint32_t)" << endl
29       << " - nb_prediction                      (uint32_t)" << endl
30       << " - nb_branch_complete                 (uint32_t)" << endl;
31
32  exit (1);
33}
34
35#ifndef SYSTEMC
36int main    (int argc, char * argv[])
37#else
38int sc_main (int argc, char * argv[])
39#endif
40{
41  if (argc != 2+NB_PARAMS)
42    usage (argv[0]);
43
44  const string   name      = argv[1];
45
46  const bool     have_meta_predictor               = atoi(argv[ 2]);
47
48  const bool     predictor_0_have_bht              = atoi(argv[ 3]);
49  const uint32_t predictor_0_bht_size_shifter      = atoi(argv[ 4]);
50  const bool     predictor_0_have_pht              = atoi(argv[ 5]);
51  const uint32_t predictor_0_pht_size_counter      = atoi(argv[ 6]);
52
53  const bool     predictor_1_have_bht              = atoi(argv[ 7]);
54  const uint32_t predictor_1_bht_size_shifter      = atoi(argv[ 8]);
55  const bool     predictor_1_have_pht              = atoi(argv[ 9]);
56  const uint32_t predictor_1_pht_size_counter      = atoi(argv[10]);
57
58  const bool     predictor_2_have_bht              = atoi(argv[11]);
59  const uint32_t predictor_2_bht_size_shifter      = atoi(argv[12]);
60  const bool     predictor_2_have_pht              = atoi(argv[13]);
61  const uint32_t predictor_2_pht_size_counter      = atoi(argv[14]);
62
63  const uint32_t nb_prediction                     = atoi(argv[15]);
64  const uint32_t nb_branch_complete                = atoi(argv[16]);
65
66  try 
67    {
68      morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::meta_predictor_glue::Parameters param (have_meta_predictor               ,
69                                                                                                              predictor_0_have_bht              ,
70                                                                                                              predictor_0_bht_size_shifter      ,
71                                                                                                              predictor_0_have_pht              ,
72                                                                                                              predictor_0_pht_size_counter      ,
73                                                                                                             
74                                                                                                              predictor_1_have_bht              ,
75                                                                                                              predictor_1_bht_size_shifter      ,
76                                                                                                              predictor_1_have_pht              ,
77                                                                                                              predictor_1_pht_size_counter      ,
78                                                                                                             
79                                                                                                              predictor_2_have_bht              ,
80                                                                                                              predictor_2_bht_size_shifter      ,
81                                                                                                              predictor_2_have_pht              ,
82                                                                                                              predictor_2_pht_size_counter      ,
83                                                                                                             
84                                                                                                              nb_prediction                     ,
85                                                                                                              nb_branch_complete                );
86     
87      cout << param.print(1);
88     
89      test (name,param);
90    }
91  catch (morpheo::ErrorMorpheo & error)
92    {
93      cout << "<" << name << "> : " <<  error.what ();
94      exit (EXIT_FAILURE);
95    }
96  catch (...)
97    {
98      cerr << "<" << name << "> : This test must generate a error" << endl;
99      exit (EXIT_FAILURE);
100    }
101
102  return (EXIT_SUCCESS);
103}
104
Note: See TracBrowser for help on using the repository browser.