src/Sim/Core/Core.h

説明を見る。
00001 // 
00002 // Copyright (c) 2005-2008 Kenichi Watanabe.
00003 // Copyright (c) 2005-2008 Yasuhiro Watari.
00004 // Copyright (c) 2005-2008 Hironori Ichibayashi.
00005 // Copyright (c) 2008-2009 Kazuo Horio.
00006 // Copyright (c) 2009-2013 Naruki Kurata.
00007 // Copyright (c) 2005-2013 Ryota Shioya.
00008 // Copyright (c) 2005-2013 Masahiro Goshima.
00009 // 
00010 // This software is provided 'as-is', without any express or implied
00011 // warranty. In no event will the authors be held liable for any damages
00012 // arising from the use of this software.
00013 // 
00014 // Permission is granted to anyone to use this software for any purpose,
00015 // including commercial applications, and to alter it and redistribute it
00016 // freely, subject to the following restrictions:
00017 // 
00018 // 1. The origin of this software must not be misrepresented; you must not
00019 // claim that you wrote the original software. If you use this software
00020 // in a product, an acknowledgment in the product documentation would be
00021 // appreciated but is not required.
00022 // 
00023 // 2. Altered source versions must be plainly marked as such, and must not be
00024 // misrepresented as being the original software.
00025 // 
00026 // 3. This notice may not be removed or altered from any source
00027 // distribution.
00028 // 
00029 // 
00030 
00031 
00032 #ifndef SIM_CORE_CORE_H
00033 #define SIM_CORE_CORE_H
00034 
00035 #include "Utility/RuntimeError.h"
00036 #include "Env/Param/ParamExchange.h"
00037 
00038 #include "Sim/Foundation/Resource/ResourceNode.h"
00039 #include "Sim/Foundation/Hook/HookDecl.h"
00040 #include "Sim/Foundation/TimeWheel/ClockedResourceBase.h"
00041 
00042 #include "Sim/Op/OpContainer/OpList.h"
00043 #include "Sim/Op/OpArray/OpArray.h"
00044 #include "Sim/Core/DataPredTypes.h"
00045 
00046 namespace Onikiri 
00047 {
00048     class EmulatorIF;
00049     class GlobalClock;
00050     class RegisterFile;
00051     class Fetcher;
00052     class Renamer;
00053     class Dispatcher;
00054     class Scheduler;
00055     class Retirer;
00056     class CheckpointMaster;
00057     class MemOrderManager;
00058     class OpNotifier;
00059     class ExecLatencyInfo;
00060     class ExecUnitIF;
00061     class LatPred;
00062     class Cache;
00063     class RegDepPredIF;
00064     class MemDepPredIF;
00065     class Thread;
00066     class LatPred;
00067     class CacheSystem; 
00068     class BPred;
00069 
00070 
00071 
00072     // RA
00073     class Core : 
00074         public ClockedResourceBase,
00075         public PhysicalResourceNode
00076     {
00077     public:
00078 
00079         // parameter mapping
00080         BEGIN_PARAM_MAP("")
00081             BEGIN_PARAM_PATH( GetParamPath() )
00082                 PARAM_ENTRY( "@OpArrayCapacity",    m_opArrayCapacity )
00083                 
00084                 BEGIN_PARAM_BINDING(  "@SchedulerRemovePolicy", m_schedulerRemovePolicy, SchedulerRemovePolicy )
00085                     PARAM_BINDING_ENTRY( "Remove",  RP_REMOVE )
00086                     PARAM_BINDING_ENTRY( "Retain",  RP_RETAIN )
00087                     PARAM_BINDING_ENTRY( "RemoveAfterFinish",   RP_REMOVE_AFTER_FINISH )
00088                 END_PARAM_BINDING()
00089 
00090                 BEGIN_PARAM_BINDING(  "@LoadPipelineModel", m_loadPipeLineModel, LoadPipelineModel )
00091                     PARAM_BINDING_ENTRY( "SingleIssue", LPM_SINGLE_ISSUE )
00092                     PARAM_BINDING_ENTRY( "MultiIssue",  LPM_MULTI_ISSUE )
00093                 END_PARAM_BINDING()
00094 
00095                 BEGIN_PARAM_BINDING(  "@CheckpointingPolicy", m_checkpointingPolicy, CheckpointingPolicy )
00096                     PARAM_BINDING_ENTRY( "All",     CP_ALL )
00097                     PARAM_BINDING_ENTRY( "Auto",    CP_AUTO )
00098                 END_PARAM_BINDING()
00099 
00100                 CHAIN_PARAM_MAP( "LatPredRecovery",       m_latencyPredRecv );
00101                 CHAIN_PARAM_MAP( "AddrMatchPredRecovery", m_addrMatchPredRecv );
00102                 CHAIN_PARAM_MAP( "ValuePredRecovery",     m_valuePredRecv );
00103                 CHAIN_PARAM_MAP( "PartialLoadRecovery",   m_partialLoadRecovery );
00104 
00105             END_PARAM_PATH()
00106             BEGIN_PARAM_PATH( "/Session/Simulator/TimeWheelBase/" )
00107                 PARAM_ENTRY("@Size", m_timeWheelSize);
00108             END_PARAM_PATH()
00109         END_PARAM_MAP()
00110 
00111         BEGIN_RESOURCE_MAP()
00112             RESOURCE_ENTRY( Thread,         "thread",       m_thread )
00113             RESOURCE_ENTRY( Fetcher,        "fetcher",      m_fetcher )
00114             RESOURCE_ENTRY( Renamer,        "renamer",      m_renamer )
00115             RESOURCE_ENTRY( Dispatcher,     "dispatcher",   m_dispatcher )
00116             RESOURCE_SETTER_ENTRY(
00117                             Scheduler,      "scheduler",    AddScheduler 
00118             )
00119             RESOURCE_ENTRY( Retirer,        "retirer",      m_retirer )
00120             RESOURCE_ENTRY( RegisterFile,   "registerFile", m_registerFile )
00121             RESOURCE_ENTRY( LatPred,        "latPred",      m_latPred )
00122             RESOURCE_ENTRY( ExecLatencyInfo,"execLatencyInfo", m_execLatencyInfo )
00123             RESOURCE_ENTRY( GlobalClock,    "globalClock",  m_globalClock )
00124             RESOURCE_ENTRY( CacheSystem,    "cacheSystem",  m_cacheSystem )
00125             RESOURCE_ENTRY( EmulatorIF,     "emulator",     m_emulator )
00126             RESOURCE_ENTRY( BPred,          "bPred",        m_bPred )
00127         END_RESOURCE_MAP()
00128 
00129         Core();
00130         virtual ~Core();
00131 
00132         // p\bh
00133         void Initialize(InitPhase phase);
00134 
00135         // accessors
00136         void AddScheduler( Scheduler* scheduler );
00137         Scheduler* GetScheduler(int index);
00138         int GetNumScheduler() const;
00139 
00140         Thread* GetThread(int tid);
00141         int GetThreadCount();
00142 
00143         int GetCID(); 
00144         int GetTID(const int index);
00145 
00146         Fetcher*            GetFetcher()        const   { return m_fetcher;         }
00147         Renamer*            GetRenamer()        const   { return m_renamer;         }
00148         Dispatcher*         GetDispatcher()     const   { return m_dispatcher;      }
00149         Retirer*            GetRetirer()        const   { return m_retirer;         }
00150         RegisterFile*       GetRegisterFile()   const   { return m_registerFile;    }
00151         LatPred*            GetLatPred()         const  { return m_latPred;         }
00152         ExecLatencyInfo*    GetExecLatencyInfo() const  { return m_execLatencyInfo; }
00153         CacheSystem*        GetCacheSystem()    const   { return m_cacheSystem;     }
00154         BPred*              GetBPred()          const   { return m_bPred;           }
00155 
00156         GlobalClock* GetGlobalClock()   const { return m_globalClock;   }
00157         EmulatorIF*  GetEmulator()      const { return m_emulator;      }
00158 
00159         OpArray* GetOpArray() const     { return m_opArray; };
00160 
00161         const DataPredMissRecovery& GetLatPredMissRecovery()   const { return m_latencyPredRecv;   }
00162         const DataPredMissRecovery& GetAddrPredMissRecovery()  const { return m_addrMatchPredRecv;  }
00163         const DataPredMissRecovery& GetValuePredMissRecovery() const { return m_valuePredRecv; }
00164         const DataPredMissRecovery& GetPartialLoadRecovery()  const { return m_partialLoadRecovery;  }
00165 
00166         LoadPipelineModel       GetLoadPipelineModel()      const   {   return m_loadPipeLineModel; }
00167         SchedulerRemovePolicy   GetSchedulerRemovePolicy()  const   {   return m_schedulerRemovePolicy; }
00168         CheckpointingPolicy     GetCheckpointingPolicy()    const   {   return m_checkpointingPolicy; }
00169 
00170         int GetTimeWheelSize() const { return m_timeWheelSize; };
00171 
00172         // Jo@
00173         // tFb`OCI[_[Xe[g`FbN|CeBOKv
00174         // ANZXI[_[oCI[VtFb`JoKv
00175         bool IsRequiredCheckpointBefore( const PC& pc, const OpInfo* const info );
00176 
00177             // tFb`CI[_[Xe[g`FbN|CeBOKv
00178         // \~XJoKv
00179         bool IsRequiredCheckpointAfter( const PC& pc, const OpInfo* const info );
00180 
00181         // Cycle handler
00182         virtual void Evaluate();
00183         const char* Who() const 
00184         {
00185             return PhysicalResourceNode::Who(); 
00186         };
00187 
00188         //
00189         // --- Hook
00190         //
00191         struct CheckpointDecisionHookParam
00192         {   
00193             const PC* pc;
00194             const OpInfo* info;
00195             bool  before;
00196             bool  requried;
00197         };
00198 
00199         // The hook point of 'IsRequiredCheckpointBefore()' and 'IsRequiredCheckpointAfter()'
00200         // Prototype : void Method( HookParameter<Core, CheckpointDecisionHookParam>* param )
00201         static HookPoint<Core, CheckpointDecisionHookParam> s_checkpointDecisionHook;
00202 
00203     protected:
00204 
00205         // member variables
00206         int m_opArrayCapacity;      // OpArray  TCY
00207         int m_timeWheelSize;        // The size of a time wheel.
00208 
00209         GlobalClock* m_globalClock;
00210         OpArray*     m_opArray;
00211 
00212         typedef
00213             std::vector< Scheduler* >
00214             SchedulerArray;
00215 
00216         PhysicalResourceArray<Thread>    m_thread;
00217         RegisterFile*   m_registerFile;
00218         Fetcher*        m_fetcher;
00219         Renamer*        m_renamer;
00220         Dispatcher*     m_dispatcher;
00221         SchedulerArray  m_scheduler;
00222         Retirer*        m_retirer;
00223         LatPred*        m_latPred;
00224         CacheSystem*    m_cacheSystem;
00225         EmulatorIF*     m_emulator;
00226         BPred*          m_bPred;
00227 
00228         ExecLatencyInfo* m_execLatencyInfo; // タsCeV
00229 
00230         DataPredMissRecovery m_latencyPredRecv;
00231         DataPredMissRecovery m_addrMatchPredRecv;
00232         DataPredMissRecovery m_valuePredRecv;
00233         DataPredMissRecovery m_partialLoadRecovery;
00234 
00235         LoadPipelineModel       m_loadPipeLineModel;
00236         SchedulerRemovePolicy   m_schedulerRemovePolicy;
00237         CheckpointingPolicy     m_checkpointingPolicy;
00238 };
00239 
00240 }; // namespace Onikiri
00241 
00242 #endif // SIM_CORE_CORE_H
00243 

Onikiri2に対してTue Jun 18 14:34:22 2013に生成されました。  doxygen 1.4.7