[2] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Two_Level_Branch_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/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue/include/Two_Level_Branch_Predictor_Glue.h" |
---|
[2] | 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 | |
---|
[2] | 19 | namespace meta_predictor { |
---|
| 20 | namespace two_level_branch_predictor { |
---|
| 21 | namespace two_level_branch_predictor_glue { |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | void Two_Level_Branch_Predictor_Glue::allocation (void) |
---|
| 25 | { |
---|
| 26 | string rename; |
---|
| 27 | |
---|
| 28 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"allocation","Begin"); |
---|
| 29 | |
---|
[42] | 30 | _component = new Component (); |
---|
| 31 | |
---|
| 32 | Entity * entity = _component->set_entity (_name |
---|
| 33 | ,"Two_Level_Branch_Predictor_Glue" |
---|
| 34 | #ifdef POSITION |
---|
| 35 | ,COMBINATORY |
---|
[2] | 36 | #endif |
---|
[42] | 37 | ); |
---|
[2] | 38 | |
---|
[42] | 39 | _interfaces = entity->set_interfaces(); |
---|
| 40 | |
---|
| 41 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 42 | { |
---|
| 43 | Interface * interface = _interfaces->set_interface("" |
---|
| 44 | #ifdef POSITION |
---|
| 45 | , IN |
---|
| 46 | , SOUTH |
---|
| 47 | , "Generalist interface" |
---|
| 48 | #endif |
---|
| 49 | ); |
---|
| 50 | |
---|
| 51 | in_CLOCK = interface->set_signal_clk ("clock" ,1,CLOCK_VHDL_NO); |
---|
| 52 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1,RESET_VHDL_NO); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | // ~~~~~[ Interface : "Predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[2] | 56 | if (_param._have_bht) |
---|
| 57 | { |
---|
| 58 | in_PREDICT_BHT_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction]; |
---|
| 59 | out_PREDICT_BHT_ADDRESS = new SC_OUT(Taddress_t) * [_param._nb_prediction]; |
---|
| 60 | } |
---|
| 61 | if (_param._have_pht) |
---|
| 62 | { |
---|
| 63 | in_PREDICT_PHT_ACK = new SC_IN (Tcontrol_t) * [_param._nb_prediction]; |
---|
| 64 | out_PREDICT_PHT_ADDRESS = new SC_OUT(Taddress_t) * [_param._nb_prediction]; |
---|
| 65 | } |
---|
| 66 | if (_param._have_bht and _param._have_pht) |
---|
| 67 | in_PREDICT_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_prediction]; |
---|
| 68 | out_PREDICT_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_prediction]; |
---|
| 69 | in_PREDICT_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_prediction]; |
---|
| 70 | |
---|
| 71 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 72 | { |
---|
[42] | 73 | Interface_fifo * interface = _interfaces->set_interface("predict_"+toString(i) |
---|
| 74 | #ifdef POSITION |
---|
| 75 | , IN |
---|
| 76 | , WEST |
---|
| 77 | , "Interface Predict" |
---|
| 78 | #endif |
---|
| 79 | ); |
---|
| 80 | |
---|
[2] | 81 | if (_param._have_bht) |
---|
| 82 | { |
---|
[42] | 83 | in_PREDICT_BHT_ACK [i] = interface->set_signal_in <Tcontrol_t> ("bht_ack" ,1); |
---|
| 84 | out_PREDICT_BHT_ADDRESS [i] = interface->set_signal_out <Taddress_t> ("bht_address",_param._bht_size_address); |
---|
[2] | 85 | } |
---|
| 86 | if (_param._have_pht) |
---|
| 87 | { |
---|
[42] | 88 | in_PREDICT_PHT_ACK [i] = interface->set_signal_in <Tcontrol_t> ("pht_ack" ,1); |
---|
| 89 | out_PREDICT_PHT_ADDRESS [i] = interface->set_signal_out <Taddress_t> ("pht_address",_param._pht_size_address); |
---|
[2] | 90 | } |
---|
| 91 | if (_param._have_bht and _param._have_pht) |
---|
[42] | 92 | in_PREDICT_BHT_HISTORY [i] = interface->set_signal_in <Tbht_history_t> ("bht_history",_param._bht_size_history); |
---|
| 93 | out_PREDICT_ACK [i] = interface->set_signal_out <Tcontrol_t> ("ack" ,1); |
---|
| 94 | in_PREDICT_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address" ,_param._size_address); |
---|
[2] | 95 | } |
---|
| 96 | |
---|
[42] | 97 | // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 98 | |
---|
[2] | 99 | if (_param._have_bht) |
---|
| 100 | { |
---|
| 101 | in_BRANCH_COMPLETE_BHT_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 102 | out_BRANCH_COMPLETE_BHT_ADDRESS = new SC_OUT(Taddress_t) * [_param._nb_branch_complete]; |
---|
| 103 | } |
---|
| 104 | if (_param._have_pht) |
---|
| 105 | { |
---|
| 106 | in_BRANCH_COMPLETE_PHT_ACK = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 107 | out_BRANCH_COMPLETE_PHT_ADDRESS = new SC_OUT(Taddress_t) * [_param._nb_branch_complete]; |
---|
| 108 | } |
---|
| 109 | if (_param._have_bht and _param._have_pht) |
---|
| 110 | in_BRANCH_COMPLETE_BHT_HISTORY = new SC_IN (Tbht_history_t) * [_param._nb_branch_complete]; |
---|
| 111 | |
---|
| 112 | out_BRANCH_COMPLETE_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 113 | in_BRANCH_COMPLETE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_branch_complete]; |
---|
| 114 | |
---|
| 115 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 116 | { |
---|
[42] | 117 | Interface_fifo * interface = _interfaces->set_interface("branch_complete_"+toString(i) |
---|
| 118 | #ifdef POSITION |
---|
| 119 | , IN |
---|
| 120 | , EAST |
---|
| 121 | , "Interface branch complete" |
---|
| 122 | #endif |
---|
| 123 | ); |
---|
[2] | 124 | if (_param._have_bht) |
---|
| 125 | { |
---|
[42] | 126 | in_BRANCH_COMPLETE_BHT_ACK [i] = interface->set_signal_in <Tcontrol_t> ("bht_ack" ,1); |
---|
| 127 | out_BRANCH_COMPLETE_BHT_ADDRESS [i] = interface->set_signal_out <Taddress_t> ("bht_address",_param._bht_size_address); |
---|
[2] | 128 | } |
---|
| 129 | if (_param._have_pht) |
---|
| 130 | { |
---|
[42] | 131 | in_BRANCH_COMPLETE_PHT_ACK [i] = interface->set_signal_in <Tcontrol_t> ("pht_ack" ,1); |
---|
| 132 | out_BRANCH_COMPLETE_PHT_ADDRESS [i] = interface->set_signal_out <Taddress_t> ("pht_address",_param._pht_size_address); |
---|
[2] | 133 | } |
---|
| 134 | if (_param._have_bht and _param._have_pht) |
---|
[42] | 135 | in_BRANCH_COMPLETE_BHT_HISTORY [i] = interface->set_signal_in <Tbht_history_t> ("bht_history",_param._bht_size_history); |
---|
| 136 | |
---|
| 137 | out_BRANCH_COMPLETE_ACK [i] = interface->set_signal_out <Tcontrol_t> ("ack" ,1); |
---|
| 138 | in_BRANCH_COMPLETE_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address" ,_param._size_address); |
---|
[2] | 139 | } |
---|
| 140 | |
---|
| 141 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 142 | |
---|
[42] | 143 | #ifdef POSITION |
---|
| 144 | _component->generate_file(); |
---|
| 145 | #endif |
---|
| 146 | |
---|
[2] | 147 | log_printf(FUNC,Two_Level_Branch_Predictor_Glue,"allocation","End"); |
---|
| 148 | }; |
---|
| 149 | |
---|
| 150 | }; // end namespace two_level_branch_predictor_glue |
---|
| 151 | }; // end namespace two_level_branch_predictor |
---|
| 152 | }; // end namespace meta_predictor |
---|
| 153 | |
---|
[48] | 154 | }; // end namespace core |
---|
| 155 | }; // end namespace multi_front_end |
---|
| 156 | }; // end namespace front_end |
---|
| 157 | }; // end namespace prediction_unit |
---|
| 158 | }; // end namespace direction |
---|
| 159 | |
---|
| 160 | |
---|
[2] | 161 | }; // end namespace behavioural |
---|
| 162 | }; // end namespace morpheo |
---|
| 163 | #endif |
---|