[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/Decod_unit/Decod/SelfTest/include/test.h" |
---|
[86] | 9 | #include "Behavioural/Custom/include/Custom_example.h" |
---|
[78] | 10 | |
---|
[88] | 11 | #define NB_PARAMS 6 |
---|
[78] | 12 | |
---|
| 13 | void usage (int argc, char * argv[]) |
---|
| 14 | { |
---|
| 15 | err (_("<Usage> %s name_instance list_params.\n"),argv[0]); |
---|
| 16 | err (_("list_params is :\n")); |
---|
[88] | 17 | err (_(" * nb_context (uint32_t )\n")); |
---|
| 18 | err (_(" * nb_inst_fetch [nb_context] (uint32_t )\n")); |
---|
| 19 | err (_(" * nb_inst_decod (uint32_t )\n")); |
---|
| 20 | err (_(" * nb_branch_speculated [nb_context] (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")); |
---|
[78] | 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 | |
---|
[88] | 43 | if (argc != static_cast<int>(2+NB_PARAMS+2*_nb_context)) |
---|
[78] | 44 | usage (argc, argv); |
---|
| 45 | |
---|
[88] | 46 | uint32_t * _nb_inst_fetch = new uint32_t [_nb_context]; |
---|
[78] | 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++]); |
---|
[88] | 51 | |
---|
| 52 | uint32_t * _nb_branch_speculated = new uint32_t [_nb_context]; |
---|
| 53 | for (uint32_t i=0;i<_nb_context; i++) |
---|
| 54 | _nb_branch_speculated [i] = fromString<uint32_t>(argv[x++]); |
---|
| 55 | |
---|
| 56 | // uint32_t * _size_branch_update_prediction= new uint32_t [_nb_context]; |
---|
| 57 | // for (uint32_t i=0;i<_nb_context; i++) |
---|
| 58 | // _size_branch_update_prediction[i] = fromString<uint32_t>(argv[x++]); |
---|
| 59 | |
---|
[78] | 60 | uint32_t _nb_context_select = fromString<uint32_t >(argv[x++]); |
---|
| 61 | uint32_t _size_general_data = fromString<uint32_t >(argv[x++]); |
---|
| 62 | Tpriority_t _priority = fromString<Tpriority_t >(argv[x++]); |
---|
| 63 | Tload_balancing_t _load_balancing = fromString<Tload_balancing_t>(argv[x++]); |
---|
| 64 | |
---|
| 65 | bool ** _instruction_implemeted = new bool * [_nb_context]; |
---|
| 66 | for (uint32_t i=0; i<_nb_context; i++) |
---|
| 67 | { |
---|
| 68 | _instruction_implemeted [i] = new bool [NB_INSTRUCTION]; |
---|
| 69 | |
---|
| 70 | for (uint32_t j=0; j<NB_INSTRUCTION; j++) |
---|
[88] | 71 | _instruction_implemeted [i][j] = true; |
---|
[78] | 72 | } |
---|
| 73 | |
---|
| 74 | int _return = EXIT_SUCCESS; |
---|
| 75 | try |
---|
| 76 | { |
---|
| 77 | 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 |
---|
[88] | 78 | (_nb_context , |
---|
| 79 | _nb_inst_fetch , |
---|
| 80 | _nb_inst_decod , |
---|
| 81 | _nb_branch_speculated , |
---|
| 82 | // _size_branch_update_prediction, |
---|
| 83 | _nb_context_select , |
---|
| 84 | _size_general_data , |
---|
| 85 | _priority , |
---|
| 86 | _load_balancing , |
---|
| 87 | _instruction_implemeted , |
---|
| 88 | &(morpheo::behavioural::custom::example_get_custom_information), |
---|
| 89 | true // is_toplevel |
---|
| 90 | ); |
---|
[78] | 91 | |
---|
| 92 | msg(_("%s"),param->print(1).c_str()); |
---|
| 93 | |
---|
| 94 | test (name,param); |
---|
| 95 | } |
---|
| 96 | catch (morpheo::ErrorMorpheo & error) |
---|
| 97 | { |
---|
| 98 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 99 | _return = EXIT_FAILURE; |
---|
| 100 | } |
---|
| 101 | catch (...) |
---|
| 102 | { |
---|
| 103 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
| 104 | _return = EXIT_FAILURE; |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | delete _nb_inst_fetch; |
---|
| 108 | delete _instruction_implemeted; |
---|
[88] | 109 | delete _nb_branch_speculated; |
---|
| 110 | // delete _size_branch_update_prediction; |
---|
| 111 | |
---|
[78] | 112 | return (_return); |
---|
| 113 | } |
---|