Changeset 111 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest
- Timestamp:
- Feb 27, 2009, 7:37:40 PM (15 years ago)
- Location:
- trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest
- Files:
-
- 2 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/config_bht_only.cfg
r110 r111 1 1 Two_Level_Branch_Predictor 2 4 4 *2 # nb_inst_predict 3 4 4 *2 # nb_inst_update 4 30 30 *2 # size_address 5 1 1 +1 # have_bht 6 1 16 *4 # bht_size_shifter 7 1 16 *4 # bht_nb_shifter 8 0 0 +1 # have_pht 9 0 0 +1 # pht_size_counter 10 0 0 *2 # pht_nb_counter 11 0 0 +1 # pht_size_address_share 12 1 1 +1 # update_on_prediction -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h
r110 r111 11 11 #endif 12 12 13 #define NB_ITERATION 1 13 #define NB_ITERATION 16 14 14 #define CYCLE_MAX (1024*NB_ITERATION) 15 15 -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/main.cpp
r110 r111 7 7 8 8 #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/include/test.h" 9 #include "Behavioural/include/Selftest.h" 9 10 10 #define NB_PARAMS 011 #define NB_PARAMS 11 11 12 12 13 void usage (int argc, char * argv[]) … … 14 15 err (_("<Usage> %s name_instance list_params.\n"),argv[0]); 15 16 err (_("list_params is :\n")); 16 err (_(" * ()\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 (bool )\n")); 21 err (_(" * bht_size_shifter (uint32_t)\n")); 22 err (_(" * bht_nb_shifter (uint32_t)\n")); 23 err (_(" * have_pht (bool )\n")); 24 err (_(" * pht_size_counter (uint32_t)\n")); 25 err (_(" * pht_nb_counter (uint32_t)\n")); 26 err (_(" * pht_size_address_share (uint32_t)\n")); 27 err (_(" * update_on_prediction (bool )\n")); 17 28 18 29 exit (1); … … 32 43 string name = argv[x++]; 33 44 45 uint32_t nb_inst_predict ; 46 uint32_t nb_inst_update ; 47 uint32_t size_address ; 48 bool have_bht ; 49 uint32_t bht_size_shifter ; 50 uint32_t bht_nb_shifter ; 51 bool have_pht ; 52 uint32_t pht_size_counter ; 53 uint32_t pht_nb_counter ; 54 uint32_t pht_size_address_share; 55 bool update_on_prediction ; 56 57 SELFTEST0(nb_inst_predict ,uint32_t,argv,x); 58 SELFTEST0(nb_inst_update ,uint32_t,argv,x); 59 SELFTEST0(size_address ,uint32_t,argv,x); 60 SELFTEST0(have_bht ,bool ,argv,x); 61 SELFTEST0(bht_size_shifter ,uint32_t,argv,x); 62 SELFTEST0(bht_nb_shifter ,uint32_t,argv,x); 63 SELFTEST0(have_pht ,bool ,argv,x); 64 SELFTEST0(pht_size_counter ,uint32_t,argv,x); 65 SELFTEST0(pht_nb_counter ,uint32_t,argv,x); 66 SELFTEST0(pht_size_address_share,uint32_t,argv,x); 67 SELFTEST0(update_on_prediction ,bool ,argv,x); 68 34 69 int _return = EXIT_SUCCESS; 35 70 try … … 37 72 morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters * param = new morpheo::behavioural::core::multi_front_end::front_end::prediction_unit::direction::meta_predictor::two_level_branch_predictor::Parameters 38 73 ( 74 nb_inst_predict , 75 nb_inst_update , 76 size_address , 77 have_bht , 78 bht_size_shifter , 79 bht_nb_shifter , 80 have_pht , 81 pht_size_counter , 82 pht_nb_counter , 83 pht_size_address_share, 84 update_on_prediction , 39 85 true //is_toplevel 40 86 ); -
trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/SelfTest/src/test.cpp
r110 r111 50 50 sc_clock * in_CLOCK = new sc_clock ("clock", 1.0, 0.5); 51 51 sc_signal<Tcontrol_t> * in_NRESET = new sc_signal<Tcontrol_t> ("NRESET"); 52 53 ALLOC1_SC_SIGNAL( in_PREDICT_VAL ," in_PREDICT_VAL ",Tcontrol_t,_param->_nb_inst_predict); 54 ALLOC1_SC_SIGNAL(out_PREDICT_ACK ,"out_PREDICT_ACK ",Tcontrol_t,_param->_nb_inst_predict); 55 ALLOC1_SC_SIGNAL( in_PREDICT_ADDRESS ," in_PREDICT_ADDRESS ",Taddress_t,_param->_nb_inst_predict); 56 ALLOC1_SC_SIGNAL(out_PREDICT_DIRECTION ,"out_PREDICT_DIRECTION ",Tcontrol_t,_param->_nb_inst_predict); 57 ALLOC1_SC_SIGNAL(out_PREDICT_HISTORY ,"out_PREDICT_HISTORY ",Thistory_t,_param->_nb_inst_predict); 58 ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL," in_PREDICT_DIRECTION_VAL",Tcontrol_t,_param->_nb_inst_predict); 59 ALLOC1_SC_SIGNAL( in_PREDICT_DIRECTION ," in_PREDICT_DIRECTION ",Tcontrol_t,_param->_nb_inst_predict); 60 61 ALLOC1_SC_SIGNAL( in_UPDATE_VAL ," in_UPDATE_VAL ",Tcontrol_t,_param->_nb_inst_update); 62 ALLOC1_SC_SIGNAL(out_UPDATE_ACK ,"out_UPDATE_ACK ",Tcontrol_t,_param->_nb_inst_update); 63 ALLOC1_SC_SIGNAL( in_UPDATE_ADDRESS ," in_UPDATE_ADDRESS ",Taddress_t,_param->_nb_inst_update); 64 ALLOC1_SC_SIGNAL( in_UPDATE_HISTORY ," in_UPDATE_HISTORY ",Thistory_t,_param->_nb_inst_update); 65 ALLOC1_SC_SIGNAL( in_UPDATE_DIRECTION ," in_UPDATE_DIRECTION ",Tcontrol_t,_param->_nb_inst_update); 66 ALLOC1_SC_SIGNAL( in_UPDATE_MISS ," in_UPDATE_MISS ",Tcontrol_t,_param->_nb_inst_update); 52 67 53 68 /******************************************************** … … 60 75 (*(_Two_Level_Branch_Predictor->in_NRESET)) (*(in_NRESET)); 61 76 77 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_VAL ,_param->_nb_inst_predict); 78 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_ACK ,_param->_nb_inst_predict); 79 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_ADDRESS ,_param->_nb_inst_predict); 80 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_DIRECTION ,_param->_nb_inst_predict); 81 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_PREDICT_HISTORY ,_param->_nb_inst_predict); 82 if (_param->_update_on_prediction) 83 { 84 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict); 85 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_PREDICT_DIRECTION ,_param->_nb_inst_predict); 86 } 87 88 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_VAL ,_param->_nb_inst_update); 89 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor,out_UPDATE_ACK ,_param->_nb_inst_update); 90 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_ADDRESS ,_param->_nb_inst_update); 91 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_HISTORY ,_param->_nb_inst_update); 92 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_DIRECTION ,_param->_nb_inst_update); 93 if (_param->_update_on_prediction) 94 INSTANCE1_SC_SIGNAL(_Two_Level_Branch_Predictor, in_UPDATE_MISS ,_param->_nb_inst_update); 62 95 63 96 msg(_("<%s> : Start Simulation ............\n"),name.c_str()); … … 76 109 srand(seed); 77 110 111 const int32_t percent_transaction_predict = 75; 112 const int32_t percent_transaction_update = 75; 113 78 114 SC_START(0); 79 115 LABEL("Initialisation"); 116 117 for (uint32_t i=0; i<_param->_nb_inst_predict; ++i) 118 in_PREDICT_VAL [i]->write(0); 119 for (uint32_t i=0; i<_param->_nb_inst_update; ++i) 120 in_UPDATE_VAL [i]->write(0); 80 121 81 122 LABEL("Reset"); … … 85 126 86 127 LABEL("Loop of Test"); 87 128 129 Thistory_t bht; 130 Thistory_t pht [_param->_pht_size_bank]; 131 88 132 for (uint32_t iteration=0; iteration<NB_ITERATION; iteration ++) 89 133 { 90 134 LABEL("Iteration %d",iteration); 91 135 136 uint32_t bht_num_reg = (_param->_have_bht)?(rand()%_param->_bht_nb_shifter):0; 137 uint32_t pht_num_bank = (_param->_have_pht)?(rand()%_param->_pht_nb_bank ):0; 138 139 LABEL(" * bht_num_reg : %d",bht_num_reg ); 140 LABEL(" * pht_num_bank : %d",pht_num_bank); 141 142 { 143 LABEL("Init BHT and PHT"); 144 145 bht = 0; 146 for (uint32_t i=0; i<_param->_pht_size_bank; ++i) 147 pht [i] = 0; 148 149 uint32_t port = rand()%_param->_nb_inst_update; 150 151 if (_param->_have_bht) 152 { 153 bool find = false; 154 while (not find) 155 { 156 bool val = ((rand()%2)<percent_transaction_update); 157 in_UPDATE_VAL [port]->write(val); 158 in_UPDATE_DIRECTION [port]->write(0); 159 160 if (_param->_update_on_prediction) 161 in_UPDATE_MISS [port]->write(1); // miss 162 in_UPDATE_HISTORY [port]->write(0); 163 in_UPDATE_ADDRESS [port]->write(bht_num_reg); 164 165 SC_START(0); 166 167 if (val and out_UPDATE_ACK [port]->read()) 168 { 169 LABEL("UPDATE[%d] - Transaction accepted",port); 170 find = true; 171 } 172 173 SC_START(1); 174 } 175 in_UPDATE_VAL [port]->write(0); 176 } 177 178 if (_param->_have_pht) 179 { 180 for (uint32_t i=0; i<_param->_pht_size_bank; ++i) 181 { 182 bool find = false; 183 184 while (not find) 185 { 186 bool val = ((rand()%2)<percent_transaction_update); 187 in_UPDATE_VAL [port]->write(val); 188 in_UPDATE_DIRECTION [port]->write(0); 189 190 if (_param->_update_on_prediction) 191 in_UPDATE_MISS [port]->write(1); // miss 192 in_UPDATE_HISTORY [port]->write(i<<_param->_bht_history_rshift); 193 in_UPDATE_ADDRESS [port]->write(pht_num_bank<<_param->_pht_address_bank_rshift); 194 195 SC_START(0); 196 197 if (val and out_UPDATE_ACK [port]->read()) 198 { 199 LABEL("UPDATE[%d] - Transaction accepted",port); 200 find = true; 201 } 202 203 SC_START(1); 204 } 205 in_UPDATE_VAL [port]->write(0); 206 } 207 } 208 } 209 210 // if (1) 211 // { 212 // LABEL("Saturation all PHT"); 213 214 // } 215 92 216 SC_START(1); 93 217 } … … 104 228 delete in_CLOCK; 105 229 delete in_NRESET; 230 231 DELETE1_SC_SIGNAL( in_PREDICT_VAL ,_param->_nb_inst_predict); 232 DELETE1_SC_SIGNAL(out_PREDICT_ACK ,_param->_nb_inst_predict); 233 DELETE1_SC_SIGNAL( in_PREDICT_ADDRESS ,_param->_nb_inst_predict); 234 DELETE1_SC_SIGNAL(out_PREDICT_DIRECTION ,_param->_nb_inst_predict); 235 DELETE1_SC_SIGNAL(out_PREDICT_HISTORY ,_param->_nb_inst_predict); 236 DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION_VAL,_param->_nb_inst_predict); 237 DELETE1_SC_SIGNAL( in_PREDICT_DIRECTION ,_param->_nb_inst_predict); 238 239 DELETE1_SC_SIGNAL( in_UPDATE_VAL ,_param->_nb_inst_update); 240 DELETE1_SC_SIGNAL(out_UPDATE_ACK ,_param->_nb_inst_update); 241 DELETE1_SC_SIGNAL( in_UPDATE_ADDRESS ,_param->_nb_inst_update); 242 DELETE1_SC_SIGNAL( in_UPDATE_HISTORY ,_param->_nb_inst_update); 243 DELETE1_SC_SIGNAL( in_UPDATE_DIRECTION ,_param->_nb_inst_update); 244 DELETE1_SC_SIGNAL( in_UPDATE_MISS ,_param->_nb_inst_update); 106 245 } 107 246 #endif
Note: See TracChangeset
for help on using the changeset viewer.