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