00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef __GSHARE_H__
00039 #define __GSHARE_H__
00040
00041 #include "Sim/Predictor/BPred/DirPredIF.h"
00042 #include "Sim/Op/OpContainer/OpExtraStateTable.h"
00043
00044 #include "Env/Param/ParamExchange.h"
00045 #include "Sim/Foundation/Resource/ResourceNode.h"
00046
00047 namespace Onikiri
00048 {
00049 class Core;
00050 class PHT;
00051 class GlobalHistory;
00052
00053 class GShare :
00054 public PhysicalResourceNode,
00055 public DirPredIF
00056 {
00057 private:
00058
00059 int m_globalHistoryBits;
00060 int m_pthIndexBits;
00061 bool m_addrXORConvolute;
00062
00063
00064 Core* m_core;
00065 PHT* m_pht;
00066 PhysicalResourceArray<GlobalHistory>
00067 m_globalHistory;
00068
00069
00070 struct PredInfo
00071 {
00072
00073 int phtIndex;
00074
00075
00076 bool direction;
00077 };
00078 OpExtraStateTable<PredInfo> m_predTable;
00079
00080
00081 s64 m_numPred;
00082 s64 m_numHit;
00083 s64 m_numMiss;
00084 s64 m_numRetire;
00085
00086 public:
00087 BEGIN_PARAM_MAP("")
00088 BEGIN_PARAM_PATH( GetParamPath() )
00089 PARAM_ENTRY("@GlobalHistoryBits", m_globalHistoryBits)
00090 PARAM_ENTRY("@AddressXORConvolute", m_addrXORConvolute)
00091 END_PARAM_PATH()
00092 BEGIN_PARAM_PATH( GetResultPath() )
00093 PARAM_ENTRY( "@NumPred", m_numPred)
00094 PARAM_ENTRY( "@NumHit", m_numHit)
00095 PARAM_ENTRY( "@NumMiss", m_numMiss)
00096 PARAM_ENTRY( "@NumRetire", m_numRetire)
00097 RESULT_RATE_SUM_ENTRY( "@HitRate", \
00098 m_numHit, m_numHit, m_numMiss )
00099 END_PARAM_PATH()
00100 END_PARAM_MAP()
00101
00102 BEGIN_RESOURCE_MAP()
00103 RESOURCE_ENTRY( Core, "core", m_core )
00104 RESOURCE_ENTRY( PHT, "pht", m_pht )
00105 RESOURCE_ENTRY( GlobalHistory, "globalHistory", m_globalHistory )
00106 END_RESOURCE_MAP()
00107
00108 GShare();
00109 virtual ~GShare();
00110
00111
00112 void Initialize(InitPhase phase);
00113
00114
00115 bool Predict(OpIterator op, PC predIndexPC);
00116
00117
00118
00119
00120
00121
00122
00123 void Finished(OpIterator op);
00124
00125
00126 void Retired(OpIterator op);
00127
00128
00129 int GetPHTIndex(int localThreadID, const PC& pc);
00130
00131 };
00132
00133 };
00134
00135 #endif // __GSHARE_H__
00136