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

Last change on this file since 5 was 5, checked in by rosiere, 17 years ago

Ajout du composant Meta_Predictor

File size: 5.5 KB
Line 
1/*
2 * $Id$
3 *
4 * [ Description ]
5 *
6 */
7
8#include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/SelfTest/include/test.h"
9
10#define NB_PARAMS 25
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_bht_nb_shifter         (uint32_t)" << endl
20       << " - predictor_0_have_pht               (bool    )" << endl
21       << " - predictor_0_pht_size_counter       (uint32_t)" << endl
22       << " - predictor_0_pht_nb_counter         (uint32_t)" << endl
23       << " - predictor_0_pht_size_address_share (uint32_t)" << endl
24       << " - predictor_1_have_bht               (bool    )" << endl
25       << " - predictor_1_bht_size_shifter       (uint32_t)" << endl
26       << " - predictor_1_bht_nb_shifter         (uint32_t)" << endl
27       << " - predictor_1_have_pht               (bool    )" << endl
28       << " - predictor_1_pht_size_counter       (uint32_t)" << endl
29       << " - predictor_1_pht_nb_counter         (uint32_t)" << endl
30       << " - predictor_1_pht_size_address_share (uint32_t)" << endl
31       << " - predictor_2_have_bht               (bool    )" << endl
32       << " - predictor_2_bht_size_shifter       (uint32_t)" << endl
33       << " - predictor_2_bht_nb_shifter         (uint32_t)" << endl
34       << " - predictor_2_have_pht               (bool    )" << endl
35       << " - predictor_2_pht_size_counter       (uint32_t)" << endl
36       << " - predictor_2_pht_nb_counter         (uint32_t)" << endl
37       << " - predictor_2_pht_size_address_share (uint32_t)" << endl
38       << " - size_address                       (uint32_t)" << endl
39       << " - nb_prediction                      (uint32_t)" << endl
40       << " - nb_branch_complete                 (uint32_t)" << endl;
41
42  exit (1);
43}
44
45#ifndef SYSTEMC
46int main    (int argc, char * argv[])
47#else
48int sc_main (int argc, char * argv[])
49#endif
50{
51  if (argc != 2+NB_PARAMS)
52    usage (argv[0]);
53
54  const string   name                              = argv[1];
55
56  const bool     have_meta_predictor               = atoi(argv[ 2]);
57
58  const bool     predictor_0_have_bht              = atoi(argv[ 3]);
59  const uint32_t predictor_0_bht_size_shifter      = atoi(argv[ 4]);
60  const uint32_t predictor_0_bht_nb_shifter        = atoi(argv[ 5]);
61  const bool     predictor_0_have_pht              = atoi(argv[ 6]);
62  const uint32_t predictor_0_pht_size_counter      = atoi(argv[ 7]);
63  const uint32_t predictor_0_pht_nb_counter        = atoi(argv[ 8]);
64  const uint32_t predictor_0_pht_size_address_share= atoi(argv[ 9]);
65
66  const bool     predictor_1_have_bht              = atoi(argv[10]);
67  const uint32_t predictor_1_bht_size_shifter      = atoi(argv[11]);
68  const uint32_t predictor_1_bht_nb_shifter        = atoi(argv[12]);
69  const bool     predictor_1_have_pht              = atoi(argv[13]);
70  const uint32_t predictor_1_pht_size_counter      = atoi(argv[14]);
71  const uint32_t predictor_1_pht_nb_counter        = atoi(argv[15]);
72  const uint32_t predictor_1_pht_size_address_share= atoi(argv[16]);
73
74  const bool     predictor_2_have_bht              = atoi(argv[17]);
75  const uint32_t predictor_2_bht_size_shifter      = atoi(argv[18]);
76  const uint32_t predictor_2_bht_nb_shifter        = atoi(argv[19]);
77  const bool     predictor_2_have_pht              = atoi(argv[20]);
78  const uint32_t predictor_2_pht_size_counter      = atoi(argv[21]);
79  const uint32_t predictor_2_pht_nb_counter        = atoi(argv[22]);
80  const uint32_t predictor_2_pht_size_address_share= atoi(argv[23]);
81
82  const uint32_t size_address                      = atoi(argv[24]);
83  const uint32_t nb_prediction                     = atoi(argv[25]);
84  const uint32_t nb_branch_complete                = atoi(argv[26]);
85
86  try 
87    {
88      morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::Parameters param (have_meta_predictor               ,
89                                                                                         predictor_0_have_bht              ,
90                                                                                         predictor_0_bht_size_shifter      ,
91                                                                                         predictor_0_bht_nb_shifter        ,
92                                                                                         predictor_0_have_pht              ,
93                                                                                         predictor_0_pht_size_counter      ,
94                                                                                         predictor_0_pht_nb_counter        ,
95                                                                                         predictor_0_pht_size_address_share,
96                                                                                         predictor_1_have_bht              ,
97                                                                                         predictor_1_bht_size_shifter      ,
98                                                                                         predictor_1_bht_nb_shifter        ,
99                                                                                         predictor_1_have_pht              ,
100                                                                                         predictor_1_pht_size_counter      ,
101                                                                                         predictor_1_pht_nb_counter        ,
102                                                                                         predictor_1_pht_size_address_share,
103                                                                                         predictor_2_have_bht              ,
104                                                                                         predictor_2_bht_size_shifter      ,
105                                                                                         predictor_2_bht_nb_shifter        ,
106                                                                                         predictor_2_have_pht              ,
107                                                                                         predictor_2_pht_size_counter      ,
108                                                                                         predictor_2_pht_nb_counter        ,
109                                                                                         predictor_2_pht_size_address_share,
110                                                                                         size_address                      ,
111                                                                                         nb_prediction                     ,
112                                                                                         nb_branch_complete                );
113     
114      cout << param.print(1);
115     
116      test (name,param);
117    }
118  catch (morpheo::ErrorMorpheo & error)
119    {
120      cout << "<" << name << "> : " <<  error.what ();
121      exit (EXIT_FAILURE);
122    }
123  catch (...)
124    {
125      cerr << "<" << name << "> : This test must generate a error" << endl;
126      exit (EXIT_FAILURE);
127    }
128
129  return (EXIT_SUCCESS);
130}
131
Note: See TracBrowser for help on using the repository browser.