[4] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Meta_Predictor_Glue_allocation.cpp 81 2008-04-15 18:40:01Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
[48] | 9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Meta_Predictor_Glue/include/Meta_Predictor_Glue.h" |
---|
[4] | 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
[48] | 13 | namespace core { |
---|
| 14 | namespace multi_front_end { |
---|
| 15 | namespace front_end { |
---|
| 16 | namespace prediction_unit { |
---|
| 17 | namespace direction { |
---|
| 18 | |
---|
[4] | 19 | namespace meta_predictor { |
---|
| 20 | namespace meta_predictor_glue { |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | void Meta_Predictor_Glue::allocation (void) |
---|
| 24 | { |
---|
| 25 | string rename; |
---|
| 26 | |
---|
| 27 | log_printf(FUNC,Meta_Predictor_Glue,"allocation","Begin"); |
---|
| 28 | |
---|
[44] | 29 | _component = new Component (); |
---|
| 30 | |
---|
| 31 | Entity * entity = _component->set_entity (_name |
---|
| 32 | ,"Two_Level_Branch_Predictor_Glue" |
---|
| 33 | #ifdef POSITION |
---|
| 34 | ,COMBINATORY |
---|
[4] | 35 | #endif |
---|
[44] | 36 | ); |
---|
| 37 | |
---|
| 38 | _interfaces = entity->set_interfaces(); |
---|
[4] | 39 | |
---|
[44] | 40 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 41 | { |
---|
| 42 | Interface * interface = _interfaces->set_interface("" |
---|
| 43 | #ifdef POSITION |
---|
| 44 | , IN |
---|
| 45 | , SOUTH |
---|
| 46 | , "Generalist interface" |
---|
| 47 | #endif |
---|
| 48 | ); |
---|
| 49 | |
---|
| 50 | in_CLOCK = interface->set_signal_clk ("clock" ,1,CLOCK_VHDL_NO); |
---|
| 51 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1,RESET_VHDL_NO); |
---|
| 52 | } |
---|
[4] | 53 | |
---|
[44] | 54 | |
---|
| 55 | // ~~~~~[ Interface : "Predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 56 | |
---|
[4] | 57 | if (_param._have_meta_predictor) |
---|
| 58 | { |
---|
| 59 | in_PREDICT_PREDICTOR_0_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 60 | in_PREDICT_PREDICTOR_1_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 61 | } |
---|
| 62 | in_PREDICT_PREDICTOR_2_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 63 | out_PREDICT_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 64 | if (_param._have_meta_predictor) |
---|
| 65 | { |
---|
| 66 | if (_param._predictor_0_have_bht) |
---|
| 67 | in_PREDICT_PREDICTOR_0_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction ]; |
---|
| 68 | if (_param._predictor_0_have_pht) |
---|
| 69 | in_PREDICT_PREDICTOR_0_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction ]; |
---|
| 70 | if (_param._predictor_1_have_bht) |
---|
| 71 | in_PREDICT_PREDICTOR_1_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction ]; |
---|
| 72 | if (_param._predictor_1_have_pht) |
---|
| 73 | in_PREDICT_PREDICTOR_1_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction ]; |
---|
| 74 | } |
---|
| 75 | if (_param._predictor_2_have_bht) |
---|
| 76 | in_PREDICT_PREDICTOR_2_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction ]; |
---|
| 77 | if (_param._predictor_2_have_pht) |
---|
| 78 | in_PREDICT_PREDICTOR_2_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction ]; |
---|
| 79 | out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction ]; |
---|
| 80 | out_PREDICT_DIRECTION = new SC_OUT(Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 81 | |
---|
| 82 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 83 | { |
---|
[44] | 84 | Interface_fifo * interface = _interfaces->set_interface("predict_"+toString(i) |
---|
| 85 | #ifdef POSITION |
---|
| 86 | , IN |
---|
| 87 | , WEST |
---|
| 88 | , "Interface Predict" |
---|
| 89 | #endif |
---|
| 90 | ); |
---|
| 91 | |
---|
[4] | 92 | if (_param._have_meta_predictor) |
---|
| 93 | { |
---|
[44] | 94 | in_PREDICT_PREDICTOR_0_ACK [i] = interface->set_signal_in <Tcontrol_t> ("predictor_0_ack" , 1); |
---|
| 95 | in_PREDICT_PREDICTOR_1_ACK [i] = interface->set_signal_in <Tcontrol_t> ("predictor_1_ack" , 1); |
---|
[4] | 96 | } |
---|
[44] | 97 | in_PREDICT_PREDICTOR_2_ACK [i] = interface->set_signal_in <Tcontrol_t> ("predictor_2_ack" , 1); |
---|
[4] | 98 | |
---|
[44] | 99 | out_PREDICT_ACK [i] = interface->set_signal_out <Tcontrol_t> ("ack" , 1); |
---|
[4] | 100 | |
---|
| 101 | if (_param._have_meta_predictor) |
---|
| 102 | { |
---|
| 103 | if (_param._predictor_0_have_bht) |
---|
[44] | 104 | in_PREDICT_PREDICTOR_0_BHT_HISTORY [i] = interface->set_signal_in <Tbht_history_t> ("predictor_0_bht_history", _param._predictor_0_bht_size_shifter); |
---|
[4] | 105 | if (_param._predictor_0_have_pht) |
---|
[44] | 106 | in_PREDICT_PREDICTOR_0_PHT_HISTORY [i] = interface->set_signal_in <Tpht_history_t> ("predictor_0_pht_history", _param._predictor_0_pht_size_counter); |
---|
[4] | 107 | if (_param._predictor_1_have_bht) |
---|
[44] | 108 | in_PREDICT_PREDICTOR_1_BHT_HISTORY [i] = interface->set_signal_in <Tbht_history_t> ("predictor_1_bht_history", _param._predictor_1_bht_size_shifter); |
---|
[4] | 109 | if (_param._predictor_1_have_pht) |
---|
[44] | 110 | in_PREDICT_PREDICTOR_1_PHT_HISTORY [i] = interface->set_signal_in <Tpht_history_t> ("predictor_1_pht_history", _param._predictor_1_pht_size_counter); |
---|
[4] | 111 | } |
---|
| 112 | if (_param._predictor_2_have_bht) |
---|
[44] | 113 | in_PREDICT_PREDICTOR_2_BHT_HISTORY [i] = interface->set_signal_in <Tbht_history_t> ("predictor_2_bht_history", _param._predictor_2_bht_size_shifter); |
---|
[4] | 114 | if (_param._predictor_2_have_pht) |
---|
[44] | 115 | in_PREDICT_PREDICTOR_2_PHT_HISTORY [i] = interface->set_signal_in <Tpht_history_t> ("predictor_2_pht_history", _param._predictor_2_pht_size_counter); |
---|
| 116 | out_PREDICT_HISTORY [i] = interface->set_signal_out <Thistory_t> ("history" , _param._size_history); |
---|
| 117 | out_PREDICT_DIRECTION [i] = interface->set_signal_out <Tcontrol_t> ("direction" , 1); |
---|
[4] | 118 | } |
---|
| 119 | |
---|
[44] | 120 | // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[4] | 121 | |
---|
| 122 | if (_param._have_meta_predictor) |
---|
| 123 | { |
---|
[5] | 124 | in_BRANCH_COMPLETE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 125 | out_BRANCH_COMPLETE_PREDICTOR_2_VAL = new SC_OUT(Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 126 | |
---|
[4] | 127 | in_BRANCH_COMPLETE_PREDICTOR_0_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 128 | in_BRANCH_COMPLETE_PREDICTOR_1_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 129 | } |
---|
| 130 | in_BRANCH_COMPLETE_PREDICTOR_2_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 131 | out_BRANCH_COMPLETE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 132 | if (_param._have_meta_predictor) |
---|
| 133 | { |
---|
| 134 | if (_param._predictor_0_have_bht) |
---|
| 135 | out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete ]; |
---|
| 136 | if (_param._predictor_0_have_pht) |
---|
| 137 | out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete ]; |
---|
| 138 | if (_param._predictor_1_have_bht) |
---|
| 139 | out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete ]; |
---|
| 140 | if (_param._predictor_1_have_pht) |
---|
| 141 | out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete ]; |
---|
| 142 | } |
---|
| 143 | if (_param._predictor_2_have_bht) |
---|
| 144 | out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete ]; |
---|
| 145 | if (_param._predictor_2_have_pht) |
---|
| 146 | out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete ]; |
---|
| 147 | in_BRANCH_COMPLETE_HISTORY = new SC_IN (Thistory_t) * [_param._nb_branch_complete ]; |
---|
[5] | 148 | if (_param._have_meta_predictor) |
---|
| 149 | { |
---|
| 150 | in_BRANCH_COMPLETE_DIRECTION = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 151 | out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION = new SC_OUT(Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 152 | } |
---|
[4] | 153 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 154 | { |
---|
[44] | 155 | Interface_fifo * interface = _interfaces->set_interface("branch_complete_"+toString(i) |
---|
| 156 | #ifdef POSITION |
---|
| 157 | , IN |
---|
| 158 | , EAST |
---|
| 159 | , "Interface branch complete" |
---|
| 160 | #endif |
---|
| 161 | ); |
---|
| 162 | |
---|
[4] | 163 | if (_param._have_meta_predictor) |
---|
| 164 | { |
---|
[44] | 165 | in_BRANCH_COMPLETE_VAL [i] = interface->set_signal_in <Tcontrol_t> ("val" , 1); |
---|
| 166 | out_BRANCH_COMPLETE_PREDICTOR_2_VAL [i] = interface->set_signal_out <Tcontrol_t> ("predictor_2_val", 1); |
---|
| 167 | in_BRANCH_COMPLETE_PREDICTOR_0_ACK [i] = interface->set_signal_in <Tcontrol_t> ("predictor_0_ack", 1); |
---|
| 168 | in_BRANCH_COMPLETE_PREDICTOR_1_ACK [i] = interface->set_signal_in <Tcontrol_t> ("predictor_1_ack", 1); |
---|
[4] | 169 | } |
---|
[44] | 170 | in_BRANCH_COMPLETE_PREDICTOR_2_ACK [i] = interface->set_signal_in <Tcontrol_t> ("predictor_2_ack" , 1); |
---|
| 171 | out_BRANCH_COMPLETE_ACK [i] = interface->set_signal_out <Tcontrol_t> ("ack" , 1); |
---|
[4] | 172 | if (_param._have_meta_predictor) |
---|
| 173 | { |
---|
| 174 | if (_param._predictor_0_have_bht) |
---|
[44] | 175 | out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i] = interface->set_signal_out <Tbht_history_t> ("predictor_0_bht_history" , _param._predictor_0_bht_size_shifter ); |
---|
[4] | 176 | if (_param._predictor_0_have_pht) |
---|
[44] | 177 | out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY [i] = interface->set_signal_out <Tpht_history_t> ("predictor_0_pht_history" , _param._predictor_0_pht_size_counter); |
---|
[4] | 178 | if (_param._predictor_1_have_bht) |
---|
[44] | 179 | out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY [i] = interface->set_signal_out <Tbht_history_t> ("predictor_1_bht_history" , _param._predictor_1_bht_size_shifter ); |
---|
[4] | 180 | if (_param._predictor_1_have_pht) |
---|
[44] | 181 | out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY [i] = interface->set_signal_out <Tpht_history_t> ("predictor_1_pht_history" , _param._predictor_1_pht_size_counter ); |
---|
[4] | 182 | } |
---|
| 183 | if (_param._predictor_2_have_bht) |
---|
[44] | 184 | out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY [i] = interface->set_signal_out <Tbht_history_t> ("predictor_2_bht_history" , _param._predictor_2_bht_size_shifter); |
---|
[4] | 185 | if (_param._predictor_2_have_pht) |
---|
[44] | 186 | out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i] = interface->set_signal_out <Tpht_history_t> ("predictor_2_pht_history" , _param._predictor_2_pht_size_counter); |
---|
| 187 | in_BRANCH_COMPLETE_HISTORY [i] = interface->set_signal_in <Thistory_t> ("history" , _param._size_history); |
---|
[5] | 188 | if (_param._have_meta_predictor) |
---|
| 189 | { |
---|
[44] | 190 | in_BRANCH_COMPLETE_DIRECTION [i] = interface->set_signal_in <Tcontrol_t> ("direction" , 1); |
---|
| 191 | out_BRANCH_COMPLETE_PREDICTOR_2_DIRECTION [i] = interface->set_signal_out <Tcontrol_t> ("predictor_2_direction" , 1); |
---|
[5] | 192 | } |
---|
[4] | 193 | } |
---|
| 194 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 195 | |
---|
[44] | 196 | #ifdef POSITION |
---|
| 197 | _component->generate_file(); |
---|
| 198 | #endif |
---|
| 199 | |
---|
[4] | 200 | log_printf(FUNC,Meta_Predictor_Glue,"allocation","End"); |
---|
| 201 | }; |
---|
| 202 | |
---|
| 203 | }; // end namespace meta_predictor_glue |
---|
| 204 | }; // end namespace meta_predictor |
---|
| 205 | |
---|
[48] | 206 | }; // end namespace core |
---|
| 207 | }; // end namespace multi_front_end |
---|
| 208 | }; // end namespace front_end |
---|
| 209 | }; // end namespace prediction_unit |
---|
| 210 | }; // end namespace direction |
---|
| 211 | |
---|
| 212 | |
---|
[4] | 213 | }; // end namespace behavioural |
---|
| 214 | }; // end namespace morpheo |
---|
| 215 | #endif |
---|