1 | #ifndef morpheo_behavioural_stage_1_ifetch_predictor_meta_predictor_two_level_branch_predictor_pattern_history_table_Pattern_History_Table_h |
---|
2 | #define morpheo_behavioural_stage_1_ifetch_predictor_meta_predictor_two_level_branch_predictor_pattern_history_table_Pattern_History_Table_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/Generic/Counter/include/Counter.h" |
---|
21 | #include "Behavioural/Generic/RegisterFile/RegisterFile_Monolithic/include/RegisterFile_Monolithic.h" |
---|
22 | |
---|
23 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table/include/Parameters.h" |
---|
24 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table/include/Types.h" |
---|
25 | #ifdef STATISTICS |
---|
26 | #include "Behavioural/Stage_1_Ifetch/Predictor/Meta_Predictor/Two_Level_Branch_Predictor/Pattern_History_Table/include/Statistics.h" |
---|
27 | #endif |
---|
28 | #ifdef VHDL |
---|
29 | #include "Behavioural/include/Vhdl.h" |
---|
30 | #endif |
---|
31 | #ifdef VHDL_TESTBENCH |
---|
32 | #include "Behavioural/include/Vhdl_Testbench.h" |
---|
33 | #endif |
---|
34 | |
---|
35 | using namespace std; |
---|
36 | |
---|
37 | namespace morpheo { |
---|
38 | namespace behavioural { |
---|
39 | namespace stage_1_ifetch { |
---|
40 | namespace predictor { |
---|
41 | namespace meta_predictor { |
---|
42 | namespace two_level_branch_predictor { |
---|
43 | namespace pattern_history_table { |
---|
44 | |
---|
45 | |
---|
46 | class Pattern_History_Table |
---|
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 | |
---|
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(Thistory_t) ** out_PREDICT_HISTORY ; |
---|
78 | |
---|
79 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_VAL ; |
---|
80 | public : SC_OUT(Tcontrol_t) ** out_BRANCH_COMPLETE_ACK ; |
---|
81 | public : SC_IN (Taddress_t) ** in_BRANCH_COMPLETE_ADDRESS; |
---|
82 | public : SC_IN (Thistory_t) ** in_BRANCH_COMPLETE_HISTORY; |
---|
83 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_DIRECTION; |
---|
84 | |
---|
85 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
86 | |
---|
87 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
88 | public : SC_SIGNAL(Thistory_t) ** signal_BRANCH_COMPLETE_HISTORY; |
---|
89 | #endif |
---|
90 | |
---|
91 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
92 | public : morpheo::behavioural::generic::counter::Counter * component_Counter ; |
---|
93 | public : morpheo::behavioural::generic::registerfile::registerfile_monolithic::RegisterFile_Monolithic * component_RegisterFile; |
---|
94 | |
---|
95 | // -----[ methods ]--------------------------------------------------- |
---|
96 | |
---|
97 | #ifdef SYSTEMC |
---|
98 | SC_HAS_PROCESS (Pattern_History_Table); |
---|
99 | #endif |
---|
100 | |
---|
101 | public : Pattern_History_Table ( |
---|
102 | #ifdef SYSTEMC |
---|
103 | sc_module_name name, |
---|
104 | #else |
---|
105 | string name, |
---|
106 | #endif |
---|
107 | #ifdef STATISTICS |
---|
108 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
109 | #endif |
---|
110 | Parameters param ); |
---|
111 | |
---|
112 | public : Pattern_History_Table (Parameters param ); |
---|
113 | public : ~Pattern_History_Table (void); |
---|
114 | |
---|
115 | #ifdef SYSTEMC |
---|
116 | private : void allocation (void); |
---|
117 | private : void deallocation (void); |
---|
118 | |
---|
119 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
120 | public : void transition (void); |
---|
121 | #endif |
---|
122 | #endif |
---|
123 | |
---|
124 | #ifdef STATISTICS |
---|
125 | public : string statistics (uint32_t depth); |
---|
126 | #endif |
---|
127 | |
---|
128 | #if VHDL |
---|
129 | public : void vhdl (void); |
---|
130 | private : void vhdl_port (Vhdl & vhdl); |
---|
131 | private : void vhdl_declaration (Vhdl & vhdl); |
---|
132 | private : void vhdl_body (Vhdl & vhdl); |
---|
133 | #endif |
---|
134 | |
---|
135 | #ifdef VHDL_TESTBENCH |
---|
136 | private : void vhdl_testbench_port (void); |
---|
137 | private : void vhdl_testbench_transition (void); |
---|
138 | #endif |
---|
139 | public : void vhdl_testbench_label (string label); |
---|
140 | }; |
---|
141 | |
---|
142 | }; // end namespace pattern_history_table |
---|
143 | }; // end namespace two_level_branch_predictor |
---|
144 | }; // end namespace meta_predictor |
---|
145 | }; // end namespace predictor |
---|
146 | }; // end namespace stage_1_ifetch |
---|
147 | |
---|
148 | }; // end namespace behavioural |
---|
149 | }; // end namespace morpheo |
---|
150 | |
---|
151 | #endif |
---|