[78] | 1 | /* |
---|
| 2 | * $Id: main.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Rename_unit/Load_Store_pointer_unit/SelfTest/include/test.h" |
---|
| 9 | |
---|
| 10 | #define NB_PARAMS 4 |
---|
| 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_front_end (uint32_t)\n")); |
---|
| 17 | err (_(" * nb_context [nb_front_end] (uint32_t)\n")); |
---|
| 18 | err (_(" * nb_load_store_queue (uint32_t)\n")); |
---|
| 19 | err (_(" * size_store_queue [nb_load_store_queue] (uint32_t)\n")); |
---|
| 20 | err (_(" * size_load_queue [nb_load_store_queue] (uint32_t)\n")); |
---|
| 21 | err (_(" * link_load_store_unit_with_thread [nb_front_end][nb_context](uint32_t)\n")); |
---|
| 22 | err (_(" * nb_inst_insert (uint32_t)\n")); |
---|
| 23 | err (_(" * nb_inst_retire (uint32_t)\n")); |
---|
| 24 | exit (1); |
---|
| 25 | } |
---|
| 26 | |
---|
| 27 | #ifndef SYSTEMC |
---|
| 28 | int main (int argc, char * argv[]) |
---|
| 29 | #else |
---|
| 30 | int sc_main (int argc, char * argv[]) |
---|
| 31 | #endif |
---|
| 32 | { |
---|
| 33 | if (argc < static_cast<int>(2+NB_PARAMS)) |
---|
| 34 | usage (argc, argv); |
---|
| 35 | |
---|
| 36 | uint32_t x = 1; |
---|
| 37 | |
---|
| 38 | string name = argv[x++]; |
---|
| 39 | |
---|
| 40 | uint32_t _nb_front_end = atoi(argv[x++]); |
---|
| 41 | |
---|
| 42 | if (argc < static_cast<int>(2+NB_PARAMS+_nb_front_end)) |
---|
| 43 | usage (argc, argv); |
---|
| 44 | |
---|
| 45 | uint32_t * _nb_context = new uint32_t [_nb_front_end]; |
---|
| 46 | uint32_t nb_thread = 0; |
---|
| 47 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
| 48 | { |
---|
| 49 | _nb_context [i] = atoi(argv[x++]); |
---|
| 50 | nb_thread += _nb_context [i]; |
---|
| 51 | } |
---|
| 52 | |
---|
| 53 | uint32_t _nb_load_store_queue = atoi(argv[x++]); |
---|
| 54 | |
---|
| 55 | if (argc != static_cast<int>(2+NB_PARAMS+_nb_front_end+2*_nb_load_store_queue+nb_thread)) |
---|
| 56 | usage (argc, argv); |
---|
| 57 | |
---|
| 58 | uint32_t * _size_store_queue = new uint32_t [_nb_load_store_queue]; |
---|
| 59 | uint32_t * _size_load_queue = new uint32_t [_nb_load_store_queue]; |
---|
| 60 | |
---|
| 61 | for (uint32_t i=0; i<_nb_load_store_queue; i++) |
---|
| 62 | _size_store_queue [i] = atoi(argv[x++]); |
---|
| 63 | for (uint32_t i=0; i<_nb_load_store_queue; i++) |
---|
| 64 | _size_load_queue [i] = atoi(argv[x++]); |
---|
| 65 | |
---|
| 66 | uint32_t ** _link_load_store_unit_with_thread = new uint32_t * [_nb_front_end]; |
---|
| 67 | for (uint32_t i=0; i<_nb_front_end; i++) |
---|
| 68 | { |
---|
| 69 | _link_load_store_unit_with_thread [i] = new uint32_t [_nb_context[i]]; |
---|
| 70 | for (uint32_t j=0; j<_nb_context[i]; j++) |
---|
| 71 | _link_load_store_unit_with_thread [i][j] = atoi(argv[x++]); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | uint32_t _nb_inst_insert = atoi(argv[x++]); |
---|
| 75 | uint32_t _nb_inst_retire = atoi(argv[x++]); |
---|
| 76 | |
---|
| 77 | int _return = EXIT_SUCCESS; |
---|
| 78 | try |
---|
| 79 | { |
---|
| 80 | morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters * param = new morpheo::behavioural::core::multi_ooo_engine::ooo_engine::rename_unit::load_store_pointer_unit::Parameters |
---|
| 81 | (_nb_front_end , |
---|
| 82 | _nb_context , |
---|
| 83 | _nb_load_store_queue , |
---|
| 84 | _size_store_queue , |
---|
| 85 | _size_load_queue , |
---|
| 86 | _link_load_store_unit_with_thread, |
---|
| 87 | _nb_inst_insert , |
---|
| 88 | _nb_inst_retire ); |
---|
| 89 | |
---|
| 90 | msg(_("%s"),param->print(1).c_str()); |
---|
| 91 | |
---|
| 92 | test (name,param); |
---|
| 93 | } |
---|
| 94 | catch (morpheo::ErrorMorpheo & error) |
---|
| 95 | { |
---|
| 96 | msg (_("<%s> :\n%s"),name.c_str(), error.what ()); |
---|
| 97 | _return = EXIT_FAILURE; |
---|
| 98 | } |
---|
| 99 | catch (...) |
---|
| 100 | { |
---|
| 101 | err (_("<%s> : This test must generate a error.\n"),name.c_str()); |
---|
| 102 | _return = EXIT_FAILURE; |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | return (_return); |
---|
| 106 | } |
---|