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