[2] | 1 | #ifdef SYSTEMC |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Branch_History_Table/include/Branch_History_Table.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace stage_1_ifetch { |
---|
| 14 | namespace predictor { |
---|
| 15 | namespace meta_predictor { |
---|
| 16 | namespace two_level_branch_predictor { |
---|
| 17 | namespace branch_history_table { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | void Branch_History_Table::allocation (void) |
---|
| 21 | { |
---|
| 22 | string rename; |
---|
| 23 | |
---|
| 24 | in_CLOCK = new SC_CLOCK ("in_CLOCK"); |
---|
[15] | 25 | in_NRESET = new SC_IN (Tcontrol_t) ("in_NRESET"); |
---|
[2] | 26 | |
---|
| 27 | in_PREDICT_VAL = new SC_IN (Tcontrol_t) * [_param._nb_prediction]; |
---|
| 28 | out_PREDICT_ACK = new SC_OUT(Tcontrol_t) * [_param._nb_prediction]; |
---|
| 29 | in_PREDICT_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_prediction]; |
---|
| 30 | out_PREDICT_HISTORY = new SC_OUT(Thistory_t) * [_param._nb_prediction]; |
---|
| 31 | |
---|
| 32 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 33 | { |
---|
| 34 | rename = "in_PREDICT_VAL[" +toString(i)+"]"; |
---|
| 35 | in_PREDICT_VAL [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 36 | |
---|
| 37 | rename = "out_PREDICT_ACK[" +toString(i)+"]"; |
---|
| 38 | out_PREDICT_ACK [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
| 39 | |
---|
| 40 | rename = "in_PREDICT_ADDRESS["+toString(i)+"]"; |
---|
| 41 | in_PREDICT_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str()); |
---|
| 42 | |
---|
| 43 | rename = "out_PREDICT_HISTORY["+toString(i)+"]"; |
---|
| 44 | out_PREDICT_HISTORY [i] = new SC_OUT(Thistory_t) (rename.c_str()); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | in_BRANCH_COMPLETE_VAL = new SC_IN (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 48 | out_BRANCH_COMPLETE_ACK = new SC_OUT (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
| 49 | in_BRANCH_COMPLETE_ADDRESS = new SC_IN (Taddress_t) * [_param._nb_branch_complete]; |
---|
| 50 | in_BRANCH_COMPLETE_HISTORY = new SC_IN (Thistory_t) * [_param._nb_branch_complete]; |
---|
[3] | 51 | in_BRANCH_COMPLETE_DIRECTION= new SC_IN (Tcontrol_t) * [_param._nb_branch_complete]; |
---|
[2] | 52 | signal_BRANCH_COMPLETE_HISTORY = new SC_SIGNAL (Thistory_t) * [_param._nb_branch_complete]; |
---|
| 53 | |
---|
| 54 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 55 | { |
---|
| 56 | rename = "in_BRANCH_COMPLETE_VAL[" +toString(i)+"]"; |
---|
| 57 | in_BRANCH_COMPLETE_VAL [i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
| 58 | |
---|
| 59 | rename = "out_BRANCH_COMPLETE_ACK[" +toString(i)+"]"; |
---|
| 60 | out_BRANCH_COMPLETE_ACK [i] = new SC_OUT(Tcontrol_t) (rename.c_str()); |
---|
| 61 | |
---|
| 62 | rename = "in_BRANCH_COMPLETE_ADDRESS["+toString(i)+"]"; |
---|
| 63 | in_BRANCH_COMPLETE_ADDRESS [i] = new SC_IN (Taddress_t) (rename.c_str()); |
---|
| 64 | |
---|
| 65 | rename = "in_BRANCH_COMPLETE_HISTORY["+toString(i)+"]"; |
---|
| 66 | in_BRANCH_COMPLETE_HISTORY [i] = new SC_IN (Thistory_t) (rename.c_str()); |
---|
| 67 | |
---|
[3] | 68 | rename = "in_BRANCH_COMPLETE_DIRECTION[" +toString(i)+"]"; |
---|
| 69 | in_BRANCH_COMPLETE_DIRECTION[i] = new SC_IN (Tcontrol_t) (rename.c_str()); |
---|
[2] | 70 | |
---|
| 71 | rename = "signal_BRANCH_COMPLETE_HISTORY["+toString(i)+"]"; |
---|
| 72 | signal_BRANCH_COMPLETE_HISTORY [i] = new SC_SIGNAL (Thistory_t) (rename.c_str()); |
---|
| 73 | |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 77 | string name_component; |
---|
| 78 | // =====[ component_Shifter ]========================================= |
---|
| 79 | |
---|
| 80 | name_component = _name+"_Shifter"; |
---|
| 81 | |
---|
| 82 | component_Shifter = new morpheo::behavioural::generic::shifter::Shifter (name_component.c_str(), |
---|
| 83 | #ifdef STATISTICS |
---|
| 84 | _param_statistics , |
---|
| 85 | #endif |
---|
| 86 | *(_param._param_shifter) ); |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | // Instantiation |
---|
| 90 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
| 91 | (*(component_Shifter->in_CLOCK)) (*(in_CLOCK)); |
---|
| 92 | #endif |
---|
| 93 | |
---|
| 94 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 95 | { |
---|
[3] | 96 | (*(component_Shifter-> in_SHIFTER_DATA [i])) (*( in_BRANCH_COMPLETE_HISTORY [i])); |
---|
| 97 | (*(component_Shifter-> in_SHIFTER_CARRY_IN [i])) (*( in_BRANCH_COMPLETE_DIRECTION[i])); |
---|
| 98 | (*(component_Shifter->out_SHIFTER_DATA [i])) (*(signal_BRANCH_COMPLETE_HISTORY [i])); |
---|
[2] | 99 | } |
---|
| 100 | |
---|
| 101 | // =====[ component_RegisterFile ]==================================== |
---|
| 102 | |
---|
| 103 | name_component = _name+"_RegisterFile"; |
---|
| 104 | |
---|
[15] | 105 | component_RegisterFile = new morpheo::behavioural::generic::registerfile::registerfile_monolithic::RegisterFile_Monolithic(name_component.c_str(), |
---|
[2] | 106 | #ifdef STATISTICS |
---|
| 107 | _param_statistics , |
---|
| 108 | #endif |
---|
| 109 | *(_param._param_registerfile)); |
---|
| 110 | |
---|
| 111 | // Instantiation |
---|
[15] | 112 | (*(component_RegisterFile->in_CLOCK )) (*(in_CLOCK )); |
---|
| 113 | (*(component_RegisterFile->in_NRESET)) (*(in_NRESET)); |
---|
[2] | 114 | |
---|
| 115 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 116 | { |
---|
[15] | 117 | (*(component_RegisterFile-> in_READ_VAL [i])) (*( in_PREDICT_VAL [i])); |
---|
| 118 | (*(component_RegisterFile->out_READ_ACK [i])) (*(out_PREDICT_ACK [i])); |
---|
[2] | 119 | (*(component_RegisterFile-> in_READ_ADDRESS [i])) (*( in_PREDICT_ADDRESS [i])); |
---|
| 120 | (*(component_RegisterFile->out_READ_DATA [i])) (*(out_PREDICT_HISTORY [i])); |
---|
| 121 | } |
---|
| 122 | |
---|
| 123 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 124 | { |
---|
[15] | 125 | (*(component_RegisterFile-> in_WRITE_VAL [i])) (*( in_BRANCH_COMPLETE_VAL [i])); |
---|
| 126 | (*(component_RegisterFile->out_WRITE_ACK [i])) (*( out_BRANCH_COMPLETE_ACK [i])); |
---|
[2] | 127 | (*(component_RegisterFile-> in_WRITE_ADDRESS [i])) (*( in_BRANCH_COMPLETE_ADDRESS [i])); |
---|
| 128 | (*(component_RegisterFile-> in_WRITE_DATA [i])) (*(signal_BRANCH_COMPLETE_HISTORY [i])); |
---|
| 129 | } |
---|
| 130 | }; |
---|
| 131 | |
---|
| 132 | }; // end namespace branch_history_table |
---|
| 133 | }; // end namespace two_level_branch_predictor |
---|
| 134 | }; // end namespace meta_predictor |
---|
| 135 | }; // end namespace predictor |
---|
| 136 | }; // end namespace stage_1_ifetch |
---|
| 137 | }; // end namespace behavioural |
---|
| 138 | }; // end namespace morpheo |
---|
| 139 | #endif |
---|