[78] | 1 | /* |
---|
| 2 | * $Id$ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Decod_unit/Decod/SelfTest/include/test.h" |
---|
| 9 | |
---|
| 10 | #define NB_PARAMS 8 |
---|
| 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 (_(" * nb_inst_fetch [nb_context] (uint32_t )\n")); |
---|
| 18 | err (_(" * nb_inst_decod (uint32_t )\n")); |
---|
| 19 | err (_(" * nb_branch_speculated (uint32_t )\n")); |
---|
| 20 | err (_(" * size_branch_update_prediction (uint32_t )\n")); |
---|
| 21 | err (_(" * nb_context_select (uint32_t )\n")); |
---|
| 22 | err (_(" * size_general_data (uint32_t )\n")); |
---|
| 23 | err (_(" * priority (Tpriority_t )\n")); |
---|
| 24 | err (_(" * load_balancing (Tload_balancing_t)\n")); |
---|
| 25 | |
---|
| 26 | exit (1); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | #ifndef SYSTEMC |
---|
| 30 | int main (int argc, char * argv[]) |
---|
| 31 | #else |
---|
| 32 | int sc_main (int argc, char * argv[]) |
---|
| 33 | #endif |
---|
| 34 | { |
---|
| 35 | if (argc < static_cast<int>(2+NB_PARAMS)) |
---|
| 36 | usage (argc, argv); |
---|
| 37 | |
---|
| 38 | uint32_t x = 1; |
---|
| 39 | |
---|
| 40 | string name = argv[x++]; |
---|
| 41 | uint32_t _nb_context = fromString<uint32_t >(argv[x++]); |
---|
| 42 | |
---|
| 43 | if (argc != static_cast<int>(2+NB_PARAMS+_nb_context)) |
---|
| 44 | usage (argc, argv); |
---|
| 45 | |
---|
| 46 | uint32_t * _nb_inst_fetch = new uint32_t [_nb_context]; |
---|
| 47 | for (uint32_t i=0;i<_nb_context; i++) |
---|
| 48 | _nb_inst_fetch [i] = fromString<uint32_t>(argv[x++]); |
---|
| 49 | |
---|
| 50 | uint32_t _nb_inst_decod = fromString<uint32_t >(argv[x++]); |
---|
| 51 | uint32_t _nb_branch_speculated = fromString<uint32_t >(argv[x++]); |
---|
| 52 | uint32_t _size_branch_update_prediction= fromString<uint32_t >(argv[x++]); |
---|
| 53 | uint32_t _nb_context_select = fromString<uint32_t >(argv[x++]); |
---|
| 54 | uint32_t _size_general_data = fromString<uint32_t >(argv[x++]); |
---|
| 55 | Tpriority_t _priority = fromString<Tpriority_t >(argv[x++]); |
---|
| 56 | Tload_balancing_t _load_balancing = fromString<Tload_balancing_t>(argv[x++]); |
---|
| 57 | |
---|
| 58 | bool ** _instruction_implemeted = new bool * [_nb_context]; |
---|
| 59 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 60 | { |
---|
| 61 | _instruction_implemeted [i] = new bool [NB_INSTRUCTION]; |
---|
| 62 | |
---|
| 63 | for (uint32_t j=0; j<NB_INSTRUCTION; j++) |
---|
| 64 | _instruction_implemeted [i][j] = true; |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | int _return = EXIT_SUCCESS; |
---|
| 68 | try |
---|
| 69 | { |
---|
| 70 | morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::decod_unit::decod::Parameters |
---|
| 71 | (_nb_context , |
---|
| 72 | _nb_inst_fetch , |
---|
| 73 | _nb_inst_decod , |
---|
| 74 | _nb_branch_speculated , |
---|
| 75 | _size_branch_update_prediction, |
---|
| 76 | _nb_context_select , |
---|
| 77 | _size_general_data , |
---|
| 78 | _priority , |
---|
| 79 | _load_balancing , |
---|
| 80 | _instruction_implemeted , |
---|
| 81 | NULL); |
---|
| 82 | |
---|
| 83 | msg(_("%s"),param->print(1).c_str()); |
---|
| 84 | |
---|
| 85 | test (name,param); |
---|
| 86 | } |
---|
| 87 | catch (morpheo::ErrorMorpheo & error) |
---|
| 88 | { |
---|
| 89 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 90 | _return = EXIT_FAILURE; |
---|
| 91 | } |
---|
| 92 | catch (...) |
---|
| 93 | { |
---|
| 94 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
| 95 | _return = EXIT_FAILURE; |
---|
| 96 | } |
---|
| 97 | |
---|
| 98 | delete _nb_inst_fetch; |
---|
| 99 | delete _instruction_implemeted; |
---|
| 100 | return (_return); |
---|
| 101 | } |
---|