[2] | 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/include/RegisterFile.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 | |
---|
| 73 | public : SC_IN (Tcontrol_t) ** in_PREDICT_VAL ; |
---|
| 74 | public : SC_OUT(Tcontrol_t) ** out_PREDICT_ACK ; |
---|
| 75 | public : SC_IN (Taddress_t) ** in_PREDICT_ADDRESS ; |
---|
| 76 | public : SC_OUT(Thistory_t) ** out_PREDICT_HISTORY ; |
---|
| 77 | |
---|
| 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 (Thistory_t) ** in_BRANCH_COMPLETE_HISTORY; |
---|
[3] | 82 | public : SC_IN (Tcontrol_t) ** in_BRANCH_COMPLETE_DIRECTION; |
---|
[2] | 83 | |
---|
| 84 | // ~~~~~[ Register ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 85 | |
---|
| 86 | // ~~~~~[ Internal ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
| 87 | public : SC_SIGNAL(Thistory_t) ** signal_BRANCH_COMPLETE_HISTORY; |
---|
| 88 | #endif |
---|
| 89 | |
---|
| 90 | // ~~~~~[ Component ]~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
[3] | 91 | public : morpheo::behavioural::generic::counter::Counter * component_Counter ; |
---|
| 92 | public : morpheo::behavioural::generic::registerfile::RegisterFile * component_RegisterFile; |
---|
[2] | 93 | |
---|
| 94 | // -----[ methods ]--------------------------------------------------- |
---|
| 95 | |
---|
| 96 | #ifdef SYSTEMC |
---|
| 97 | SC_HAS_PROCESS (Pattern_History_Table); |
---|
| 98 | #endif |
---|
| 99 | |
---|
| 100 | public : Pattern_History_Table ( |
---|
| 101 | #ifdef SYSTEMC |
---|
| 102 | sc_module_name name, |
---|
| 103 | #else |
---|
| 104 | string name, |
---|
| 105 | #endif |
---|
| 106 | #ifdef STATISTICS |
---|
| 107 | morpheo::behavioural::Parameters_Statistics param_statistics, |
---|
| 108 | #endif |
---|
| 109 | Parameters param ); |
---|
| 110 | |
---|
| 111 | public : Pattern_History_Table (Parameters param ); |
---|
| 112 | public : ~Pattern_History_Table (void); |
---|
| 113 | |
---|
| 114 | #ifdef SYSTEMC |
---|
| 115 | private : void allocation (void); |
---|
| 116 | private : void deallocation (void); |
---|
| 117 | |
---|
| 118 | #if (defined(STATISTICS) || defined (VHDL_TESTBENCH)) |
---|
| 119 | public : void transition (void); |
---|
| 120 | #endif |
---|
| 121 | #endif |
---|
| 122 | |
---|
| 123 | #ifdef STATISTICS |
---|
| 124 | public : string statistics (uint32_t depth); |
---|
| 125 | #endif |
---|
| 126 | |
---|
| 127 | #if VHDL |
---|
| 128 | public : void vhdl (void); |
---|
| 129 | private : void vhdl_port (Vhdl & vhdl); |
---|
| 130 | private : void vhdl_declaration (Vhdl & vhdl); |
---|
| 131 | private : void vhdl_body (Vhdl & vhdl); |
---|
| 132 | #endif |
---|
| 133 | |
---|
| 134 | #ifdef VHDL_TESTBENCH |
---|
| 135 | private : void vhdl_testbench_port (void); |
---|
| 136 | private : void vhdl_testbench_transition (void); |
---|
| 137 | #endif |
---|
| 138 | public : void vhdl_testbench_label (string label); |
---|
| 139 | }; |
---|
| 140 | |
---|
| 141 | }; // end namespace pattern_history_table |
---|
| 142 | }; // end namespace two_level_branch_predictor |
---|
| 143 | }; // end namespace meta_predictor |
---|
| 144 | }; // end namespace predictor |
---|
| 145 | }; // end namespace stage_1_ifetch |
---|
| 146 | |
---|
| 147 | }; // end namespace behavioural |
---|
| 148 | }; // end namespace morpheo |
---|
| 149 | |
---|
| 150 | #endif |
---|