1 | /* |
---|
2 | * $Id: main.cpp 88 2008-12-10 18:31:39Z 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 7 |
---|
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 (_(" * nb_context_select (uint32_t )\n")); |
---|
24 | err (_(" * select_priority (Tpriority_t )\n")); |
---|
25 | err (_(" * select_load_balancing (Tload_balancing_t)\n")); |
---|
26 | |
---|
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 | |
---|
43 | uint32_t _nb_context = fromString<uint32_t >(argv[x++]); |
---|
44 | |
---|
45 | if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context)) |
---|
46 | usage (argc, argv); |
---|
47 | |
---|
48 | uint32_t * _nb_inst_fetch = new uint32_t [_nb_context]; |
---|
49 | for (uint32_t i=0; i<_nb_context; i++) |
---|
50 | _nb_inst_fetch [i] = fromString<uint32_t>(argv[x++]); |
---|
51 | uint32_t _nb_inst_decod = fromString<uint32_t >(argv[x++]); |
---|
52 | uint32_t _size_queue = fromString<uint32_t >(argv[x++]); |
---|
53 | uint32_t _size_general_data = fromString<uint32_t >(argv[x++]); |
---|
54 | uint32_t * _nb_branch_speculated = new uint32_t [_nb_context]; |
---|
55 | for (uint32_t i=0; i<_nb_context; i++) |
---|
56 | _nb_branch_speculated [i] = fromString<uint32_t>(argv[x++]); |
---|
57 | uint32_t _nb_context_select = fromString<uint32_t >(argv[x++]); |
---|
58 | Tpriority_t _select_priority = fromString<Tpriority_t >(argv[x++]); |
---|
59 | Tload_balancing_t _select_load_balancing = fromString<Tload_balancing_t>(argv[x++]); |
---|
60 | |
---|
61 | bool ** _instruction_implemeted = new bool * [_nb_context]; |
---|
62 | for (uint32_t i=0; i<_nb_context; i++) |
---|
63 | { |
---|
64 | _instruction_implemeted [i] = new bool [NB_INSTRUCTION]; |
---|
65 | |
---|
66 | for (uint32_t j=0; j<NB_INSTRUCTION; j++) |
---|
67 | _instruction_implemeted [i][j] = true; |
---|
68 | } |
---|
69 | |
---|
70 | |
---|
71 | int _return = EXIT_SUCCESS; |
---|
72 | try |
---|
73 | { |
---|
74 | morpheo::behavioural::core::multi_front_end::front_end::decod_unit::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::Parameters |
---|
75 | (_nb_context , |
---|
76 | _nb_inst_fetch , |
---|
77 | _nb_inst_decod , |
---|
78 | _size_queue , |
---|
79 | _size_general_data , |
---|
80 | _nb_branch_speculated , |
---|
81 | _nb_context_select , |
---|
82 | _select_priority , |
---|
83 | _select_load_balancing , |
---|
84 | _instruction_implemeted , |
---|
85 | &(morpheo::behavioural::custom::example_get_custom_information), |
---|
86 | true |
---|
87 | ); |
---|
88 | |
---|
89 | msg(_("%s"),param->print(1).c_str()); |
---|
90 | |
---|
91 | test (name,param); |
---|
92 | } |
---|
93 | catch (morpheo::ErrorMorpheo & error) |
---|
94 | { |
---|
95 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
96 | _return = EXIT_FAILURE; |
---|
97 | } |
---|
98 | catch (...) |
---|
99 | { |
---|
100 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
101 | _return = EXIT_FAILURE; |
---|
102 | } |
---|
103 | |
---|
104 | delete [] _nb_inst_fetch ; |
---|
105 | delete [] _nb_branch_speculated; |
---|
106 | for (uint32_t i=0; i<_nb_context; i++) |
---|
107 | delete [] _instruction_implemeted [i]; |
---|
108 | delete [] _instruction_implemeted; |
---|
109 | |
---|
110 | return (_return); |
---|
111 | } |
---|