1 | #ifndef morpheo_behavioural_stage_1_ifetch_predictor_meta_predictor_two_level_branch_predictor_Two_Level_Branch_Predictor_h |
---|
2 | #define morpheo_behavioural_stage_1_ifetch_predictor_meta_predictor_two_level_branch_predictor_Two_Level_Branch_Predictor_h |
---|
3 | |
---|
4 | /* |
---|
5 | * $Id$ |
---|
6 | * |
---|
7 | * [ Description ] |
---|
8 | * |
---|
9 | */ |
---|
10 | |
---|
11 | #ifdef SYSTEMC |
---|
12 | #include "systemc.h" |
---|
13 | #endif |
---|
14 | |
---|
15 | #include <iostream> |
---|
16 | #include "Common/include/ToString.h" |
---|
17 | #include "Common/include/Debug.h" |
---|
18 | |
---|
19 | // Internal structure |
---|
20 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Branch_History_Table/include/Branch_History_Table.h" |
---|
21 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table/include/Pattern_History_Table.h" |
---|
22 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Two_Level_Branch_Predictor_Glue/include/Two_Level_Branch_Predictor_Glue.h" |
---|
23 | |
---|
24 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/include/Parameters.h" |
---|
25 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/include/Types.h" |
---|
26 | #ifdef STATISTICS |
---|
27 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/include/Statistics.h" |
---|
28 | #endif |
---|
29 | #ifdef VHDL |
---|
30 | #include "Behavioural/include/Vhdl.h" |
---|
31 | #endif |
---|
32 | #include "Behavioural/include/Component.h" |
---|
33 | |
---|
34 | using namespace std; |
---|
35 | |
---|
36 | namespace morpheo { |
---|
37 | namespace behavioural { |
---|
38 | namespace stage_1_ifetch { |
---|
39 | namespace predictor { |
---|
40 | namespace meta_predictor { |
---|
41 | namespace two_level_branch_predictor { |
---|
42 | |
---|
43 | |
---|
44 | class Two_Level_Branch_Predictor |
---|
45 | #if SYSTEMC |
---|
46 | : public sc_module |
---|
47 | #endif |
---|
48 | { |
---|
49 | // -----[ fields ]---------------------------------------------------- |
---|
50 | // Parameters |
---|
51 | protected : const string _name; |
---|
52 | |
---|
53 | protected : const Parameters _param; |
---|
54 | #ifdef STATISTICS |
---|
55 | protected : const morpheo::behavioural::Parameters_Statistics _param_statistics; |
---|
56 | #endif |
---|
57 | |
---|
58 | #ifdef STATISTICS |
---|
59 | private : Statistics * _stat; |
---|
60 | #endif |
---|
61 | |
---|
62 | public : Component * _component; |
---|
63 | private : Interfaces * _interfaces; |
---|
64 | |
---|
65 | #ifdef SYSTEMC |
---|
66 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
67 | // Interface |
---|
68 | public : SC_CLOCK * in_CLOCK ; |
---|
69 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
70 | // Interface Predict |
---|
71 | public : SC_IN (Tcontrol_t) ** in_PREDICT_VAL ; |
---|
72 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_ACK ; |
---|
73 | public : SC_IN (Taddress_t) ** in_PREDICT_ADDRESS ; |
---|
74 | public : SC_OUT(Tbht_history_t) ** out_PREDICT_BHT_HISTORY ; |
---|
75 | public : SC_OUT(Tpht_history_t) ** out_PREDICT_PHT_HISTORY ; |
---|
76 | |
---|
77 | // Interface Branch_complete |
---|
78 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_VAL ; |
---|
79 | public : SC_OUT(Tcontrol_t) ** out_BRANCH_COMPLETE_ACK ; |
---|
80 | public : SC_IN (Taddress_t) ** in_BRANCH_COMPLETE_ADDRESS ; |
---|
81 | public : SC_IN (Tbht_history_t) ** in_BRANCH_COMPLETE_BHT_HISTORY; |
---|
82 | public : SC_IN (Tpht_history_t) ** in_BRANCH_COMPLETE_PHT_HISTORY; |
---|
83 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_DIRECTION ; |
---|
84 | |
---|
85 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
86 | |
---|
87 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
88 | private : SC_SIGNAL(Tcontrol_t) ** signal_PREDICT_BHT_ACK ; |
---|
89 | private : SC_SIGNAL(Tcontrol_t) ** signal_PREDICT_PHT_ACK ; |
---|
90 | private : SC_SIGNAL(Taddress_t) ** signal_PREDICT_BHT_ADDRESS ; |
---|
91 | private : SC_SIGNAL(Taddress_t) ** signal_PREDICT_PHT_ADDRESS ; |
---|
92 | |
---|
93 | private : SC_SIGNAL(Tcontrol_t) ** signal_BRANCH_COMPLETE_BHT_ACK ; |
---|
94 | private : SC_SIGNAL(Tcontrol_t) ** signal_BRANCH_COMPLETE_PHT_ACK ; |
---|
95 | private : SC_SIGNAL(Taddress_t) ** signal_BRANCH_COMPLETE_BHT_ADDRESS; |
---|
96 | private : SC_SIGNAL(Taddress_t) ** signal_BRANCH_COMPLETE_PHT_ADDRESS; |
---|
97 | #endif |
---|
98 | |
---|
99 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
100 | protected : morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::branch_history_table ::Branch_History_Table * component_Branch_History_Table; |
---|
101 | protected : morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::pattern_history_table::Pattern_History_Table * component_Pattern_History_Table; |
---|
102 | protected : morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::two_level_branch_predictor_glue::Two_Level_Branch_Predictor_Glue * component_Two_Level_Branch_Predictor_Glue; |
---|
103 | |
---|
104 | // -----[ methods ]--------------------------------------------------- |
---|
105 | |
---|
106 | #ifdef SYSTEMC |
---|
107 | SC_HAS_PROCESS (Two_Level_Branch_Predictor); |
---|
108 | #endif |
---|
109 | public : Two_Level_Branch_Predictor ( |
---|
110 | #ifdef SYSTEMC |
---|
111 | sc_module_name name, |
---|
112 | #else |
---|
113 | string name, |
---|
114 | #endif |
---|
115 | #ifdef STATISTICS |
---|
116 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
117 | #endif |
---|
118 | Parameters param ); |
---|
119 | |
---|
120 | public : Two_Level_Branch_Predictor (Parameters param ); |
---|
121 | public : ~Two_Level_Branch_Predictor (void); |
---|
122 | |
---|
123 | #ifdef SYSTEMC |
---|
124 | private : void allocation (void); |
---|
125 | private : void deallocation (void); |
---|
126 | |
---|
127 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
128 | public : void transition (void); |
---|
129 | #endif |
---|
130 | #endif |
---|
131 | #ifdef STATISTICS |
---|
132 | public : string statistics (uint32_t depth); |
---|
133 | #endif |
---|
134 | |
---|
135 | #if VHDL |
---|
136 | public : void vhdl (void); |
---|
137 | private : void vhdl_declaration (Vhdl * & vhdl); |
---|
138 | private : void vhdl_body (Vhdl * & vhdl); |
---|
139 | #endif |
---|
140 | #ifdef VHDL_TESTBENCH |
---|
141 | private : void vhdl_testbench_transition (void); |
---|
142 | #endif |
---|
143 | }; |
---|
144 | |
---|
145 | }; // end namespace two_level_branch_predictor |
---|
146 | }; // end namespace meta_predictor |
---|
147 | }; // end namespace predictor |
---|
148 | }; // end namespace stage_1_ifetch |
---|
149 | |
---|
150 | }; // end namespace behavioural |
---|
151 | }; // end namespace morpheo |
---|
152 | |
---|
153 | #endif |
---|