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 SIM_EXEC_UNIT_EXEC_UNIT_BASE_H
00033 #define SIM_EXEC_UNIT_EXEC_UNIT_BASE_H
00034
00035 #include "Sim/Foundation/Resource/ResourceNode.h"
00036 #include "Sim/Foundation/Hook/HookDecl.h"
00037 #include "Sim/ExecUnit/ExecUnitIF.h"
00038 #include "Sim/ExecUnit/ExecUnitReserver.h"
00039
00040 namespace Onikiri
00041 {
00042 class ExecLatencyInfo;
00043 class Scheduler;
00044 class Core;
00045 struct IssueState;
00046
00047
00048 class ExecUnitBase :
00049 public PhysicalResourceNode,
00050 public ExecUnitIF
00051 {
00052 public:
00053 BEGIN_PARAM_MAP("")
00054
00055 BEGIN_PARAM_PATH( GetParamPath() )
00056 PARAM_ENTRY( "@Name", m_name )
00057 PARAM_ENTRY( "@Port", m_numPorts )
00058 PARAM_ENTRY( "@Code", m_codeStr )
00059 END_PARAM_PATH()
00060
00061 BEGIN_PARAM_PATH( GetResultPath() )
00062 PARAM_ENTRY( "@Name", m_name )
00063 PARAM_ENTRY( "@NumUsed", m_numUsed )
00064 PARAM_ENTRY( "@NumUsable", m_numUsable )
00065 RESULT_RATE_SUM_ENTRY("@UseRate", \
00066 m_numUsed, m_numUsed, m_numUsable
00067 )
00068 END_PARAM_PATH()
00069
00070 END_PARAM_MAP()
00071
00072 BEGIN_RESOURCE_MAP()
00073 RESOURCE_ENTRY( ExecLatencyInfo, "execLatencyInfo", m_execLatencyInfo )
00074 RESOURCE_ENTRY( Core, "core", m_core )
00075 END_RESOURCE_MAP()
00076
00077
00078 ExecUnitBase();
00079 virtual ~ExecUnitBase();
00080 virtual void Initialize( InitPhase phase );
00081 virtual void Finalize();
00082
00083 virtual int GetMappedCode(int index);
00084 virtual int GetMappedCodeCount();
00085
00086
00087 virtual void Execute( OpIterator op );
00088
00089
00090 virtual int GetLatencyCount( const OpClass& opClass );
00091
00092
00093 virtual int GetLatency( const OpClass& opClass, int index );
00094
00095
00096 virtual void Begin();
00097
00098
00099 virtual void Update();
00100
00101
00102 ExecLatencyInfo* GetExecLatencyInfo()
00103 {
00104 return m_execLatencyInfo;
00105 }
00106
00107 virtual ExecUnitReserver* GetReserver()
00108 {
00109 return &m_reserver;
00110 }
00111
00112 protected:
00113 std::string m_name;
00114 int m_numPorts;
00115
00116
00117 u64 m_numUsed;
00118 u64 m_numUsable;
00119
00120
00121 ExecLatencyInfo* m_execLatencyInfo;
00122 Core* m_core;
00123 ExecUnitReserver m_reserver;
00124
00125 void RegisterEvents( OpIterator op, const int latency );
00126 void RegisterFinishEvent( OpIterator op, const int latency );
00127 void RegisterRescheduleEvent( OpIterator op, const int latency, IssueState* issueState );
00128 void RegisterDetectEvent( OpIterator op, const int latency );
00129
00130 std::vector<String> m_codeStr;
00131 std::vector<int> m_code;
00132 };
00133
00134 };
00135
00136 #endif // SIM_EXEC_UNIT_EXEC_UNIT_BASE_H
00137