1 | /* |
---|
2 | * $Id: main.cpp 87 2008-05-15 19:23:42Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/SelfTest/include/test.h" |
---|
9 | #include "Behavioural/Custom/include/Custom_example.h" |
---|
10 | |
---|
11 | #define NB_PARAMS 8 |
---|
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_context (uint32_t )\n")); |
---|
18 | err (_(" * nb_inst_fetch [nb_context] (uint32_t )\n")); |
---|
19 | err (_(" * nb_inst_decod (uint32_t )\n")); |
---|
20 | err (_(" * size_queue (uint32_t )\n")); |
---|
21 | err (_(" * size_general_data (uint32_t )\n")); |
---|
22 | err (_(" * nb_branch_speculated [nb_context] (uint32_t )\n")); |
---|
23 | err (_(" * size_branch_update_prediction (uint32_t )\n")); |
---|
24 | err (_(" * nb_context_select (uint32_t )\n")); |
---|
25 | err (_(" * select_priority (Tpriority_t )\n")); |
---|
26 | err (_(" * select_load_balancing (Tload_balancing_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 | |
---|
46 | if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context)) |
---|
47 | usage (argc, argv); |
---|
48 | |
---|
49 | uint32_t * _nb_inst_fetch = new uint32_t [_nb_context]; |
---|
50 | for (uint32_t i=0; i<_nb_context; i++) |
---|
51 | _nb_inst_fetch [i] = fromString<uint32_t>(argv[x++]); |
---|
52 | uint32_t _nb_inst_decod = fromString<uint32_t >(argv[x++]); |
---|
53 | uint32_t _size_queue = fromString<uint32_t >(argv[x++]); |
---|
54 | uint32_t _size_general_data = fromString<uint32_t >(argv[x++]); |
---|
55 | uint32_t * _nb_branch_speculated = new uint32_t [_nb_context]; |
---|
56 | for (uint32_t i=0; i<_nb_context; i++) |
---|
57 | _nb_branch_speculated [i] = fromString<uint32_t>(argv[x++]); |
---|
58 | uint32_t _size_branch_update_prediction= fromString<uint32_t >(argv[x++]); |
---|
59 | uint32_t _nb_context_select = fromString<uint32_t >(argv[x++]); |
---|
60 | Tpriority_t _select_priority = fromString<Tpriority_t >(argv[x++]); |
---|
61 | Tload_balancing_t _select_load_balancing = fromString<Tload_balancing_t>(argv[x++]); |
---|
62 | |
---|
63 | bool ** _instruction_implemeted = new bool * [_nb_context]; |
---|
64 | for (uint32_t i=0; i<_nb_context; i++) |
---|
65 | { |
---|
66 | _instruction_implemeted [i] = new bool [NB_INSTRUCTION]; |
---|
67 | |
---|
68 | for (uint32_t j=0; j<NB_INSTRUCTION; j++) |
---|
69 | _instruction_implemeted [i][j] = true; |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | int _return = EXIT_SUCCESS; |
---|
74 | try |
---|
75 | { |
---|
76 | morpheo::behavioural::core::multi_front_end::front_end::decod_unit::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::Parameters |
---|
77 | (_nb_context , |
---|
78 | _nb_inst_fetch , |
---|
79 | _nb_inst_decod , |
---|
80 | _size_queue , |
---|
81 | _size_general_data , |
---|
82 | _nb_branch_speculated , |
---|
83 | _size_branch_update_prediction, |
---|
84 | _nb_context_select , |
---|
85 | _select_priority , |
---|
86 | _select_load_balancing , |
---|
87 | _instruction_implemeted , |
---|
88 | &(morpheo::behavioural::custom::example_get_custom_information) |
---|
89 | ); |
---|
90 | |
---|
91 | msg(_("%s"),param->print(1).c_str()); |
---|
92 | |
---|
93 | test (name,param); |
---|
94 | } |
---|
95 | catch (morpheo::ErrorMorpheo & error) |
---|
96 | { |
---|
97 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
98 | _return = EXIT_FAILURE; |
---|
99 | } |
---|
100 | catch (...) |
---|
101 | { |
---|
102 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
103 | _return = EXIT_FAILURE; |
---|
104 | } |
---|
105 | |
---|
106 | delete [] _nb_inst_fetch ; |
---|
107 | delete [] _nb_branch_speculated; |
---|
108 | for (uint32_t i=0; i<_nb_context; i++) |
---|
109 | delete [] _instruction_implemeted [i]; |
---|
110 | delete [] _instruction_implemeted; |
---|
111 | |
---|
112 | return (_return); |
---|
113 | } |
---|