1 | /* |
---|
2 | * $Id$ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Prediction_unit_Glue/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 6 |
---|
11 | |
---|
12 | void 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 (_(" * nb_decod_unit (uint32_t)\n")); |
---|
18 | // err (_(" * nb_ooo_engine (uint32_t)\n")); |
---|
19 | err (_(" * size_address (uint32_t)\n")); |
---|
20 | err (_(" * nb_instruction [nb_context] (uint32_t)\n")); |
---|
21 | err (_(" * size_depth [nb_context] (uint32_t)\n")); |
---|
22 | err (_(" * nb_inst_decod [nb_decod_unit] (uint32_t)\n")); |
---|
23 | // err (_(" * nb_inst_update [nb_ooo_engine] (uint32_t)\n")); |
---|
24 | err (_(" * nb_inst_branch_predict (uint32_t)\n")); |
---|
25 | err (_(" * nb_inst_branch_decod (uint32_t)\n")); |
---|
26 | err (_(" * nb_inst_branch_update (uint32_t)\n")); |
---|
27 | |
---|
28 | exit (1); |
---|
29 | } |
---|
30 | |
---|
31 | #ifndef SYSTEMC |
---|
32 | int main (int argc, char * argv[]) |
---|
33 | #else |
---|
34 | int sc_main (int argc, char * argv[]) |
---|
35 | #endif |
---|
36 | { |
---|
37 | if (argc < static_cast<int>(2+NB_PARAMS)) |
---|
38 | usage (argc, argv); |
---|
39 | |
---|
40 | uint32_t x = 1; |
---|
41 | |
---|
42 | string name = argv[x++]; |
---|
43 | |
---|
44 | uint32_t _nb_context = fromString<uint32_t>(argv[x++]); |
---|
45 | uint32_t _nb_decod_unit = fromString<uint32_t>(argv[x++]); |
---|
46 | // uint32_t _nb_ooo_engine = fromString<uint32_t>(argv[x++]); |
---|
47 | uint32_t _size_address = fromString<uint32_t>(argv[x++]); |
---|
48 | |
---|
49 | if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context+_nb_decod_unit// +_nb_ooo_engine |
---|
50 | )) |
---|
51 | usage (argc, argv); |
---|
52 | |
---|
53 | uint32_t * _nb_instruction = new uint32_t [_nb_context]; |
---|
54 | for (uint32_t i=0; i<_nb_context; i++) |
---|
55 | _nb_instruction [i] = fromString<uint32_t>(argv[x++]); |
---|
56 | uint32_t * _size_depth = new uint32_t [_nb_context]; |
---|
57 | for (uint32_t i=0; i<_nb_context; i++) |
---|
58 | _size_depth [i] = fromString<uint32_t>(argv[x++]); |
---|
59 | uint32_t * _nb_inst_decod = new uint32_t [_nb_decod_unit]; |
---|
60 | for (uint32_t i=0; i<_nb_decod_unit; i++) |
---|
61 | _nb_inst_decod [i] = fromString<uint32_t>(argv[x++]); |
---|
62 | // uint32_t * _nb_inst_update = new uint32_t [_nb_ooo_engine]; |
---|
63 | // for (uint32_t i=0; i<_nb_ooo_engine; i++) |
---|
64 | // _nb_inst_update [i] = fromString<uint32_t>(argv[x++]); |
---|
65 | uint32_t _nb_inst_branch_predict = fromString<uint32_t>(argv[x++]); |
---|
66 | uint32_t _nb_inst_branch_update = fromString<uint32_t>(argv[x++]); |
---|
67 | uint32_t _nb_inst_branch_decod = fromString<uint32_t>(argv[x++]); |
---|
68 | |
---|
69 | int _return = EXIT_SUCCESS; |
---|
70 | try |
---|
71 | { |
---|
72 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::prediction_unit_glue::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::prediction_unit_glue::Parameters |
---|
73 | (_nb_context , |
---|
74 | _nb_decod_unit , |
---|
75 | // _nb_ooo_engine , |
---|
76 | _size_address , |
---|
77 | _nb_instruction , |
---|
78 | _size_depth , |
---|
79 | _nb_inst_decod , |
---|
80 | // _nb_inst_update , |
---|
81 | _nb_inst_branch_predict, |
---|
82 | _nb_inst_branch_decod , |
---|
83 | _nb_inst_branch_update , |
---|
84 | true // is_toplevel |
---|
85 | ); |
---|
86 | |
---|
87 | msg(_("%s"),param->print(1).c_str()); |
---|
88 | |
---|
89 | test (name,param); |
---|
90 | } |
---|
91 | catch (morpheo::ErrorMorpheo & error) |
---|
92 | { |
---|
93 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
94 | _return = EXIT_FAILURE; |
---|
95 | } |
---|
96 | catch (...) |
---|
97 | { |
---|
98 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
99 | _return = EXIT_FAILURE; |
---|
100 | } |
---|
101 | |
---|
102 | delete [] _nb_instruction; |
---|
103 | delete [] _size_depth ; |
---|
104 | delete [] _nb_inst_decod ; |
---|
105 | // delete [] _nb_inst_update; |
---|
106 | |
---|
107 | return (_return); |
---|
108 | } |
---|