1 | /* |
---|
2 | * $Id: Two_Level_Branch_Predictor_allocation.cpp 112 2009-03-18 22:36:26Z rosiere $ |
---|
3 | * |
---|
4 | * [ Description ] |
---|
5 | * |
---|
6 | */ |
---|
7 | |
---|
8 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Direction/Meta_Predictor/Two_Level_Branch_Predictor/include/Two_Level_Branch_Predictor.h" |
---|
9 | #include "Behavioural/include/Allocation.h" |
---|
10 | #include "Common/include/Max.h" |
---|
11 | |
---|
12 | namespace morpheo { |
---|
13 | namespace behavioural { |
---|
14 | namespace core { |
---|
15 | namespace multi_front_end { |
---|
16 | namespace front_end { |
---|
17 | namespace prediction_unit { |
---|
18 | namespace direction { |
---|
19 | namespace meta_predictor { |
---|
20 | namespace two_level_branch_predictor { |
---|
21 | |
---|
22 | #undef FUNCTION |
---|
23 | #define FUNCTION "Two_Level_Branch_Predictor::allocation" |
---|
24 | void Two_Level_Branch_Predictor::allocation ( |
---|
25 | #ifdef STATISTICS |
---|
26 | morpheo::behavioural::Parameters_Statistics * param_statistics |
---|
27 | #else |
---|
28 | void |
---|
29 | #endif |
---|
30 | ) |
---|
31 | { |
---|
32 | log_begin(Two_Level_Branch_Predictor,FUNCTION); |
---|
33 | |
---|
34 | _component = new Component (_usage); |
---|
35 | |
---|
36 | Entity * entity = _component->set_entity (_name |
---|
37 | ,"Two_Level_Branch_Predictor" |
---|
38 | #ifdef POSITION |
---|
39 | ,COMBINATORY |
---|
40 | #endif |
---|
41 | ); |
---|
42 | |
---|
43 | _interfaces = entity->set_interfaces(); |
---|
44 | |
---|
45 | // ~~~~~[ Interface : "" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
46 | { |
---|
47 | Interface * interface = _interfaces->set_interface("" |
---|
48 | #ifdef POSITION |
---|
49 | ,IN |
---|
50 | ,SOUTH, |
---|
51 | _("Generalist interface") |
---|
52 | #endif |
---|
53 | ); |
---|
54 | |
---|
55 | in_CLOCK = interface->set_signal_clk ("clock" ,1, CLOCK_VHDL_YES); |
---|
56 | in_NRESET = interface->set_signal_in <Tcontrol_t> ("nreset",1, RESET_VHDL_YES); |
---|
57 | } |
---|
58 | |
---|
59 | // ~~~~~[ Interface : "predict" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
60 | { |
---|
61 | ALLOC1_INTERFACE_BEGIN("predict",IN,WEST,_("Predict direction interface"),_param->_nb_inst_predict); |
---|
62 | |
---|
63 | ALLOC1_VALACK_IN ( in_PREDICT_VAL ,VAL); |
---|
64 | ALLOC1_VALACK_OUT(out_PREDICT_ACK ,ACK); |
---|
65 | ALLOC1_SIGNAL_IN ( in_PREDICT_ADDRESS ,"ADDRESS" ,Taddress_t,_param->_size_address); |
---|
66 | ALLOC1_SIGNAL_OUT(out_PREDICT_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); |
---|
67 | ALLOC1_SIGNAL_OUT(out_PREDICT_HISTORY ,"HISTORY" ,Thistory_t,_param->_size_history); |
---|
68 | if (_param->_update_on_prediction) |
---|
69 | { |
---|
70 | ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION_VAL,"DIRECTION_VAL",Tcontrol_t,1 ); |
---|
71 | ALLOC1_SIGNAL_IN ( in_PREDICT_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); |
---|
72 | } |
---|
73 | |
---|
74 | ALLOC1_INTERFACE_END(_param->_nb_inst_predict); |
---|
75 | } |
---|
76 | |
---|
77 | // ~~~~~[ Interface : "update" ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
78 | { |
---|
79 | ALLOC1_INTERFACE_BEGIN("update",IN,WEST,_("Update direction interface"),_param->_nb_inst_update); |
---|
80 | |
---|
81 | ALLOC1_VALACK_IN ( in_UPDATE_VAL ,VAL); |
---|
82 | ALLOC1_VALACK_OUT(out_UPDATE_ACK ,ACK); |
---|
83 | ALLOC1_SIGNAL_IN ( in_UPDATE_ADDRESS ,"ADDRESS" ,Taddress_t,_param->_size_address); |
---|
84 | ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY ,"HISTORY" ,Thistory_t,_param->_size_history); |
---|
85 | ALLOC1_SIGNAL_IN ( in_UPDATE_HISTORY_VAL ,"HISTORY_VAL" ,Tcontrol_t,1 ); |
---|
86 | ALLOC1_SIGNAL_IN ( in_UPDATE_DIRECTION ,"DIRECTION" ,Tcontrol_t,1 ); |
---|
87 | if (_param->_update_on_prediction) |
---|
88 | ALLOC1_SIGNAL_IN ( in_UPDATE_MISS ,"MISS" ,Tcontrol_t,1 ); |
---|
89 | |
---|
90 | ALLOC1_INTERFACE_END(_param->_nb_inst_update); |
---|
91 | } |
---|
92 | |
---|
93 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
94 | |
---|
95 | if (usage_is_set(_usage,USE_SYSTEMC)) |
---|
96 | { |
---|
97 | if (_param->_have_bht) |
---|
98 | { |
---|
99 | ALLOC1(reg_BHT ,Thistory_t,_param->_bht_nb_shifter); |
---|
100 | |
---|
101 | for (uint32_t i=0; i<_param->_bht_nb_shifter; ++i) |
---|
102 | reg_BHT [i] = 0; |
---|
103 | } |
---|
104 | |
---|
105 | if (_param->_have_pht) |
---|
106 | { |
---|
107 | ALLOC2(reg_PHT ,Thistory_t,_param->_pht_nb_bank,_param->_pht_size_bank); |
---|
108 | |
---|
109 | for (uint32_t i=0; i<_param->_pht_nb_bank; ++i) |
---|
110 | for (uint32_t j=0; j<_param->_pht_size_bank; ++j) |
---|
111 | reg_PHT [i][j] = 0; |
---|
112 | } |
---|
113 | |
---|
114 | |
---|
115 | ALLOC1(internal_PREDICT_ACK ,Tcontrol_t,_param->_nb_inst_predict); |
---|
116 | if (_param->_update_on_prediction) |
---|
117 | { |
---|
118 | if (_param->_have_bht) |
---|
119 | ALLOC1(internal_PREDICT_BHT_NUM_REG ,Thistory_t,_param->_nb_inst_predict); |
---|
120 | if (_param->_have_pht) |
---|
121 | { |
---|
122 | ALLOC1(internal_PREDICT_PHT_NUM_BANK ,Thistory_t,_param->_nb_inst_predict); |
---|
123 | ALLOC1(internal_PREDICT_PHT_NUM_REG ,Thistory_t,_param->_nb_inst_predict); |
---|
124 | } |
---|
125 | } |
---|
126 | ALLOC1(internal_UPDATE_ACK ,Tcontrol_t,_param->_nb_inst_update ); |
---|
127 | } |
---|
128 | |
---|
129 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
130 | #ifdef POSITION |
---|
131 | if (usage_is_set(_usage,USE_POSITION)) |
---|
132 | _component->generate_file(); |
---|
133 | #endif |
---|
134 | |
---|
135 | log_end(Two_Level_Branch_Predictor,FUNCTION); |
---|
136 | }; |
---|
137 | |
---|
138 | }; // end namespace two_level_branch_predictor |
---|
139 | }; // end namespace meta_predictor |
---|
140 | }; // end namespace direction |
---|
141 | }; // end namespace prediction_unit |
---|
142 | }; // end namespace front_end |
---|
143 | }; // end namespace multi_front_end |
---|
144 | }; // end namespace core |
---|
145 | |
---|
146 | }; // end namespace behavioural |
---|
147 | }; // end namespace morpheo |
---|