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 #ifndef __RMT_H__
00033 #define __RMT_H__
00034
00035 #include "Sim/Foundation/Checkpoint/CheckpointedData.h"
00036 #include "Interface/EmulatorIF.h"
00037 #include "Sim/Dependency/PhyReg/PhyReg.h"
00038 #include "Sim/Register/RegisterFile.h"
00039 #include "Sim/Register/RegisterFreeList.h"
00040 #include "Sim/Foundation/Hook/HookDecl.h"
00041 #include "Sim/ISAInfo.h"
00042
00043 #include "Sim/Predictor/DepPred/RegDepPred/RegDepPredBase.h"
00044
00045 namespace Onikiri
00046 {
00047
00048
00049
00050
00051 class RMT :
00052 public RegDepPredBase, public PhysicalResourceNode
00053 {
00054 protected:
00055 int m_numLogicalReg;
00056 int m_numRegSegment;
00057
00058
00059 Core* m_core;
00060 CheckpointMaster* m_checkpointMaster;
00061
00062
00063 EmulatorIF* m_emulator;
00064
00065
00066 RegisterFile* m_registerFile;
00067
00068
00069 boost::array<int, SimISAInfo::MAX_REG_COUNT> m_segmentTable;
00070
00071
00072
00073 RegisterFreeList* m_regFreeList;
00074
00075
00076 CheckpointedData<
00077 boost::array< int, SimISAInfo::MAX_REG_COUNT >
00078 > m_allocationTable;
00079
00080
00081
00082 std::vector<int> m_releaseTable;
00083
00084
00085 int GetRegisterSegmentID(int index)
00086 {
00087 return m_segmentTable[index];
00088 }
00089
00090 public:
00091
00092
00093 struct HookParam
00094 {
00095 OpIterator op;
00096 int logicalRegNum;
00097 int physicalRegNum;
00098 };
00099
00100 protected:
00101
00102 virtual void AllocateRegBody( HookParam* param );
00103 virtual void ReleaseRegBody ( HookParam* param );
00104 virtual void DeallocateRegBody( HookParam* param );
00105
00106 public:
00107 BEGIN_RESOURCE_MAP()
00108 RESOURCE_ENTRY( EmulatorIF, "emulator", m_emulator )
00109 RESOURCE_ENTRY( Core, "core", m_core )
00110 RESOURCE_ENTRY( RegisterFile, "registerFile", m_registerFile )
00111 RESOURCE_ENTRY( RegisterFreeList, "registerFreeList", m_regFreeList )
00112 RESOURCE_ENTRY( CheckpointMaster, "checkpointMaster", m_checkpointMaster )
00113 END_RESOURCE_MAP()
00114
00115 RMT();
00116 virtual ~RMT();
00117
00118 virtual void Initialize(InitPhase phase);
00119
00120
00121 virtual int ResolveReg(const int lno);
00122
00123
00124
00125
00126 virtual int PeekReg(const int lno) const;
00127
00128
00129 virtual int AllocateReg(OpIterator op, const int lno);
00130
00131
00132 virtual void ReleaseReg(OpIterator op, const int lno, int phyRegNo);
00133
00134 virtual void DeallocateReg(OpIterator op, const int lno, int phyRegNo);
00135
00136
00137 virtual bool CanAllocate(OpIterator* infoArray, int numOp);
00138
00139
00140 virtual int GetRegSegmentCount();
00141 virtual int GetLogicalRegCount(int segment);
00142 virtual int GetTotalLogicalRegCount();
00143
00144
00145
00146
00147
00148
00149 static HookPoint<RMT,HookParam> s_allocateRegHook;
00150 static HookPoint<RMT,HookParam> s_releaseRegHook;
00151 static HookPoint<RMT,HookParam> s_deallocateRegHook;
00152
00153 };
00154
00155 };
00156
00157 #endif // __RMT_H__
00158