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/Prediction_unit/Branch_Target_Buffer/Branch_Target_Buffer_Glue/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 7 |
---|
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 (_(" * max_nb_instruction (uint32_t)\n")); |
---|
17 | err (_(" * size_buffer (uint32_t)\n")); |
---|
18 | err (_(" * associativity (uint32_t)\n")); |
---|
19 | err (_(" * size_address (uint32_t)\n")); |
---|
20 | err (_(" * nb_inst_predict (uint32_t)\n")); |
---|
21 | err (_(" * nb_inst_decod (uint32_t)\n")); |
---|
22 | err (_(" * nb_inst_update (uint32_t)\n")); |
---|
23 | |
---|
24 | exit (1); |
---|
25 | } |
---|
26 | |
---|
27 | #ifndef SYSTEMC |
---|
28 | int main (int argc, char * argv[]) |
---|
29 | #else |
---|
30 | int sc_main (int argc, char * argv[]) |
---|
31 | #endif |
---|
32 | { |
---|
33 | if (argc != static_cast<int>(2+NB_PARAMS)) |
---|
34 | usage (argc, argv); |
---|
35 | |
---|
36 | uint32_t x = 1; |
---|
37 | |
---|
38 | string name = argv[x++]; |
---|
39 | uint32_t _max_nb_instruction = fromString<uint32_t>(argv[x++]); |
---|
40 | uint32_t _size_buffer = fromString<uint32_t>(argv[x++]); |
---|
41 | uint32_t _associativity = fromString<uint32_t>(argv[x++]); |
---|
42 | uint32_t _size_address = fromString<uint32_t>(argv[x++]); |
---|
43 | uint32_t _nb_inst_predict = fromString<uint32_t>(argv[x++]); |
---|
44 | uint32_t _nb_inst_decod = fromString<uint32_t>(argv[x++]); |
---|
45 | uint32_t _nb_inst_update = fromString<uint32_t>(argv[x++]); |
---|
46 | |
---|
47 | int _return = EXIT_SUCCESS; |
---|
48 | try |
---|
49 | { |
---|
50 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_glue::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::branch_target_buffer::branch_target_buffer_glue::Parameters |
---|
51 | (_max_nb_instruction , |
---|
52 | _size_buffer , |
---|
53 | _associativity , |
---|
54 | _size_address , |
---|
55 | _nb_inst_predict , |
---|
56 | _nb_inst_decod , |
---|
57 | _nb_inst_update , |
---|
58 | true // is_toplevel |
---|
59 | ); |
---|
60 | |
---|
61 | msg(_("%s"),param->print(1).c_str()); |
---|
62 | |
---|
63 | test (name,param); |
---|
64 | } |
---|
65 | catch (morpheo::ErrorMorpheo & error) |
---|
66 | { |
---|
67 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
68 | _return = EXIT_FAILURE; |
---|
69 | } |
---|
70 | catch (...) |
---|
71 | { |
---|
72 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
73 | _return = EXIT_FAILURE; |
---|
74 | } |
---|
75 | |
---|
76 | return (_return); |
---|
77 | } |
---|