[78] | 1 | /* |
---|
| 2 | * $Id: main.cpp 146 2011-02-01 20:57:54Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/SelfTest/include/test.h" |
---|
| 9 | |
---|
[146] | 10 | #define NB_PARAMS 28 |
---|
[78] | 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")); |
---|
[146] | 16 | err (_(" * predictor_scheme (Tpredictor_t )\n")); |
---|
| 17 | err (_(" * nb_inst_predict (uint32_t )\n")); |
---|
| 18 | err (_(" * nb_inst_update (uint32_t )\n")); |
---|
| 19 | err (_(" * size_address (uint32_t )\n")); |
---|
| 20 | err (_(" * have_bht [3] (bool )\n")); |
---|
| 21 | err (_(" * bht_size_shifter [3] (uint32_t )\n")); |
---|
| 22 | err (_(" * bht_nb_shifter [3] (uint32_t )\n")); |
---|
| 23 | err (_(" * have_pht [3] (bool )\n")); |
---|
| 24 | err (_(" * pht_size_counter [3] (uint32_t )\n")); |
---|
| 25 | err (_(" * pht_nb_counter [3] (uint32_t )\n")); |
---|
| 26 | err (_(" * pht_size_address_share [3] (uint32_t )\n")); |
---|
| 27 | err (_(" * pht_scheme [3] (Tpht_scheme_t)\n")); |
---|
[78] | 28 | |
---|
| 29 | exit (1); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | #ifndef SYSTEMC |
---|
| 33 | int main (int argc, char * argv[]) |
---|
| 34 | #else |
---|
| 35 | int sc_main (int argc, char * argv[]) |
---|
| 36 | #endif |
---|
| 37 | { |
---|
| 38 | if (argc != static_cast<int>(2+NB_PARAMS)) |
---|
| 39 | usage (argc, argv); |
---|
| 40 | |
---|
| 41 | uint32_t x = 1; |
---|
| 42 | |
---|
| 43 | string name = argv[x++]; |
---|
| 44 | |
---|
[146] | 45 | Tpredictor_t _predictor_scheme = fromString<Tpredictor_t>(argv[x++]); |
---|
| 46 | uint32_t _nb_inst_predict = fromString<uint32_t >(argv[x++]); |
---|
| 47 | uint32_t _nb_inst_update = fromString<uint32_t >(argv[x++]); |
---|
| 48 | uint32_t _size_address = fromString<uint32_t >(argv[x++]); |
---|
| 49 | bool _have_bht [3]; |
---|
| 50 | uint32_t _bht_size_shifter [3]; |
---|
| 51 | uint32_t _bht_nb_shifter [3]; |
---|
| 52 | bool _have_pht [3]; |
---|
| 53 | uint32_t _pht_size_counter [3]; |
---|
| 54 | uint32_t _pht_nb_counter [3]; |
---|
| 55 | uint32_t _pht_size_address_share [3]; |
---|
| 56 | Tpht_scheme_t _pht_scheme [3]; |
---|
[78] | 57 | |
---|
| 58 | for (uint32_t i=0; i<3; i++) |
---|
| 59 | { |
---|
[146] | 60 | _have_bht [i] = fromString<bool >(argv[x++]); |
---|
| 61 | _bht_size_shifter [i] = fromString<uint32_t >(argv[x++]); |
---|
| 62 | _bht_nb_shifter [i] = fromString<uint32_t >(argv[x++]); |
---|
| 63 | _have_pht [i] = fromString<bool >(argv[x++]); |
---|
| 64 | _pht_size_counter [i] = fromString<uint32_t >(argv[x++]); |
---|
| 65 | _pht_nb_counter [i] = fromString<uint32_t >(argv[x++]); |
---|
| 66 | _pht_size_address_share [i] = fromString<uint32_t >(argv[x++]); |
---|
| 67 | _pht_scheme [i] = fromString<Tpht_scheme_t >(argv[x++]); |
---|
[78] | 68 | } |
---|
| 69 | |
---|
| 70 | int _return = EXIT_SUCCESS; |
---|
| 71 | try |
---|
| 72 | { |
---|
| 73 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::Parameters |
---|
| 74 | (_predictor_scheme , |
---|
| 75 | _nb_inst_predict , |
---|
| 76 | _nb_inst_update , |
---|
| 77 | _size_address , |
---|
| 78 | _have_bht , |
---|
| 79 | _bht_size_shifter , |
---|
| 80 | _bht_nb_shifter , |
---|
| 81 | _have_pht , |
---|
| 82 | _pht_size_counter , |
---|
| 83 | _pht_nb_counter , |
---|
[88] | 84 | _pht_size_address_share, |
---|
[146] | 85 | _pht_scheme , |
---|
[88] | 86 | true // is_toplevel |
---|
| 87 | ); |
---|
[78] | 88 | |
---|
| 89 | msg(_("%s"),param->print(1).c_str()); |
---|
| 90 | |
---|
| 91 | test (name,param); |
---|
| 92 | } |
---|
| 93 | catch (morpheo::ErrorMorpheo & error) |
---|
| 94 | { |
---|
| 95 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 96 | _return = EXIT_FAILURE; |
---|
| 97 | } |
---|
| 98 | catch (...) |
---|
| 99 | { |
---|
| 100 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
| 101 | _return = EXIT_FAILURE; |
---|
| 102 | } |
---|
| 103 | |
---|
| 104 | return (_return); |
---|
| 105 | } |
---|