1 | /* |
---|
2 | * $Id: main.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Special_Register_unit/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 2 |
---|
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_front_end (uint32_t)\n")); |
---|
17 | err (_(" * nb_context [nb_front_end] (uint32_t)\n")); |
---|
18 | err (_(" * nb_inst_reexecute (uint32_t)\n")); |
---|
19 | |
---|
20 | exit (1); |
---|
21 | } |
---|
22 | |
---|
23 | #ifndef SYSTEMC |
---|
24 | int main (int argc, char * argv[]) |
---|
25 | #else |
---|
26 | int sc_main (int argc, char * argv[]) |
---|
27 | #endif |
---|
28 | { |
---|
29 | if (argc <= static_cast<int>(2+NB_PARAMS)) |
---|
30 | usage (argc, argv); |
---|
31 | |
---|
32 | uint32_t x = 1; |
---|
33 | |
---|
34 | string name = argv[x++]; |
---|
35 | |
---|
36 | uint32_t _nb_front_end = fromString<uint32_t>(argv[x++]); |
---|
37 | |
---|
38 | if (argc != static_cast<int>(2+NB_PARAMS+_nb_front_end)) |
---|
39 | usage (argc, argv); |
---|
40 | |
---|
41 | uint32_t * _nb_context = new uint32_t [_nb_front_end]; |
---|
42 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
43 | _nb_context [i] = fromString<uint32_t>(argv[x++]); |
---|
44 | |
---|
45 | uint32_t _nb_inst_reexecute = fromString<uint32_t>(argv[x++]); |
---|
46 | |
---|
47 | bool *** _implement_group = new bool ** [_nb_front_end]; |
---|
48 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
49 | { |
---|
50 | _implement_group [i] = new bool * [_nb_context[i]]; |
---|
51 | for (uint32_t j=0; j<_nb_context[i]; j++) |
---|
52 | { |
---|
53 | _implement_group [i][j] = new bool [NB_GROUP]; |
---|
54 | |
---|
55 | for (uint32_t k=0; k<NB_GROUP; k++) |
---|
56 | _implement_group [i][j][k] = false; |
---|
57 | |
---|
58 | _implement_group [i][j][GROUP_SYSTEM_AND_CONTROL] = true; |
---|
59 | _implement_group [i][j][GROUP_DCACHE ] = true; |
---|
60 | } |
---|
61 | } |
---|
62 | |
---|
63 | int _return = EXIT_SUCCESS; |
---|
64 | try |
---|
65 | { |
---|
66 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::special_register_unit::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::special_register_unit::Parameters |
---|
67 | ( |
---|
68 | _nb_front_end , |
---|
69 | _nb_context , |
---|
70 | _nb_inst_reexecute , |
---|
71 | _implement_group , |
---|
72 | true //is_toplevel |
---|
73 | ); |
---|
74 | |
---|
75 | msg(_("%s"),param->print(0).c_str()); |
---|
76 | |
---|
77 | test (name,param); |
---|
78 | } |
---|
79 | catch (morpheo::ErrorMorpheo & error) |
---|
80 | { |
---|
81 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
82 | _return = EXIT_FAILURE; |
---|
83 | } |
---|
84 | |
---|
85 | try |
---|
86 | { |
---|
87 | if (_return == EXIT_SUCCESS) |
---|
88 | TEST_OK("Special_Register_unit : no error"); |
---|
89 | else |
---|
90 | TEST_KO("Special_Register_unit : a lot of error"); |
---|
91 | } |
---|
92 | catch (morpheo::ErrorMorpheo & error) |
---|
93 | { |
---|
94 | // msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
95 | _return = EXIT_FAILURE; |
---|
96 | } |
---|
97 | |
---|
98 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
99 | { |
---|
100 | for (uint32_t j=0; j<_nb_context[i]; j++) |
---|
101 | delete [] _implement_group [i][j]; |
---|
102 | delete [] _implement_group [i]; |
---|
103 | } |
---|
104 | delete [] _implement_group; |
---|
105 | |
---|
106 | delete [] _nb_context; |
---|
107 | |
---|
108 | return (_return); |
---|
109 | } |
---|