[82] | 1 | /* |
---|
| 2 | * $Id: main.cpp 111 2009-02-27 18:37:40Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod_queue/SelfTest/include/test.h" |
---|
| 9 | |
---|
[111] | 10 | #define NB_PARAMS 5 |
---|
[82] | 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")); |
---|
[111] | 16 | err (_(" * nb_context (uint32_t )\n")); |
---|
| 17 | err (_(" * nb_inst_decod (uint32_t )\n")); |
---|
| 18 | err (_(" * size_queue (uint32_t )\n")); |
---|
| 19 | err (_(" * queue_scheme (Tdecod_queue_scheme_t)\n")); |
---|
| 20 | err (_(" * size_general_data (uint32_t )\n")); |
---|
| 21 | err (_(" * nb_branch_speculated [nb_context] (uint32_t )\n")); |
---|
[82] | 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 | uint32_t _nb_context = fromString<uint32_t>(argv[x++]); |
---|
| 39 | uint32_t _nb_inst_decod = fromString<uint32_t>(argv[x++]); |
---|
| 40 | uint32_t _size_queue = fromString<uint32_t>(argv[x++]); |
---|
[111] | 41 | Tdecod_queue_scheme_t _queue_scheme = fromString<Tdecod_queue_scheme_t>(argv[x++]); |
---|
[82] | 42 | uint32_t _size_general_data = fromString<uint32_t>(argv[x++]); |
---|
| 43 | |
---|
| 44 | if (argc != static_cast<int>(2+NB_PARAMS+_nb_context)) |
---|
| 45 | usage (argc, argv); |
---|
| 46 | |
---|
| 47 | uint32_t * _nb_branch_speculated = new uint32_t [_nb_context]; |
---|
| 48 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 49 | _nb_branch_speculated [i] = fromString<uint32_t>(argv[x++]); |
---|
| 50 | |
---|
| 51 | int _return = EXIT_SUCCESS; |
---|
| 52 | try |
---|
| 53 | { |
---|
| 54 | morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod_queue::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod_queue::Parameters |
---|
| 55 | (_nb_context , |
---|
| 56 | _nb_inst_decod , |
---|
| 57 | _size_queue , |
---|
[111] | 58 | _queue_scheme , |
---|
[82] | 59 | _size_general_data, |
---|
[88] | 60 | _nb_branch_speculated, |
---|
| 61 | true // is_toplevel |
---|
| 62 | ); |
---|
[82] | 63 | |
---|
| 64 | msg(_("%s"),param->print(1).c_str()); |
---|
| 65 | |
---|
| 66 | test (name,param); |
---|
| 67 | } |
---|
| 68 | catch (morpheo::ErrorMorpheo & error) |
---|
| 69 | { |
---|
| 70 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 71 | _return = EXIT_FAILURE; |
---|
| 72 | } |
---|
| 73 | catch (...) |
---|
| 74 | { |
---|
| 75 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
| 76 | _return = EXIT_FAILURE; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | delete [] _nb_branch_speculated; |
---|
| 80 | |
---|
| 81 | return (_return); |
---|
| 82 | } |
---|