[2] | 1 | #ifdef VHDL |
---|
| 2 | /* |
---|
| 3 | * $Id$ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.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 | |
---|
| 18 | |
---|
| 19 | void Two_Level_Branch_Predictor::vhdl_body (Vhdl & vhdl) |
---|
| 20 | { |
---|
| 21 | log_printf(FUNC,Two_Level_Branch_Predictor,"vhdl_body","Begin"); |
---|
[3] | 22 | |
---|
| 23 | list<string> list_port_map; |
---|
| 24 | |
---|
| 25 | if (_param._have_bht) |
---|
| 26 | { |
---|
| 27 | list_port_map.clear(); |
---|
| 28 | |
---|
[15] | 29 | vhdl.set_body_component_port_map (list_port_map,"in_CLOCK ","in_CLOCK "); |
---|
| 30 | vhdl.set_body_component_port_map (list_port_map,"in_NRESET","in_NRESET"); |
---|
[3] | 31 | |
---|
| 32 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 33 | { |
---|
| 34 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_VAL_"+toString(i)+" "," in_PREDICT_VAL_"+toString(i)); |
---|
| 35 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+" ","signal_PREDICT_BHT_ACK_"+toString(i)); |
---|
| 36 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_ADDRESS_"+toString(i)+" ","signal_PREDICT_BHT_ADDRESS_"+toString(i)); |
---|
| 37 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_HISTORY_"+toString(i)+" ","signal_PREDICT_BHT_HISTORY_"+toString(i)); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 41 | { |
---|
| 42 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+" "," in_BRANCH_COMPLETE_VAL_"+toString(i)); |
---|
| 43 | vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+" ","signal_BRANCH_COMPLETE_BHT_ACK_"+toString(i)); |
---|
| 44 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)+" ","signal_BRANCH_COMPLETE_BHT_ADDRESS_"+toString(i)); |
---|
| 45 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_HISTORY_"+toString(i)+" "," in_BRANCH_COMPLETE_BHT_HISTORY_"+toString(i)); |
---|
| 46 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+""," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)); |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | vhdl.set_body_component ("component_Branch_History_Table",_name+"_Branch_History_Table",list_port_map); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | if (_param._have_pht) |
---|
| 53 | { |
---|
| 54 | list_port_map.clear(); |
---|
| 55 | |
---|
[15] | 56 | vhdl.set_body_component_port_map (list_port_map,"in_CLOCK ","in_CLOCK "); |
---|
| 57 | vhdl.set_body_component_port_map (list_port_map,"in_NRESET","in_NRESET"); |
---|
[3] | 58 | |
---|
| 59 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 60 | { |
---|
| 61 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_VAL_"+toString(i)+" "," in_PREDICT_VAL_"+toString(i)); |
---|
| 62 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+" ","signal_PREDICT_PHT_ACK_"+toString(i)); |
---|
| 63 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_ADDRESS_"+toString(i)+" ","signal_PREDICT_PHT_ADDRESS_"+toString(i)); |
---|
| 64 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_HISTORY_"+toString(i)+" "," out_PREDICT_PHT_HISTORY_"+toString(i)); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 68 | { |
---|
| 69 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_VAL_"+toString(i)+" "," in_BRANCH_COMPLETE_VAL_"+toString(i)); |
---|
| 70 | vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+" ","signal_BRANCH_COMPLETE_PHT_ACK_"+toString(i)); |
---|
| 71 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)+" ","signal_BRANCH_COMPLETE_PHT_ADDRESS_"+toString(i)); |
---|
| 72 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_HISTORY_"+toString(i)+" "," in_BRANCH_COMPLETE_PHT_HISTORY_"+toString(i)); |
---|
| 73 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)+""," in_BRANCH_COMPLETE_DIRECTION_"+toString(i)); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | vhdl.set_body_component ("component_Pattern_History_Table",_name+"_Pattern_History_Table",list_port_map); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | list_port_map.clear(); |
---|
| 80 | |
---|
| 81 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 82 | { |
---|
| 83 | if (_param._have_bht) |
---|
| 84 | { |
---|
| 85 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_BHT_ACK_"+toString(i)+" ","signal_PREDICT_BHT_ACK_"+toString(i)); |
---|
| 86 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_BHT_ADDRESS_"+toString(i)+" ","signal_PREDICT_BHT_ADDRESS_"+toString(i)); |
---|
| 87 | } |
---|
| 88 | if (_param._have_pht) |
---|
| 89 | { |
---|
| 90 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_PHT_ACK_"+toString(i)+" ","signal_PREDICT_PHT_ACK_"+toString(i)); |
---|
| 91 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_PHT_ADDRESS_"+toString(i)+" ","signal_PREDICT_PHT_ADDRESS_"+toString(i)); |
---|
| 92 | } |
---|
| 93 | if (_param._have_bht and _param._have_pht) |
---|
| 94 | { |
---|
| 95 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_BHT_HISTORY_"+toString(i)+" ","signal_PREDICT_BHT_HISTORY_"+toString(i)); |
---|
| 96 | } |
---|
| 97 | vhdl.set_body_component_port_map (list_port_map,"out_PREDICT_ACK_"+toString(i)+" "," out_PREDICT_ACK_"+toString(i)); |
---|
| 98 | vhdl.set_body_component_port_map (list_port_map," in_PREDICT_ADDRESS_"+toString(i)+" "," in_PREDICT_ADDRESS_"+toString(i)); |
---|
| 99 | } |
---|
| 100 | |
---|
| 101 | for (uint32_t i=0; i<_param._nb_branch_complete; i++) |
---|
| 102 | { |
---|
| 103 | if (_param._have_bht) |
---|
| 104 | { |
---|
| 105 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_BHT_ACK_"+toString(i)+" ","signal_BRANCH_COMPLETE_BHT_ACK_"+toString(i)); |
---|
| 106 | vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_BHT_ADDRESS_"+toString(i)+"","signal_BRANCH_COMPLETE_BHT_ADDRESS_"+toString(i)); |
---|
| 107 | } |
---|
| 108 | if (_param._have_pht) |
---|
| 109 | { |
---|
| 110 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_PHT_ACK_"+toString(i)+" ","signal_BRANCH_COMPLETE_PHT_ACK_"+toString(i)); |
---|
| 111 | vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_PHT_ADDRESS_"+toString(i)+"","signal_BRANCH_COMPLETE_PHT_ADDRESS_"+toString(i)); |
---|
| 112 | } |
---|
| 113 | if (_param._have_bht and _param._have_pht) |
---|
| 114 | { |
---|
| 115 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_BHT_HISTORY_"+toString(i)+""," in_BRANCH_COMPLETE_BHT_HISTORY_"+toString(i)); |
---|
| 116 | } |
---|
| 117 | vhdl.set_body_component_port_map (list_port_map,"out_BRANCH_COMPLETE_ACK_"+toString(i)+" "," out_BRANCH_COMPLETE_ACK_"+toString(i)); |
---|
| 118 | vhdl.set_body_component_port_map (list_port_map," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)+" "," in_BRANCH_COMPLETE_ADDRESS_"+toString(i)); |
---|
| 119 | } |
---|
| 120 | |
---|
| 121 | vhdl.set_body_component ("component_Two_Level_Branch_Predictor_Glue",_name+"_Two_Level_Branch_Predictor_Glue",list_port_map); |
---|
| 122 | |
---|
| 123 | if (_param._have_bht) |
---|
| 124 | for (uint32_t i=0; i<_param._nb_prediction; i++) |
---|
| 125 | vhdl.set_body("out_PREDICT_BHT_HISTORY_"+toString(i)+" <= signal_PREDICT_BHT_HISTORY_"+toString(i)+";"); |
---|
| 126 | |
---|
[2] | 127 | log_printf(FUNC,Two_Level_Branch_Predictor,"vhdl_body","End"); |
---|
| 128 | }; |
---|
| 129 | |
---|
| 130 | }; // end namespace two_level_branch_predictor |
---|
| 131 | }; // end namespace meta_predictor |
---|
| 132 | }; // end namespace predictor |
---|
| 133 | }; // end namespace stage_1_ifetch |
---|
| 134 | |
---|
| 135 | }; // end namespace behavioural |
---|
| 136 | }; // end namespace morpheo |
---|
| 137 | #endif |
---|