Changeset 3 for trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Branch_History_Table/SelfTest/src
- Timestamp:
- Mar 6, 2007, 3:34:04 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/IPs/systemC/processor/Morpheo/Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Branch_History_Table/SelfTest/src/test.cpp
r2 r3 46 46 *********************************************************************/ 47 47 sc_clock CLOCK ("clock", 1.0, 0.5); 48 sc_signal<Tcontrol_t> PREDICT_VAL [param._nb_prediction];49 sc_signal<Tcontrol_t> PREDICT_ACK [param._nb_prediction];50 sc_signal<Taddress_t> PREDICT_ADDRESS [param._nb_prediction];51 sc_signal<Thistory_t> PREDICT_HISTORY [param._nb_prediction];52 53 sc_signal<Tcontrol_t> BRANCH_COMPLETE_VAL [param._nb_branch_complete];54 sc_signal<Tcontrol_t> BRANCH_COMPLETE_ACK [param._nb_branch_complete];55 sc_signal<Taddress_t> BRANCH_COMPLETE_ADDRESS [param._nb_branch_complete];56 sc_signal<Thistory_t> BRANCH_COMPLETE_HISTORY [param._nb_branch_complete];57 sc_signal<Tcontrol_t> BRANCH_COMPLETE_ HIT[param._nb_branch_complete];48 sc_signal<Tcontrol_t> PREDICT_VAL [param._nb_prediction]; 49 sc_signal<Tcontrol_t> PREDICT_ACK [param._nb_prediction]; 50 sc_signal<Taddress_t> PREDICT_ADDRESS [param._nb_prediction]; 51 sc_signal<Thistory_t> PREDICT_HISTORY [param._nb_prediction]; 52 53 sc_signal<Tcontrol_t> BRANCH_COMPLETE_VAL [param._nb_branch_complete]; 54 sc_signal<Tcontrol_t> BRANCH_COMPLETE_ACK [param._nb_branch_complete]; 55 sc_signal<Taddress_t> BRANCH_COMPLETE_ADDRESS [param._nb_branch_complete]; 56 sc_signal<Thistory_t> BRANCH_COMPLETE_HISTORY [param._nb_branch_complete]; 57 sc_signal<Tcontrol_t> BRANCH_COMPLETE_DIRECTION [param._nb_branch_complete]; 58 58 59 59 /******************************************************** … … 75 75 for (uint32_t i=0; i<param._nb_branch_complete; i++) 76 76 { 77 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_VAL [i])) (BRANCH_COMPLETE_VAL[i]);78 (*(_Branch_History_Table->out_BRANCH_COMPLETE_ACK [i])) (BRANCH_COMPLETE_ACK[i]);79 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_ADDRESS [i])) (BRANCH_COMPLETE_ADDRESS[i]);80 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_HISTORY [i])) (BRANCH_COMPLETE_HISTORY[i]);81 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_ HIT [i])) (BRANCH_COMPLETE_HIT[i]);77 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_VAL [i])) (BRANCH_COMPLETE_VAL [i]); 78 (*(_Branch_History_Table->out_BRANCH_COMPLETE_ACK [i])) (BRANCH_COMPLETE_ACK [i]); 79 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_ADDRESS [i])) (BRANCH_COMPLETE_ADDRESS [i]); 80 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_HISTORY [i])) (BRANCH_COMPLETE_HISTORY [i]); 81 (*(_Branch_History_Table-> in_BRANCH_COMPLETE_DIRECTION [i])) (BRANCH_COMPLETE_DIRECTION [i]); 82 82 } 83 83 … … 108 108 Thistory_t history = 0; 109 109 Thistory_t mask = gen_mask <Thistory_t> (param._size_shifter); 110 Tcontrol_t hit= 0;110 Tcontrol_t direction = 0; 111 111 112 112 while (address<param._nb_shifter) 113 113 { 114 BRANCH_COMPLETE_VAL [0].write(1);115 BRANCH_COMPLETE_ADDRESS [0].write(address);116 BRANCH_COMPLETE_HISTORY [0].write(0);117 BRANCH_COMPLETE_ HIT[0].write(0);114 BRANCH_COMPLETE_VAL [0].write(1); 115 BRANCH_COMPLETE_ADDRESS [0].write(address); 116 BRANCH_COMPLETE_HISTORY [0].write(0); 117 BRANCH_COMPLETE_DIRECTION [0].write(0); 118 118 119 119 sc_start(1); … … 136 136 address = rand() % param._nb_shifter ; 137 137 history = rand() % (1<<param._size_shifter) ; 138 hit= rand() % 2;138 direction = rand() % 2; 139 139 140 140 cout << "{"+toString(static_cast<uint32_t>(sc_simulation_time()))+"} ["+toString(num_port_branch_complete)+"]" << endl 141 141 << hex 142 << " - address : " << address << endl143 << " - history old : " << history << endl144 << " - hit : " << hit<< endl;142 << " - address : " << address << endl 143 << " - history old : " << history << endl 144 << " - direction : " << direction<< endl; 145 145 146 BRANCH_COMPLETE_VAL [num_port_branch_complete].write(1);147 BRANCH_COMPLETE_ADDRESS [num_port_branch_complete].write(address);148 BRANCH_COMPLETE_HISTORY [num_port_branch_complete].write(history);149 BRANCH_COMPLETE_ HIT [num_port_branch_complete].write(hit);146 BRANCH_COMPLETE_VAL [num_port_branch_complete].write(1); 147 BRANCH_COMPLETE_ADDRESS [num_port_branch_complete].write(address); 148 BRANCH_COMPLETE_HISTORY [num_port_branch_complete].write(history); 149 BRANCH_COMPLETE_DIRECTION [num_port_branch_complete].write(direction); 150 150 151 151 // Wait Ack … … 160 160 PREDICT_ADDRESS [num_port_predict ].write(address); 161 161 162 history = ((history<<1)&mask)| hit;162 history = ((history<<1)&mask)|direction; 163 163 164 164 // Wait Ack
Note: See TracChangeset
for help on using the changeset viewer.