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/Rename_unit/Rename_unit_Glue/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 5 |
---|
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_insert (uint32_t)\n")); |
---|
19 | err (_(" * nb_inst_retire (uint32_t)\n")); |
---|
20 | err (_(" * size_general_data (uint32_t)\n")); |
---|
21 | err (_(" * size_special_register (uint32_t)\n")); |
---|
22 | |
---|
23 | exit (1); |
---|
24 | } |
---|
25 | |
---|
26 | #ifndef SYSTEMC |
---|
27 | int main (int argc, char * argv[]) |
---|
28 | #else |
---|
29 | int sc_main (int argc, char * argv[]) |
---|
30 | #endif |
---|
31 | { |
---|
32 | if (argc <= static_cast<int>(2+NB_PARAMS)) |
---|
33 | usage (argc, argv); |
---|
34 | |
---|
35 | uint32_t x = 1; |
---|
36 | |
---|
37 | string name = argv[x++]; |
---|
38 | |
---|
39 | uint32_t _nb_front_end = fromString<uint32_t>(argv[x++]); |
---|
40 | |
---|
41 | if (argc != static_cast<int>(2+NB_PARAMS+_nb_front_end)) |
---|
42 | usage (argc, argv); |
---|
43 | |
---|
44 | uint32_t * _nb_context = new uint32_t [_nb_front_end]; |
---|
45 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
46 | _nb_context [i] = fromString<uint32_t>(argv[x++]); |
---|
47 | |
---|
48 | |
---|
49 | uint32_t _nb_inst_insert = fromString<uint32_t>(argv[x++]); |
---|
50 | uint32_t _nb_inst_retire = fromString<uint32_t>(argv[x++]); |
---|
51 | uint32_t _size_general_data = fromString<uint32_t>(argv[x++]); |
---|
52 | uint32_t _size_special_register = fromString<uint32_t>(argv[x++]); |
---|
53 | |
---|
54 | int _return = EXIT_SUCCESS; |
---|
55 | try |
---|
56 | { |
---|
57 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::rename_unit_glue::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::rename_unit_glue::Parameters |
---|
58 | ( |
---|
59 | _nb_front_end , |
---|
60 | _nb_context , |
---|
61 | _nb_inst_insert, |
---|
62 | _nb_inst_retire, |
---|
63 | _size_general_data, |
---|
64 | _size_special_register, |
---|
65 | true //is_toplevel |
---|
66 | ); |
---|
67 | |
---|
68 | msg(_("%s"),param->print(0).c_str()); |
---|
69 | |
---|
70 | test (name,param); |
---|
71 | } |
---|
72 | catch (morpheo::ErrorMorpheo & error) |
---|
73 | { |
---|
74 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
75 | _return = EXIT_FAILURE; |
---|
76 | } |
---|
77 | |
---|
78 | try |
---|
79 | { |
---|
80 | if (_return == EXIT_SUCCESS) |
---|
81 | TEST_OK("Rename_unit_Glue : no error"); |
---|
82 | else |
---|
83 | TEST_KO("Rename_unit_Glue : a lot of error"); |
---|
84 | } |
---|
85 | catch (morpheo::ErrorMorpheo & error) |
---|
86 | { |
---|
87 | // msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
88 | _return = EXIT_FAILURE; |
---|
89 | } |
---|
90 | |
---|
91 | delete [] _nb_context; |
---|
92 | |
---|
93 | return (_return); |
---|
94 | } |
---|