1 | /* |
---|
2 | * $Id: main.cpp 111 2009-02-27 18:37:40Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/SelfTest/include/test.h" |
---|
9 | #include "Behavioural/include/Selftest.h" |
---|
10 | |
---|
11 | #define NB_PARAMS 3+7*3 |
---|
12 | |
---|
13 | void usage (int argc, char * argv[]) |
---|
14 | { |
---|
15 | err (_("<Usage> %s name_instance list_params.\n"),argv[0]); |
---|
16 | err (_("list_params is :\n")); |
---|
17 | err (_(" * nb_inst_predict (uint32_t)\n")); |
---|
18 | err (_(" * nb_inst_update (uint32_t)\n")); |
---|
19 | err (_(" * size_address (uint32_t)\n")); |
---|
20 | err (_(" * have_bht [3] (bool )\n")); |
---|
21 | err (_(" * bht_size_shifter [3] (uint32_t)\n")); |
---|
22 | err (_(" * bht_nb_shifter [3] (uint32_t)\n")); |
---|
23 | err (_(" * have_pht [3] (bool )\n")); |
---|
24 | err (_(" * pht_size_counter [3] (uint32_t)\n")); |
---|
25 | err (_(" * pht_nb_counter [3] (uint32_t)\n")); |
---|
26 | err (_(" * pht_size_address_share [3] (uint32_t)\n")); |
---|
27 | exit (1); |
---|
28 | } |
---|
29 | |
---|
30 | #ifndef SYSTEMC |
---|
31 | int main (int argc, char * argv[]) |
---|
32 | #else |
---|
33 | int sc_main (int argc, char * argv[]) |
---|
34 | #endif |
---|
35 | { |
---|
36 | if (argc != static_cast<int>(2+NB_PARAMS)) |
---|
37 | usage (argc, argv); |
---|
38 | |
---|
39 | uint32_t x = 1; |
---|
40 | |
---|
41 | string name = argv[x++]; |
---|
42 | uint32_t _nb_inst_predict ; |
---|
43 | uint32_t _nb_inst_update ; |
---|
44 | uint32_t _size_address ; |
---|
45 | bool _have_bht [3]; |
---|
46 | uint32_t _bht_size_shifter [3]; |
---|
47 | uint32_t _bht_nb_shifter [3]; |
---|
48 | bool _have_pht [3]; |
---|
49 | uint32_t _pht_size_counter [3]; |
---|
50 | uint32_t _pht_nb_counter [3]; |
---|
51 | uint32_t _pht_size_address_share [3]; |
---|
52 | |
---|
53 | SELFTEST0(_nb_inst_predict ,uint32_t,argv,x); |
---|
54 | SELFTEST0(_nb_inst_update ,uint32_t,argv,x); |
---|
55 | SELFTEST0(_size_address ,uint32_t,argv,x); |
---|
56 | |
---|
57 | for (uint32_t i=0; i<3; ++i) |
---|
58 | { |
---|
59 | SELFTEST0(_have_bht [i],bool ,argv,x); |
---|
60 | SELFTEST0(_bht_size_shifter [i],uint32_t,argv,x); |
---|
61 | SELFTEST0(_bht_nb_shifter [i],uint32_t,argv,x); |
---|
62 | SELFTEST0(_have_pht [i],bool ,argv,x); |
---|
63 | SELFTEST0(_pht_size_counter [i],uint32_t,argv,x); |
---|
64 | SELFTEST0(_pht_nb_counter [i],uint32_t,argv,x); |
---|
65 | SELFTEST0(_pht_size_address_share [i],uint32_t,argv,x); |
---|
66 | } |
---|
67 | |
---|
68 | int _return = EXIT_SUCCESS; |
---|
69 | try |
---|
70 | { |
---|
71 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::Parameters |
---|
72 | ( |
---|
73 | _nb_inst_predict , |
---|
74 | _nb_inst_update , |
---|
75 | _size_address , |
---|
76 | _have_bht , |
---|
77 | _bht_size_shifter , |
---|
78 | _bht_nb_shifter , |
---|
79 | _have_pht , |
---|
80 | _pht_size_counter , |
---|
81 | _pht_nb_counter , |
---|
82 | _pht_size_address_share, |
---|
83 | true // is_toplevel |
---|
84 | ); |
---|
85 | |
---|
86 | msg(_("%s"),param->print(0).c_str()); |
---|
87 | |
---|
88 | test (name,param); |
---|
89 | } |
---|
90 | catch (morpheo::ErrorMorpheo & error) |
---|
91 | { |
---|
92 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
93 | _return = EXIT_FAILURE; |
---|
94 | } |
---|
95 | |
---|
96 | try |
---|
97 | { |
---|
98 | if (_return == EXIT_SUCCESS) |
---|
99 | TEST_OK("Meta_Predictor : no error"); |
---|
100 | else |
---|
101 | TEST_KO("Meta_Predictor : a lot of error"); |
---|
102 | } |
---|
103 | catch (morpheo::ErrorMorpheo & error) |
---|
104 | { |
---|
105 | // msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
106 | _return = EXIT_FAILURE; |
---|
107 | } |
---|
108 | |
---|
109 | return (_return); |
---|
110 | } |
---|