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 "Include/ToString.h" |
---|
17 | #include "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 | #ifdef VHDL_TESTBENCH |
---|
33 | #include "Behavioural/include/Vhdl_Testbench.h" |
---|
34 | #endif |
---|
35 | |
---|
36 | using namespace std; |
---|
37 | |
---|
38 | namespace morpheo { |
---|
39 | namespace behavioural { |
---|
40 | namespace stage_1_ifetch { |
---|
41 | namespace predictor { |
---|
42 | namespace meta_predictor { |
---|
43 | namespace two_level_branch_predictor { |
---|
44 | |
---|
45 | |
---|
46 | class Two_Level_Branch_Predictor |
---|
47 | #if SYSTEMC |
---|
48 | : public sc_module |
---|
49 | #endif |
---|
50 | { |
---|
51 | // -----[ fields ]---------------------------------------------------- |
---|
52 | // Parameters |
---|
53 | protected : const string _name; |
---|
54 | |
---|
55 | protected : const Parameters _param; |
---|
56 | #ifdef STATISTICS |
---|
57 | protected : const morpheo::behavioural::Parameters_Statistics _param_statistics; |
---|
58 | #endif |
---|
59 | |
---|
60 | #ifdef STATISTICS |
---|
61 | private : Statistics * _stat; |
---|
62 | #endif |
---|
63 | |
---|
64 | #ifdef VHDL_TESTBENCH |
---|
65 | private : Vhdl_Testbench * _vhdl_testbench; |
---|
66 | #endif |
---|
67 | |
---|
68 | #ifdef SYSTEMC |
---|
69 | // ~~~~~[ Interface ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
70 | // Interface |
---|
71 | public : SC_CLOCK * in_CLOCK ; |
---|
72 | public : SC_IN (Tcontrol_t) * in_NRESET ; |
---|
73 | // Interface Predict |
---|
74 | public : SC_IN (Tcontrol_t) ** in_PREDICT_VAL ; |
---|
75 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_ACK ; |
---|
76 | public : SC_IN (Taddress_t) ** in_PREDICT_ADDRESS ; |
---|
77 | public : SC_OUT(Tbht_history_t) ** out_PREDICT_BHT_HISTORY ; |
---|
78 | public : SC_OUT(Tpht_history_t) ** out_PREDICT_PHT_HISTORY ; |
---|
79 | |
---|
80 | // Interface Branch_complete |
---|
81 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_VAL ; |
---|
82 | public : SC_OUT(Tcontrol_t) ** out_BRANCH_COMPLETE_ACK ; |
---|
83 | public : SC_IN (Taddress_t) ** in_BRANCH_COMPLETE_ADDRESS ; |
---|
84 | public : SC_IN (Tbht_history_t) ** in_BRANCH_COMPLETE_BHT_HISTORY; |
---|
85 | public : SC_IN (Tpht_history_t) ** in_BRANCH_COMPLETE_PHT_HISTORY; |
---|
86 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_DIRECTION ; |
---|
87 | |
---|
88 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
89 | |
---|
90 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
91 | private : SC_SIGNAL(Tcontrol_t) ** signal_PREDICT_BHT_ACK ; |
---|
92 | private : SC_SIGNAL(Tcontrol_t) ** signal_PREDICT_PHT_ACK ; |
---|
93 | private : SC_SIGNAL(Taddress_t) ** signal_PREDICT_BHT_ADDRESS ; |
---|
94 | private : SC_SIGNAL(Taddress_t) ** signal_PREDICT_PHT_ADDRESS ; |
---|
95 | |
---|
96 | private : SC_SIGNAL(Tcontrol_t) ** signal_BRANCH_COMPLETE_BHT_ACK ; |
---|
97 | private : SC_SIGNAL(Tcontrol_t) ** signal_BRANCH_COMPLETE_PHT_ACK ; |
---|
98 | private : SC_SIGNAL(Taddress_t) ** signal_BRANCH_COMPLETE_BHT_ADDRESS; |
---|
99 | private : SC_SIGNAL(Taddress_t) ** signal_BRANCH_COMPLETE_PHT_ADDRESS; |
---|
100 | #endif |
---|
101 | |
---|
102 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
103 | protected : morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::branch_history_table ::Branch_History_Table * component_Branch_History_Table; |
---|
104 | protected : morpheo::behavioural::stage_1_ifetch::predictor::meta_predictor::two_level_branch_predictor::pattern_history_table::Pattern_History_Table * component_Pattern_History_Table; |
---|
105 | 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; |
---|
106 | |
---|
107 | // -----[ methods ]--------------------------------------------------- |
---|
108 | |
---|
109 | #ifdef SYSTEMC |
---|
110 | SC_HAS_PROCESS (Two_Level_Branch_Predictor); |
---|
111 | #endif |
---|
112 | public : Two_Level_Branch_Predictor ( |
---|
113 | #ifdef SYSTEMC |
---|
114 | sc_module_name name, |
---|
115 | #else |
---|
116 | string name, |
---|
117 | #endif |
---|
118 | #ifdef STATISTICS |
---|
119 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
120 | #endif |
---|
121 | Parameters param ); |
---|
122 | |
---|
123 | public : Two_Level_Branch_Predictor (Parameters param ); |
---|
124 | public : ~Two_Level_Branch_Predictor (void); |
---|
125 | |
---|
126 | #ifdef SYSTEMC |
---|
127 | private : void allocation (void); |
---|
128 | private : void deallocation (void); |
---|
129 | |
---|
130 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
131 | public : void transition (void); |
---|
132 | #endif |
---|
133 | #endif |
---|
134 | #ifdef STATISTICS |
---|
135 | public : string statistics (uint32_t depth); |
---|
136 | #endif |
---|
137 | |
---|
138 | #if VHDL |
---|
139 | public : void vhdl (void); |
---|
140 | private : void vhdl_port (Vhdl & vhdl); |
---|
141 | private : void vhdl_declaration (Vhdl & vhdl); |
---|
142 | private : void vhdl_body (Vhdl & vhdl); |
---|
143 | #endif |
---|
144 | |
---|
145 | #ifdef VHDL_TESTBENCH |
---|
146 | private : void vhdl_testbench_port (void); |
---|
147 | private : void vhdl_testbench_transition (void); |
---|
148 | #endif |
---|
149 | public : void vhdl_testbench_label (string label); |
---|
150 | }; |
---|
151 | |
---|
152 | }; // end namespace two_level_branch_predictor |
---|
153 | }; // end namespace meta_predictor |
---|
154 | }; // end namespace predictor |
---|
155 | }; // end namespace stage_1_ifetch |
---|
156 | |
---|
157 | }; // end namespace behavioural |
---|
158 | }; // end namespace morpheo |
---|
159 | |
---|
160 | #endif |
---|