[78] | 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/Return_Address_Stack/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_context (uint32_t)\n")); |
---|
| 17 | err (_(" * size_queue [nb_context] (uint32_t)\n")); |
---|
| 18 | err (_(" * size_address (uint32_t)\n")); |
---|
| 19 | err (_(" * nb_inst_predict (uint32_t)\n")); |
---|
| 20 | err (_(" * nb_inst_decod (uint32_t)\n")); |
---|
| 21 | err (_(" * nb_inst_update (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_context = fromString<uint32_t>(argv[x++]); |
---|
| 40 | |
---|
| 41 | if (argc < static_cast<int>(2+NB_PARAMS+_nb_context)) |
---|
| 42 | usage (argc, argv); |
---|
| 43 | |
---|
| 44 | uint32_t * _size_queue = new uint32_t [_nb_context]; |
---|
| 45 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 46 | _size_queue [i] = fromString<uint32_t>(argv[x++]); |
---|
| 47 | |
---|
| 48 | uint32_t _size_address = fromString<uint32_t>(argv[x++]); |
---|
| 49 | uint32_t _nb_inst_predict = fromString<uint32_t>(argv[x++]); |
---|
| 50 | uint32_t _nb_inst_decod = fromString<uint32_t>(argv[x++]); |
---|
| 51 | uint32_t _nb_inst_update = fromString<uint32_t>(argv[x++]); |
---|
| 52 | |
---|
| 53 | int _return = EXIT_SUCCESS; |
---|
| 54 | try |
---|
| 55 | { |
---|
| 56 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::return_address_stack::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::return_address_stack::Parameters |
---|
| 57 | (_nb_context , |
---|
| 58 | _size_queue , |
---|
| 59 | _size_address , |
---|
| 60 | _nb_inst_predict , |
---|
| 61 | _nb_inst_decod , |
---|
[88] | 62 | _nb_inst_update , |
---|
| 63 | true // is_toplevel |
---|
| 64 | ); |
---|
[78] | 65 | |
---|
| 66 | msg(_("%s"),param->print(1).c_str()); |
---|
| 67 | |
---|
| 68 | test (name,param); |
---|
| 69 | } |
---|
| 70 | catch (morpheo::ErrorMorpheo & error) |
---|
| 71 | { |
---|
| 72 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 73 | _return = EXIT_FAILURE; |
---|
| 74 | } |
---|
| 75 | catch (...) |
---|
| 76 | { |
---|
| 77 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
| 78 | _return = EXIT_FAILURE; |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | delete _size_queue; |
---|
| 82 | |
---|
| 83 | return (_return); |
---|
| 84 | } |
---|