1 | /* |
---|
2 | * $Id: main.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h" |
---|
9 | |
---|
10 | #define NB_PARAMS 10 |
---|
11 | |
---|
12 | void usage (string exec) |
---|
13 | { |
---|
14 | cerr << "<Usage> " << exec << " name_instance list_params" << endl |
---|
15 | << "list_params is :" << endl |
---|
16 | << " - have_bht (boolean )" << endl |
---|
17 | << " - bht_size_shifter (unsigned int)" << endl |
---|
18 | << " - bht_nb_shifter (unsigned int)" << endl |
---|
19 | << " - have_pht (boolean )" << endl |
---|
20 | << " - pht_size_counter (unsigned int)" << endl |
---|
21 | << " - pht_nb_counter (unsigned int)" << endl |
---|
22 | << " - pht_size_address_share (unsigned int)" << endl |
---|
23 | << " - size_address (unsigned int)" << endl |
---|
24 | << " - nb_prediction (unsigned int)" << endl |
---|
25 | << " - nb_branch_complete (unsigned int)" << endl; |
---|
26 | |
---|
27 | exit (1); |
---|
28 | } |
---|
29 | |
---|
30 | #ifndef SYSTEMC |
---|
31 | int main (int argc, char * argv[]) |
---|
32 | #else |
---|
33 | int sc_main (int argc, char * argv[]) |
---|
34 | #endif |
---|
35 | { |
---|
36 | cout << "<test0> : Classic usage" << endl; |
---|
37 | |
---|
38 | if (argc != 2+NB_PARAMS) |
---|
39 | usage (argv[0]); |
---|
40 | |
---|
41 | const string name = argv[1]; |
---|
42 | const bool have_bht = atoi(argv[ 2]); |
---|
43 | const uint32_t bht_size_shifter = atoi(argv[ 3]); |
---|
44 | const uint32_t bht_nb_shifter = atoi(argv[ 4]); |
---|
45 | const bool have_pht = atoi(argv[ 5]); |
---|
46 | const uint32_t pht_size_counter = atoi(argv[ 6]); |
---|
47 | const uint32_t pht_nb_counter = atoi(argv[ 7]); |
---|
48 | const uint32_t pht_size_address_share = atoi(argv[ 8]); |
---|
49 | const uint32_t size_address = atoi(argv[ 9]); |
---|
50 | const uint32_t nb_prediction = atoi(argv[10]); |
---|
51 | const uint32_t nb_branch_complete = atoi(argv[11]); |
---|
52 | |
---|
53 | try |
---|
54 | { |
---|
55 | morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters param (have_bht , |
---|
56 | bht_size_shifter , |
---|
57 | bht_nb_shifter , |
---|
58 | have_pht , |
---|
59 | pht_size_counter , |
---|
60 | pht_nb_counter , |
---|
61 | pht_size_address_share , |
---|
62 | size_address , |
---|
63 | nb_prediction , |
---|
64 | nb_branch_complete ); |
---|
65 | |
---|
66 | cout << param.print(1); |
---|
67 | |
---|
68 | test (name,param); |
---|
69 | } |
---|
70 | catch (morpheo::ErrorMorpheo & error) |
---|
71 | { |
---|
72 | cout << "<" << name << "> : " << error.what (); |
---|
73 | exit (EXIT_FAILURE); |
---|
74 | } |
---|
75 | catch (...) |
---|
76 | { |
---|
77 | cerr << "<" << name << "> : This test must generate a error" << endl; |
---|
78 | exit (EXIT_FAILURE); |
---|
79 | } |
---|
80 | |
---|
81 | return (EXIT_SUCCESS); |
---|
82 | } |
---|
83 | |
---|