[2] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id: Branch_History_Table_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/Branch_History_Table/include/Branch_History_Table.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 branch_history_table { |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | void Branch_History_Table::allocation (void) |
---|
| 25 | { |
---|
[42] | 26 | _component = new Component (); |
---|
[2] | 27 | |
---|
[42] | 28 | Entity * entity = _component->set_entity (_name |
---|
| 29 | ,"Branch_History_Table" |
---|
| 30 | #ifdef POSITION |
---|
| 31 | ,MIXTE |
---|
| 32 | #endif |
---|
| 33 | ); |
---|
| 34 | |
---|
| 35 | _interfaces = entity->set_interfaces(); |
---|
[2] | 36 | |
---|
[42] | 37 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 38 | { |
---|
| 39 | Interface * interface = _interfaces->set_interface("" |
---|
| 40 | #ifdef POSITION |
---|
| 41 | , IN |
---|
| 42 | , SOUTH |
---|
| 43 | , "Generalist interface" |
---|
| 44 | #endif |
---|
| 45 | ); |
---|
| 46 | |
---|
| 47 | in_CLOCK = interface->set_signal_clk ("clock" ,1); |
---|
| 48 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1,RESET_VHDL_YES); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[2] | 52 | in_PREDICT_VAL = new SC_IN (Tcontrol_t) * [_param._nb_prediction]; |
---|
| 53 | out_PREDICT_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_prediction]; |
---|
| 54 | in_PREDICT_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_prediction]; |
---|
| 55 | out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction]; |
---|
| 56 | |
---|
| 57 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 58 | { |
---|
[42] | 59 | Interface_fifo * interface = _interfaces->set_interface("predict_"+toString(i) |
---|
| 60 | #ifdef POSITION |
---|
| 61 | , IN |
---|
| 62 | , WEST |
---|
| 63 | , "Interface Predict" |
---|
| 64 | #endif |
---|
| 65 | ); |
---|
[2] | 66 | |
---|
[42] | 67 | in_PREDICT_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
| 68 | out_PREDICT_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
| 69 | in_PREDICT_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address", static_cast<uint32_t>(ceil(log2(_param._nb_shifter)))); |
---|
| 70 | out_PREDICT_HISTORY [i] = interface->set_signal_out <Thistory_t> ("history", _param._size_shifter); |
---|
| 71 | } |
---|
[2] | 72 | |
---|
[42] | 73 | // ~~~~~[ Interface : "branch_complete" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[2] | 74 | |
---|
[42] | 75 | in_BRANCH_COMPLETE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 76 | out_BRANCH_COMPLETE_ACK = new SC_OUT (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 77 | in_BRANCH_COMPLETE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_branch_complete]; |
---|
| 78 | in_BRANCH_COMPLETE_HISTORY = new SC_IN (Thistory_t) * [_param._nb_branch_complete]; |
---|
| 79 | in_BRANCH_COMPLETE_DIRECTION = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
[2] | 80 | |
---|
| 81 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 82 | { |
---|
[42] | 83 | Interface_fifo * interface = _interfaces->set_interface("branch_complete_"+toString(i) |
---|
| 84 | #ifdef POSITION |
---|
| 85 | , IN |
---|
| 86 | , EAST |
---|
| 87 | , "Interface branch complete" |
---|
| 88 | #endif |
---|
| 89 | ); |
---|
[2] | 90 | |
---|
[42] | 91 | in_BRANCH_COMPLETE_VAL [i] = interface->set_signal_valack_in ("val" , VAL); |
---|
| 92 | out_BRANCH_COMPLETE_ACK [i] = interface->set_signal_valack_out ("ack" , ACK); |
---|
| 93 | in_BRANCH_COMPLETE_ADDRESS [i] = interface->set_signal_in <Taddress_t> ("address" , static_cast<uint32_t>(ceil(log2(_param._nb_shifter)))); |
---|
| 94 | in_BRANCH_COMPLETE_HISTORY [i] = interface->set_signal_in <Thistory_t> ("history" , _param._size_shifter); |
---|
| 95 | in_BRANCH_COMPLETE_DIRECTION [i] = interface->set_signal_in <Tcontrol_t> ("direction", 1); |
---|
[2] | 96 | } |
---|
| 97 | |
---|
| 98 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 99 | string name_component; |
---|
[42] | 100 | |
---|
[2] | 101 | // =====[ component_Shifter ]========================================= |
---|
| 102 | |
---|
| 103 | name_component = _name+"_Shifter"; |
---|
| 104 | |
---|
[42] | 105 | component_Shifter = new morpheo::behavioural::generic::shifter::Shifter (name_component.c_str() |
---|
[2] | 106 | #ifdef STATISTICS |
---|
[42] | 107 | ,_param_statistics |
---|
[2] | 108 | #endif |
---|
[42] | 109 | ,*(_param._param_shifter)); |
---|
| 110 | |
---|
| 111 | _component->set_component (component_Shifter->_component |
---|
| 112 | #ifdef POSITION |
---|
| 113 | , 25 |
---|
| 114 | , 25 |
---|
| 115 | , 10 |
---|
| 116 | , 10 |
---|
[2] | 117 | #endif |
---|
[42] | 118 | ); |
---|
[2] | 119 | |
---|
| 120 | // =====[ component_RegisterFile ]==================================== |
---|
| 121 | |
---|
| 122 | name_component = _name+"_RegisterFile"; |
---|
| 123 | |
---|
[15] | 124 | component_RegisterFile = new morpheo::behavioural::generic::registerfile::registerfile_monolithic::RegisterFile_Monolithic(name_component.c_str(), |
---|
[2] | 125 | #ifdef STATISTICS |
---|
[42] | 126 | _param_statistics , |
---|
[2] | 127 | #endif |
---|
[42] | 128 | *(_param._param_registerfile)); |
---|
| 129 | |
---|
| 130 | _component->set_component (component_RegisterFile->_component |
---|
| 131 | #ifdef POSITION |
---|
| 132 | , 75 |
---|
| 133 | , 75 |
---|
| 134 | , 10 |
---|
| 135 | , 10 |
---|
| 136 | #endif |
---|
| 137 | ); |
---|
[2] | 138 | |
---|
[42] | 139 | // ~~~~~[ Component - Instanciation ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 140 | |
---|
| 141 | // =====[ component_RegisterFile - Instanciation ]==================== |
---|
| 142 | |
---|
| 143 | #ifdef POSITION |
---|
| 144 | _component->interface_map (_name+"_RegisterFile","", |
---|
| 145 | _name ,""); |
---|
| 146 | #endif |
---|
| 147 | |
---|
| 148 | _component->port_map(_name+"_RegisterFile", "in_CLOCK" , _name,"in_CLOCK" ); |
---|
| 149 | _component->port_map(_name+"_RegisterFile", "in_NRESET", _name,"in_NRESET"); |
---|
[2] | 150 | |
---|
| 151 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 152 | { |
---|
[42] | 153 | #ifdef POSITION |
---|
| 154 | _component->interface_map (_name+"_RegisterFile","read_" +toString(i), |
---|
| 155 | _name ,"predict_"+toString(i)); |
---|
| 156 | #endif |
---|
| 157 | |
---|
| 158 | _component->port_map(_name+"_RegisterFile", "in_READ_"+toString(i)+"_VAL" , _name, "in_PREDICT_"+toString(i)+"_VAL" ); |
---|
| 159 | _component->port_map(_name+"_RegisterFile","out_READ_"+toString(i)+"_ACK" , _name,"out_PREDICT_"+toString(i)+"_ACK" ); |
---|
| 160 | _component->port_map(_name+"_RegisterFile", "in_READ_"+toString(i)+"_ADDRESS", _name, "in_PREDICT_"+toString(i)+"_ADDRESS"); |
---|
| 161 | _component->port_map(_name+"_RegisterFile","out_READ_"+toString(i)+"_DATA" , _name,"out_PREDICT_"+toString(i)+"_HISTORY"); |
---|
[2] | 162 | } |
---|
| 163 | |
---|
| 164 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 165 | { |
---|
[42] | 166 | #ifdef POSITION |
---|
| 167 | _component->interface_map (_name+"_RegisterFile","write_" +toString(i), |
---|
| 168 | _name+"_Shifter" ,"shifter_"+toString(i)); |
---|
| 169 | #endif |
---|
| 170 | |
---|
| 171 | _component->port_map(_name+"_RegisterFile", "in_WRITE_"+toString(i)+"_VAL" , _name , "in_BRANCH_COMPLETE_"+toString(i)+"_VAL" ); |
---|
| 172 | _component->port_map(_name+"_RegisterFile","out_WRITE_"+toString(i)+"_ACK" , _name ,"out_BRANCH_COMPLETE_"+toString(i)+"_ACK" ); |
---|
| 173 | _component->port_map(_name+"_RegisterFile", "in_WRITE_"+toString(i)+"_ADDRESS", _name , "in_BRANCH_COMPLETE_"+toString(i)+"_ADDRESS"); |
---|
| 174 | _component->port_map(_name+"_RegisterFile", "in_WRITE_"+toString(i)+"_DATA" , _name+"_Shifter","out_SHIFTER_" +toString(i)+"_DATA"); |
---|
[2] | 175 | } |
---|
[42] | 176 | |
---|
| 177 | // =====[ component_Shifter - Instanciation ]========================= |
---|
| 178 | |
---|
| 179 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
| 180 | |
---|
| 181 | #ifdef POSITION |
---|
| 182 | _component->interface_map (_name+"_Shifter","", |
---|
| 183 | _name ,""); |
---|
| 184 | #endif |
---|
| 185 | |
---|
| 186 | _component->port_map(_name+"_Shifter", "in_CLOCK" , _name,"in_CLOCK" ); |
---|
| 187 | _component->port_map(_name+"_Shifter", "in_NRESET", _name,"in_NRESET"); |
---|
| 188 | |
---|
| 189 | #endif |
---|
| 190 | |
---|
| 191 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 192 | { |
---|
| 193 | #ifdef POSITION |
---|
| 194 | _component->interface_map (_name+"_Shifter","shifter_"+toString(i), |
---|
| 195 | _name ,"branch_complete_"+toString(i)); |
---|
| 196 | |
---|
| 197 | #endif |
---|
| 198 | |
---|
| 199 | _component->port_map(_name+"_Shifter", "in_SHIFTER_" +toString(i)+"_DATA" , _name , "in_BRANCH_COMPLETE_"+toString(i)+"_HISTORY"); |
---|
| 200 | _component->port_map(_name+"_Shifter", "in_SHIFTER_" +toString(i)+"_CARRY_IN", _name , "in_BRANCH_COMPLETE_"+toString(i)+"_DIRECTION"); |
---|
| 201 | _component->port_map(_name+"_Shifter", "out_SHIFTER_"+toString(i)+"_DATA" , _name+"_RegisterFile", "in_WRITE_"+toString(i)+"_DATA"); |
---|
| 202 | } |
---|
| 203 | |
---|
| 204 | #ifdef POSITION |
---|
| 205 | _component->generate_file(); |
---|
| 206 | #endif |
---|
[2] | 207 | }; |
---|
| 208 | |
---|
| 209 | }; // end namespace branch_history_table |
---|
| 210 | }; // end namespace two_level_branch_predictor |
---|
| 211 | }; // end namespace meta_predictor |
---|
[48] | 212 | |
---|
| 213 | }; // end namespace core |
---|
| 214 | }; // end namespace multi_front_end |
---|
| 215 | }; // end namespace front_end |
---|
| 216 | }; // end namespace prediction_unit |
---|
| 217 | }; // end namespace direction |
---|
| 218 | |
---|
[2] | 219 | }; // end namespace behavioural |
---|
| 220 | }; // end namespace morpheo |
---|
| 221 | #endif |
---|