1 | /* |
---|
2 | * $Id: main.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Multi_Execute_unit/Execute_unit/Load_store_unit/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define number_of_test 2 |
---|
11 | |
---|
12 | #define NB_PARAMS 14 |
---|
13 | |
---|
14 | void usage (int argc, char * argv[]) |
---|
15 | { |
---|
16 | cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl |
---|
17 | << "list_params is :" << endl |
---|
18 | << " - size_store_queue (uint32_t)" << endl |
---|
19 | << " - size_load_queue (uint32_t)" << endl |
---|
20 | << " - size_speculative_access_queue (uint32_t)" << endl |
---|
21 | << " - nb_port_check (uint32_t)" << endl |
---|
22 | << " - speculative_load (uint32_t)" << endl |
---|
23 | << " - nb_bypass_memory (uint32_t)" << endl |
---|
24 | << " - nb_cache_port (uint32_t)" << endl |
---|
25 | << " - nb_inst_memory (uint32_t)" << endl |
---|
26 | << " - nb_context (uint32_t)" << endl |
---|
27 | << " - nb_front_end (uint32_t)" << endl |
---|
28 | << " - nb_ooo_engine (uint32_t)" << endl |
---|
29 | << " - nb_packet (uint32_t)" << endl |
---|
30 | << " - size_general_data (uint32_t)" << endl |
---|
31 | << " - size_special_data (uint32_t)" << endl |
---|
32 | << " - nb_general_register (uint32_t)" << endl |
---|
33 | << " - nb_special_register (uint32_t)" << endl |
---|
34 | << "" << endl; |
---|
35 | |
---|
36 | for (int i=0; i<argc; i++) |
---|
37 | cerr << argv[i] << " "; |
---|
38 | cerr << endl; |
---|
39 | |
---|
40 | exit (1); |
---|
41 | } |
---|
42 | |
---|
43 | #ifndef SYSTEMC |
---|
44 | int main (int argc, char * argv[]) |
---|
45 | #else |
---|
46 | int sc_main (int argc, char * argv[]) |
---|
47 | #endif |
---|
48 | { |
---|
49 | switch (number_of_test) |
---|
50 | { |
---|
51 | case 1 : |
---|
52 | { |
---|
53 | |
---|
54 | if (argc != 2+NB_PARAMS) |
---|
55 | usage (argc, argv); |
---|
56 | |
---|
57 | uint32_t x=1; |
---|
58 | |
---|
59 | const string name = argv[x++]; |
---|
60 | const uint32_t _size_store_queue = atoi(argv[x++]); |
---|
61 | const uint32_t _size_load_queue = atoi(argv[x++]); |
---|
62 | const uint32_t _size_speculative_access_queue = atoi(argv[x++]); |
---|
63 | const uint32_t _nb_port_check = atoi(argv[x++]); |
---|
64 | const Tspeculative_load_t _speculative_load = fromString<Tspeculative_load_t>(argv[x++]); |
---|
65 | const uint32_t _nb_bypass_memory = atoi(argv[x++]); |
---|
66 | const uint32_t _nb_cache_port = atoi(argv[x++]); |
---|
67 | const uint32_t _nb_inst_memory = atoi(argv[x++]); |
---|
68 | const uint32_t _nb_context = atoi(argv[x++]); |
---|
69 | const uint32_t _nb_front_end = atoi(argv[x++]); |
---|
70 | const uint32_t _nb_ooo_engine = atoi(argv[x++]); |
---|
71 | const uint32_t _nb_packet = atoi(argv[x++]); |
---|
72 | const uint32_t _size_general_data = atoi(argv[x++]); |
---|
73 | const uint32_t _size_special_data = atoi(argv[x++]); |
---|
74 | const uint32_t _nb_general_register = atoi(argv[x++]); |
---|
75 | const uint32_t _nb_special_register = atoi(argv[x++]); |
---|
76 | |
---|
77 | try |
---|
78 | { |
---|
79 | morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters * param = new morpheo::behavioural::core::multi_execute_loop::execute_loop::multi_execute_unit::execute_unit::load_store_unit::Parameters |
---|
80 | ( |
---|
81 | _size_store_queue , |
---|
82 | _size_load_queue , |
---|
83 | _size_speculative_access_queue, |
---|
84 | _nb_port_check , |
---|
85 | _speculative_load , |
---|
86 | _nb_bypass_memory , |
---|
87 | _nb_cache_port , |
---|
88 | _nb_inst_memory , |
---|
89 | _nb_context , |
---|
90 | _nb_front_end , |
---|
91 | _nb_ooo_engine , |
---|
92 | _nb_packet , |
---|
93 | _size_general_data , |
---|
94 | _size_special_data , |
---|
95 | _nb_general_register , |
---|
96 | _nb_special_register , |
---|
97 | true //is_toplevel |
---|
98 | ); |
---|
99 | |
---|
100 | cout << param->print(1); |
---|
101 | |
---|
102 | test1 (name,param); |
---|
103 | |
---|
104 | } |
---|
105 | catch (morpheo::ErrorMorpheo & error) |
---|
106 | { |
---|
107 | cout << "<" << name << "> : " << error.what (); |
---|
108 | exit (EXIT_FAILURE); |
---|
109 | } |
---|
110 | catch (...) |
---|
111 | { |
---|
112 | cerr << "<" << name << "> : This test must generate a error" << endl; |
---|
113 | exit (EXIT_FAILURE); |
---|
114 | } |
---|
115 | |
---|
116 | break; |
---|
117 | } |
---|
118 | case 2 : |
---|
119 | { |
---|
120 | try |
---|
121 | { |
---|
122 | test2 (); |
---|
123 | } |
---|
124 | catch (morpheo::ErrorMorpheo & error) |
---|
125 | { |
---|
126 | cout << error.what (); |
---|
127 | exit (EXIT_FAILURE); |
---|
128 | } |
---|
129 | catch (...) |
---|
130 | { |
---|
131 | cerr << "This test must generate a error" << endl; |
---|
132 | exit (EXIT_FAILURE); |
---|
133 | } |
---|
134 | |
---|
135 | break; |
---|
136 | } |
---|
137 | default : |
---|
138 | { |
---|
139 | std::cerr << "Invalid number of test" << std::endl; |
---|
140 | exit (EXIT_FAILURE); |
---|
141 | |
---|
142 | break; |
---|
143 | } |
---|
144 | } |
---|
145 | |
---|
146 | return (EXIT_SUCCESS); |
---|
147 | } |
---|
148 | |
---|