[60] | 1 | /* |
---|
| 2 | * $Id: main.cpp 88 2008-12-10 18:31:39Z rosiere $ |
---|
| 3 | * |
---|
| 4 | * [ Description ] |
---|
| 5 | * |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include "Behavioural/Core/Multi_Execute_loop/Execute_loop/Register_unit/SelfTest/include/test.h" |
---|
| 9 | |
---|
| 10 | #define NB_PARAMS 13 |
---|
| 11 | |
---|
| 12 | void usage (int argc, char * argv[]) |
---|
| 13 | { |
---|
| 14 | cerr << "<Usage> " << argv[0] << " name_instance list_params" << endl |
---|
| 15 | << "list_params is :" << endl |
---|
| 16 | << " - nb_ooo_engine (uint32_t)" << endl |
---|
| 17 | << " - size_general_data (uint32_t)" << endl |
---|
| 18 | << " - size_special_data (uint32_t)" << endl |
---|
| 19 | << " - nb_gpr_read (uint32_t)" << endl |
---|
| 20 | << " - nb_gpr_write (uint32_t)" << endl |
---|
| 21 | << " - nb_gpr_bank (uint32_t)" << endl |
---|
| 22 | << " - nb_gpr_port_read_by_bank (uint32_t)" << endl |
---|
| 23 | << " - nb_gpr_port_write_by_bank (uint32_t)" << endl |
---|
| 24 | << " - nb_spr_read (uint32_t)" << endl |
---|
| 25 | << " - nb_spr_write (uint32_t)" << endl |
---|
| 26 | << " - nb_spr_bank (uint32_t)" << endl |
---|
| 27 | << " - nb_spr_port_read_by_bank (uint32_t)" << endl |
---|
| 28 | << " - nb_spr_port_write_by_bank (uint32_t)" << endl |
---|
| 29 | << " - nb_general_register [nb_ooo_engine] (uint32_t)" << endl |
---|
| 30 | << " - nb_special_register [nb_ooo_engine] (uint32_t)" << endl |
---|
| 31 | << " - nb_inst_insert_rob [nb_ooo_engine] (uint32_t)" << endl |
---|
| 32 | << " - nb_inst_retire_rob [nb_ooo_engine] (uint32_t)" << endl |
---|
| 33 | << "" << endl; |
---|
| 34 | |
---|
| 35 | for (int i=0; i<argc; i++) |
---|
| 36 | cerr << argv[i] << " "; |
---|
| 37 | cerr << endl; |
---|
| 38 | |
---|
| 39 | exit (1); |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | #ifndef SYSTEMC |
---|
| 43 | int main (int argc, char * argv[]) |
---|
| 44 | #else |
---|
| 45 | int sc_main (int argc, char * argv[]) |
---|
| 46 | #endif |
---|
| 47 | { |
---|
| 48 | if (argc < 2+NB_PARAMS) |
---|
| 49 | usage (argc, argv); |
---|
| 50 | |
---|
| 51 | const string name = argv[1]; |
---|
| 52 | //const uint32_t size_data = atoi(argv[2]); |
---|
| 53 | //const uint32_t nb_port = atoi(argv[3]); |
---|
| 54 | uint32_t _nb_ooo_engine = atoi(argv[ 2]); |
---|
| 55 | uint32_t _size_general_data = atoi(argv[ 3]); |
---|
| 56 | uint32_t _size_special_data = atoi(argv[ 4]); |
---|
| 57 | uint32_t _nb_gpr_read = atoi(argv[ 5]); |
---|
| 58 | uint32_t _nb_gpr_write = atoi(argv[ 6]); |
---|
| 59 | uint32_t _nb_gpr_bank = atoi(argv[ 7]); |
---|
| 60 | uint32_t _nb_gpr_port_read_by_bank = atoi(argv[ 8]); |
---|
| 61 | uint32_t _nb_gpr_port_write_by_bank = atoi(argv[ 9]); |
---|
| 62 | uint32_t _nb_spr_read = atoi(argv[10]); |
---|
| 63 | uint32_t _nb_spr_write = atoi(argv[11]); |
---|
| 64 | uint32_t _nb_spr_bank = atoi(argv[12]); |
---|
| 65 | uint32_t _nb_spr_port_read_by_bank = atoi(argv[13]); |
---|
| 66 | uint32_t _nb_spr_port_write_by_bank = atoi(argv[14]); |
---|
| 67 | |
---|
| 68 | if (argc != 2+NB_PARAMS+static_cast<int>(4*_nb_ooo_engine)) |
---|
| 69 | usage (argc, argv); |
---|
| 70 | |
---|
| 71 | uint32_t * _nb_general_register = new uint32_t [_nb_ooo_engine]; |
---|
| 72 | uint32_t * _nb_special_register = new uint32_t [_nb_ooo_engine]; |
---|
| 73 | uint32_t * _nb_inst_insert_rob = new uint32_t [_nb_ooo_engine]; |
---|
| 74 | uint32_t * _nb_inst_retire_rob = new uint32_t [_nb_ooo_engine]; |
---|
| 75 | |
---|
| 76 | uint32_t x = 15; |
---|
| 77 | |
---|
| 78 | for (uint32_t i=0; i<_nb_ooo_engine; i++) |
---|
| 79 | _nb_general_register [i] = atoi(argv[x++]); |
---|
| 80 | for (uint32_t i=0; i<_nb_ooo_engine; i++) |
---|
| 81 | _nb_special_register [i] = atoi(argv[x++]); |
---|
| 82 | for (uint32_t i=0; i<_nb_ooo_engine; i++) |
---|
| 83 | _nb_inst_insert_rob [i] = atoi(argv[x++]); |
---|
| 84 | for (uint32_t i=0; i<_nb_ooo_engine; i++) |
---|
| 85 | _nb_inst_retire_rob [i] = atoi(argv[x++]); |
---|
| 86 | |
---|
| 87 | try |
---|
| 88 | { |
---|
| 89 | morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters * param = new morpheo::behavioural::core::multi_execute_loop::execute_loop::register_unit::Parameters |
---|
| 90 | (_nb_ooo_engine , |
---|
| 91 | _size_general_data , |
---|
| 92 | _size_special_data , |
---|
| 93 | _nb_gpr_read , |
---|
| 94 | _nb_gpr_write , |
---|
| 95 | _nb_gpr_bank , |
---|
| 96 | _nb_gpr_port_read_by_bank , |
---|
| 97 | _nb_gpr_port_write_by_bank , |
---|
| 98 | _nb_spr_read , |
---|
| 99 | _nb_spr_write , |
---|
| 100 | _nb_spr_bank , |
---|
| 101 | _nb_spr_port_read_by_bank , |
---|
| 102 | _nb_spr_port_write_by_bank , |
---|
| 103 | _nb_general_register , |
---|
| 104 | _nb_special_register , |
---|
| 105 | _nb_inst_insert_rob , |
---|
[88] | 106 | _nb_inst_retire_rob , |
---|
| 107 | true //is_toplevel |
---|
| 108 | ); |
---|
[60] | 109 | |
---|
| 110 | cout << param->print(1); |
---|
| 111 | |
---|
| 112 | test (name,param); |
---|
| 113 | } |
---|
| 114 | catch (morpheo::ErrorMorpheo & error) |
---|
| 115 | { |
---|
| 116 | cout << "<" << name << "> : " << error.what (); |
---|
| 117 | exit (EXIT_FAILURE); |
---|
| 118 | } |
---|
| 119 | catch (...) |
---|
| 120 | { |
---|
| 121 | cerr << "<" << name << "> : This test must generate a error" << endl; |
---|
| 122 | exit (EXIT_FAILURE); |
---|
| 123 | } |
---|
| 124 | |
---|
| 125 | return (EXIT_SUCCESS); |
---|
| 126 | } |
---|
| 127 | |
---|