[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 | |
---|
| 25 | #if defined(STATISTICS) or defined(VHDL_TESTBENCH) |
---|
| 26 | in_CLOCK = new SC_CLOCK ("in_CLOCK"); |
---|
| 27 | #endif |
---|
| 28 | |
---|
| 29 | // Interface Predict |
---|
| 30 | |
---|
| 31 | if (_param._have_meta_predictor) |
---|
| 32 | { |
---|
| 33 | in_PREDICT_PREDICTOR_0_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 34 | in_PREDICT_PREDICTOR_1_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 35 | } |
---|
| 36 | in_PREDICT_PREDICTOR_2_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 37 | out_PREDICT_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 38 | if (_param._have_meta_predictor) |
---|
| 39 | { |
---|
| 40 | if (_param._predictor_0_have_bht) |
---|
| 41 | in_PREDICT_PREDICTOR_0_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction ]; |
---|
| 42 | if (_param._predictor_0_have_pht) |
---|
| 43 | in_PREDICT_PREDICTOR_0_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction ]; |
---|
| 44 | if (_param._predictor_1_have_bht) |
---|
| 45 | in_PREDICT_PREDICTOR_1_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction ]; |
---|
| 46 | if (_param._predictor_1_have_pht) |
---|
| 47 | in_PREDICT_PREDICTOR_1_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction ]; |
---|
| 48 | } |
---|
| 49 | if (_param._predictor_2_have_bht) |
---|
| 50 | in_PREDICT_PREDICTOR_2_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction ]; |
---|
| 51 | if (_param._predictor_2_have_pht) |
---|
| 52 | in_PREDICT_PREDICTOR_2_PHT_HISTORY = new SC_IN (Tpht_history_t) * [_param._nb_prediction ]; |
---|
| 53 | out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction ]; |
---|
| 54 | out_PREDICT_DIRECTION = new SC_OUT(Tcontrol_t) * [_param._nb_prediction ]; |
---|
| 55 | |
---|
| 56 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 57 | { |
---|
| 58 | if (_param._have_meta_predictor) |
---|
| 59 | { |
---|
| 60 | rename = " in_PREDICT_PREDICTOR_0_ACK_" +toString(i); |
---|
| 61 | in_PREDICT_PREDICTOR_0_ACK [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 62 | |
---|
| 63 | rename = " in_PREDICT_PREDICTOR_1_ACK_" +toString(i); |
---|
| 64 | in_PREDICT_PREDICTOR_1_ACK [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 65 | } |
---|
| 66 | rename = " in_PREDICT_PREDICTOR_2_ACK_" +toString(i); |
---|
| 67 | in_PREDICT_PREDICTOR_2_ACK [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 68 | |
---|
| 69 | rename = "out_PREDICT_ACK_" +toString(i); |
---|
| 70 | out_PREDICT_ACK [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
| 71 | |
---|
| 72 | if (_param._have_meta_predictor) |
---|
| 73 | { |
---|
| 74 | if (_param._predictor_0_have_bht) |
---|
| 75 | { |
---|
| 76 | rename = " in_PREDICT_PREDICTOR_0_BHT_HISTORY_"+toString(i); |
---|
| 77 | in_PREDICT_PREDICTOR_0_BHT_HISTORY [i] = new SC_IN (Tbht_history_t) (rename.c_str()); |
---|
| 78 | } |
---|
| 79 | if (_param._predictor_0_have_pht) |
---|
| 80 | { |
---|
| 81 | rename = " in_PREDICT_PREDICTOR_0_PHT_HISTORY_"+toString(i); |
---|
| 82 | in_PREDICT_PREDICTOR_0_PHT_HISTORY [i] = new SC_IN (Tpht_history_t) (rename.c_str()); |
---|
| 83 | } |
---|
| 84 | if (_param._predictor_1_have_bht) |
---|
| 85 | { |
---|
| 86 | rename = " in_PREDICT_PREDICTOR_1_BHT_HISTORY_"+toString(i); |
---|
| 87 | in_PREDICT_PREDICTOR_1_BHT_HISTORY [i] = new SC_IN (Tbht_history_t) (rename.c_str()); |
---|
| 88 | } |
---|
| 89 | if (_param._predictor_1_have_pht) |
---|
| 90 | { |
---|
| 91 | rename = " in_PREDICT_PREDICTOR_1_PHT_HISTORY_"+toString(i); |
---|
| 92 | in_PREDICT_PREDICTOR_1_PHT_HISTORY [i] = new SC_IN (Tpht_history_t) (rename.c_str()); |
---|
| 93 | } |
---|
| 94 | } |
---|
| 95 | if (_param._predictor_2_have_bht) |
---|
| 96 | { |
---|
| 97 | rename = " in_PREDICT_PREDICTOR_2_BHT_HISTORY_"+toString(i); |
---|
| 98 | in_PREDICT_PREDICTOR_2_BHT_HISTORY [i] = new SC_IN (Tbht_history_t) (rename.c_str()); |
---|
| 99 | } |
---|
| 100 | if (_param._predictor_2_have_pht) |
---|
| 101 | { |
---|
| 102 | rename = " in_PREDICT_PREDICTOR_2_PHT_HISTORY_"+toString(i); |
---|
| 103 | in_PREDICT_PREDICTOR_2_PHT_HISTORY [i] = new SC_IN (Tpht_history_t) (rename.c_str()); |
---|
| 104 | } |
---|
| 105 | rename = "out_PREDICT_HISTORY_" +toString(i); |
---|
| 106 | out_PREDICT_HISTORY [i] = new SC_OUT(Thistory_t) (rename.c_str()); |
---|
| 107 | |
---|
| 108 | rename = "out_PREDICT_DIRECTION_" +toString(i); |
---|
| 109 | out_PREDICT_DIRECTION [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | // Interface Branch_complete |
---|
| 113 | |
---|
| 114 | if (_param._have_meta_predictor) |
---|
| 115 | { |
---|
| 116 | in_BRANCH_COMPLETE_PREDICTOR_0_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 117 | in_BRANCH_COMPLETE_PREDICTOR_1_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 118 | } |
---|
| 119 | in_BRANCH_COMPLETE_PREDICTOR_2_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 120 | out_BRANCH_COMPLETE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_branch_complete ]; |
---|
| 121 | if (_param._have_meta_predictor) |
---|
| 122 | { |
---|
| 123 | if (_param._predictor_0_have_bht) |
---|
| 124 | out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete ]; |
---|
| 125 | if (_param._predictor_0_have_pht) |
---|
| 126 | out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete ]; |
---|
| 127 | if (_param._predictor_1_have_bht) |
---|
| 128 | out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete ]; |
---|
| 129 | if (_param._predictor_1_have_pht) |
---|
| 130 | out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete ]; |
---|
| 131 | } |
---|
| 132 | if (_param._predictor_2_have_bht) |
---|
| 133 | out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY = new SC_OUT(Tbht_history_t) * [_param._nb_branch_complete ]; |
---|
| 134 | if (_param._predictor_2_have_pht) |
---|
| 135 | out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY = new SC_OUT(Tpht_history_t) * [_param._nb_branch_complete ]; |
---|
| 136 | in_BRANCH_COMPLETE_HISTORY = new SC_IN (Thistory_t) * [_param._nb_branch_complete ]; |
---|
| 137 | |
---|
| 138 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 139 | { |
---|
| 140 | if (_param._have_meta_predictor) |
---|
| 141 | { |
---|
| 142 | rename = " in_BRANCH_COMPLETE_PREDICTOR_0_ACK_" +toString(i); |
---|
| 143 | in_BRANCH_COMPLETE_PREDICTOR_0_ACK [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 144 | |
---|
| 145 | rename = " in_BRANCH_COMPLETE_PREDICTOR_1_ACK_" +toString(i); |
---|
| 146 | in_BRANCH_COMPLETE_PREDICTOR_1_ACK [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 147 | } |
---|
| 148 | rename = " in_BRANCH_COMPLETE_PREDICTOR_2_ACK_" +toString(i); |
---|
| 149 | in_BRANCH_COMPLETE_PREDICTOR_2_ACK [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 150 | |
---|
| 151 | rename = "out_BRANCH_COMPLETE_ACK_" +toString(i); |
---|
| 152 | out_BRANCH_COMPLETE_ACK [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
| 153 | |
---|
| 154 | if (_param._have_meta_predictor) |
---|
| 155 | { |
---|
| 156 | if (_param._predictor_0_have_bht) |
---|
| 157 | { |
---|
| 158 | rename = "out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY_"+toString(i); |
---|
| 159 | out_BRANCH_COMPLETE_PREDICTOR_0_BHT_HISTORY [i] = new SC_OUT(Tbht_history_t) (rename.c_str()); |
---|
| 160 | } |
---|
| 161 | if (_param._predictor_0_have_pht) |
---|
| 162 | { |
---|
| 163 | rename = "out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY_"+toString(i); |
---|
| 164 | out_BRANCH_COMPLETE_PREDICTOR_0_PHT_HISTORY [i] = new SC_OUT(Tpht_history_t) (rename.c_str()); |
---|
| 165 | } |
---|
| 166 | if (_param._predictor_1_have_bht) |
---|
| 167 | { |
---|
| 168 | rename = "out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY_"+toString(i); |
---|
| 169 | out_BRANCH_COMPLETE_PREDICTOR_1_BHT_HISTORY [i] = new SC_OUT(Tbht_history_t) (rename.c_str()); |
---|
| 170 | } |
---|
| 171 | if (_param._predictor_1_have_pht) |
---|
| 172 | { |
---|
| 173 | rename = "out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY_"+toString(i); |
---|
| 174 | out_BRANCH_COMPLETE_PREDICTOR_1_PHT_HISTORY [i] = new SC_OUT(Tpht_history_t) (rename.c_str()); |
---|
| 175 | } |
---|
| 176 | } |
---|
| 177 | if (_param._predictor_2_have_bht) |
---|
| 178 | { |
---|
| 179 | rename = "out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY_"+toString(i); |
---|
| 180 | out_BRANCH_COMPLETE_PREDICTOR_2_BHT_HISTORY [i] = new SC_OUT(Tbht_history_t) (rename.c_str()); |
---|
| 181 | } |
---|
| 182 | if (_param._predictor_2_have_pht) |
---|
| 183 | { |
---|
| 184 | rename = "out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY_"+toString(i); |
---|
| 185 | out_BRANCH_COMPLETE_PREDICTOR_2_PHT_HISTORY [i] = new SC_OUT(Tpht_history_t) (rename.c_str()); |
---|
| 186 | } |
---|
| 187 | rename = " in_BRANCH_COMPLETE_HISTORY_" +toString(i); |
---|
| 188 | in_BRANCH_COMPLETE_HISTORY [i] = new SC_IN (Thistory_t) (rename.c_str()); |
---|
| 189 | } |
---|
| 190 | |
---|
| 191 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 192 | |
---|
| 193 | log_printf(FUNC,Meta_Predictor_Glue,"allocation","End"); |
---|
| 194 | }; |
---|
| 195 | |
---|
| 196 | }; // end namespace meta_predictor_glue |
---|
| 197 | }; // end namespace meta_predictor |
---|
| 198 | }; // end namespace predictor |
---|
| 199 | }; // end namespace stage_1_ifetch |
---|
| 200 | |
---|
| 201 | }; // end namespace behavioural |
---|
| 202 | }; // end namespace morpheo |
---|
| 203 | #endif |
---|