1 | /* |
---|
2 | * $Id: main.cpp 110 2009-02-19 16:31:47Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 4 |
---|
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_load_store_queue (uint32_t)\n")); |
---|
19 | err (_(" * size_store_queue [nb_load_store_queue] (uint32_t)\n")); |
---|
20 | err (_(" * size_load_queue [nb_load_store_queue] (uint32_t)\n")); |
---|
21 | err (_(" * nb_inst_memory [nb_load_store_queue] (uint32_t)\n")); |
---|
22 | err (_(" * link_load_store_unit_with_thread [nb_front_end][nb_context](uint32_t)\n")); |
---|
23 | err (_(" * nb_inst_insert (uint32_t)\n")); |
---|
24 | err (_(" * nb_inst_retire (uint32_t)\n")); |
---|
25 | exit (1); |
---|
26 | } |
---|
27 | |
---|
28 | #ifndef SYSTEMC |
---|
29 | int main (int argc, char * argv[]) |
---|
30 | #else |
---|
31 | int sc_main (int argc, char * argv[]) |
---|
32 | #endif |
---|
33 | { |
---|
34 | if (argc < static_cast<int>(2+NB_PARAMS)) |
---|
35 | usage (argc, argv); |
---|
36 | |
---|
37 | uint32_t x = 1; |
---|
38 | |
---|
39 | string name = argv[x++]; |
---|
40 | |
---|
41 | uint32_t _nb_front_end = atoi(argv[x++]); |
---|
42 | |
---|
43 | if (argc < static_cast<int>(2+NB_PARAMS+_nb_front_end)) |
---|
44 | usage (argc, argv); |
---|
45 | |
---|
46 | uint32_t * _nb_context = new uint32_t [_nb_front_end]; |
---|
47 | uint32_t nb_thread = 0; |
---|
48 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
49 | { |
---|
50 | _nb_context [i] = atoi(argv[x++]); |
---|
51 | nb_thread += _nb_context [i]; |
---|
52 | } |
---|
53 | |
---|
54 | uint32_t _nb_load_store_queue = fromString<uint32_t>(argv[x++]); |
---|
55 | |
---|
56 | if (argc != static_cast<int>(2+NB_PARAMS+_nb_front_end+3*_nb_load_store_queue+nb_thread)) |
---|
57 | usage (argc, argv); |
---|
58 | |
---|
59 | uint32_t * _size_store_queue = new uint32_t [_nb_load_store_queue]; |
---|
60 | uint32_t * _size_load_queue = new uint32_t [_nb_load_store_queue]; |
---|
61 | uint32_t * _nb_inst_memory = new uint32_t [_nb_load_store_queue]; |
---|
62 | |
---|
63 | for (uint32_t i=0; i<_nb_load_store_queue; i++) |
---|
64 | _size_store_queue [i] = atoi(argv[x++]); |
---|
65 | for (uint32_t i=0; i<_nb_load_store_queue; i++) |
---|
66 | _size_load_queue [i] = atoi(argv[x++]); |
---|
67 | for (uint32_t i=0; i<_nb_load_store_queue; i++) |
---|
68 | _nb_inst_memory [i] = atoi(argv[x++]); |
---|
69 | |
---|
70 | uint32_t ** _link_load_store_unit_with_thread = new uint32_t * [_nb_front_end]; |
---|
71 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
72 | { |
---|
73 | _link_load_store_unit_with_thread [i] = new uint32_t [_nb_context[i]]; |
---|
74 | for (uint32_t j=0; j<_nb_context[i]; j++) |
---|
75 | _link_load_store_unit_with_thread [i][j] = atoi(argv[x++]); |
---|
76 | } |
---|
77 | |
---|
78 | uint32_t _nb_inst_insert = atoi(argv[x++]); |
---|
79 | uint32_t _nb_inst_retire = atoi(argv[x++]); |
---|
80 | |
---|
81 | int _return = EXIT_SUCCESS; |
---|
82 | try |
---|
83 | { |
---|
84 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters |
---|
85 | (_nb_front_end , |
---|
86 | _nb_context , |
---|
87 | _nb_load_store_queue , |
---|
88 | _size_store_queue , |
---|
89 | _size_load_queue , |
---|
90 | _nb_inst_memory , |
---|
91 | _link_load_store_unit_with_thread, |
---|
92 | _nb_inst_insert , |
---|
93 | _nb_inst_retire , |
---|
94 | true //is_toplevel |
---|
95 | ); |
---|
96 | |
---|
97 | msg(_("%s"),param->print(1).c_str()); |
---|
98 | |
---|
99 | test (name,param); |
---|
100 | } |
---|
101 | catch (morpheo::ErrorMorpheo & error) |
---|
102 | { |
---|
103 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
104 | _return = EXIT_FAILURE; |
---|
105 | } |
---|
106 | catch (...) |
---|
107 | { |
---|
108 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
109 | _return = EXIT_FAILURE; |
---|
110 | } |
---|
111 | |
---|
112 | return (_return); |
---|
113 | } |
---|