src/Sim/Recoverer/Recoverer.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_RECOVERER_RECOVERER_H
00033 #define SIM_RECOVERER_RECOVERER_H
00034 
00035 #include "Sim/Foundation/Hook/HookDecl.h"
00036 #include "Sim/Foundation/Resource/ResourceNode.h"
00037 #include "Sim/Op/OpArray/OpArray.h"
00038 #include "Sim/Op/OpContainer/OpList.h"
00039 #include "Sim/ExecUnit/ExecUnitIF.h"
00040 #include "Sim/Core/DataPredTypes.h"
00041 
00042 namespace Onikiri
00043 {
00044     class InorderList;
00045     class Core;
00046     class Thread;
00047     class Checkpoint;
00048     class CheckpointMaster;
00049 
00050     class Recoverer : public PhysicalResourceNode
00051     {
00052     public:
00053         typedef DataPredMissRecovery Recovery;
00054 
00055         // parameter mapping
00056         BEGIN_PARAM_MAP("")
00057             
00058             BEGIN_PARAM_PATH( GetParamPath() )
00059                 PARAM_ENTRY( "@BranchPredRecoveryLatency",  m_brPredRecoveryLatency )
00060                 PARAM_ENTRY( "@ExceptionRecoverylatency",   m_exceptionRecoveryLatency )
00061             END_PARAM_PATH()
00062             BEGIN_PARAM_PATH( GetResultPath() )
00063                 BEGIN_PARAM_PATH( "LatPredRecovery/" )
00064                     PARAM_ENTRY( "@NumRecovery",    m_latPredRecoveryCount )
00065                     PARAM_ENTRY( "@NumOps",         m_latPredRecoveryOps )
00066                 END_PARAM_PATH()
00067                 BEGIN_PARAM_PATH( "AddrPredRecovery/" )
00068                     PARAM_ENTRY( "@NumRecovery",    m_addrPredRecoveryCount )
00069                     PARAM_ENTRY( "@NumOps",         m_addrPredRecoveryOps )
00070                 END_PARAM_PATH()
00071                 BEGIN_PARAM_PATH( "ValuePredRecovery/" )
00072                     PARAM_ENTRY( "@NumRecovery",    m_valuePredRecoveryCount )
00073                     PARAM_ENTRY( "@NumOps",         m_valuePredRecoveryOps )
00074                 END_PARAM_PATH()
00075                 BEGIN_PARAM_PATH( "PartialLoadRecovery/" )
00076                     PARAM_ENTRY( "@NumRecovery",    m_partialReadRecoveryCount )
00077                     PARAM_ENTRY( "@NumOps",         m_partialReadRecoveryOps )
00078                 END_PARAM_PATH()
00079                 BEGIN_PARAM_PATH( "BracnchPredRecovery/" )
00080                     PARAM_ENTRY( "@NumRecovery",    m_brPredRecoveryCount )
00081                     PARAM_ENTRY( "@NumOps",         m_brPredRecoveryOps )
00082                 END_PARAM_PATH()
00083                 BEGIN_PARAM_PATH( "ExceptionRecovery/" )
00084                     PARAM_ENTRY( "@NumRecovery",    m_exceptionRecoveryCount )
00085                     PARAM_ENTRY( "@NumOps",         m_exceptionRecoveryOps )
00086                 END_PARAM_PATH()
00087             END_PARAM_PATH()
00088 
00089         END_PARAM_MAP()
00090 
00091         BEGIN_RESOURCE_MAP()
00092             RESOURCE_ENTRY( Core,               "core",             m_core )
00093             RESOURCE_ENTRY( Thread,             "thread",           m_thread )
00094             RESOURCE_ENTRY( InorderList,        "inorderList",      m_inorderList )
00095             RESOURCE_ENTRY( CheckpointMaster,   "checkpointMaster", m_checkpointMaster )
00096         END_RESOURCE_MAP()
00097 
00098         Recoverer();
00099         virtual ~Recoverer();
00100 
00101         virtual void Initialize( InitPhase phase );
00102         virtual void Finalize();
00103 
00104         
00105         // Recover a processor from branch miss prediction.
00106         // Ops after 'branch' are flushed and re-fetched.
00107         void RecoverBPredMiss( OpIterator branch );
00108 
00109         // Recover a processor from exception.
00110         void RecoverException( OpIterator causer );
00111 
00112         // Recover a processor from data miss prediction.
00113         // These methods return the number of squashed/canceled instructions.
00114         int RecoverDataPredMiss( 
00115             OpIterator producer,
00116             OpIterator consumer, 
00117             DataPredMissRecovery::Type dataPredType 
00118         );
00119 
00120 
00121         // Recover a processor from general miss prediction.
00122         int RecoverDataPredMiss( 
00123             OpIterator producer,
00124             OpIterator consumer, 
00125             const DataPredMissRecovery& recovery
00126         );
00127                 
00128         // Re-fetch all ops.
00129         int RecoverByRefetch( OpIterator missedOp, OpIterator startOp );
00130 
00131         // Re-issue all ops.
00132         int RecoverByRescheduleAll( OpIterator missedOp, OpIterator startOp );
00133 
00134         // Re-issue not finished ops.
00135         int RecoverByRescheduleNotFinished(OpIterator missedOp, OpIterator startOp);
00136 
00137         // Re-issue consumer ops selectively.
00138         int RecoverByRescheduleSelective( OpIterator producerOp, Recovery::From from );
00139 
00140 
00141     protected:
00142 
00143         Core*               m_core;
00144         Thread*             m_thread;
00145         InorderList*        m_inorderList;
00146         CheckpointMaster*   m_checkpointMaster;
00147 
00148         s64 m_latPredRecoveryCount;
00149         s64 m_addrPredRecoveryCount;
00150         s64 m_valuePredRecoveryCount;
00151         s64 m_partialReadRecoveryCount;
00152 
00153         s64 m_latPredRecoveryOps;
00154         s64 m_addrPredRecoveryOps;
00155         s64 m_valuePredRecoveryOps;
00156         s64 m_partialReadRecoveryOps;
00157 
00158         s64 m_brPredRecoveryCount;
00159         s64 m_brPredRecoveryOps;
00160 
00161         s64 m_exceptionRecoveryCount;
00162         s64 m_exceptionRecoveryOps;
00163 
00164         int m_brPredRecoveryLatency;
00165         int m_exceptionRecoveryLatency;
00166 
00167         // Recover the state of the processor to 'checkpoint'.
00168         void RecoverCheckpoint( Checkpoint* checkpoint );
00169 
00170         // Update recovery statistics
00171         void UpdateRecoveryStatistics(
00172             int recoveredInsns, 
00173             Recovery::Type dataPredType 
00174         );
00175 
00176         // Re-schedule the consumers of a producer.
00177         // This is for RecoverByRescheduleSelective().
00178         int RescheduleConsumers( OpIterator producer );
00179 
00180         // Get an op that starts recovery.
00181         OpIterator GetRecoveryStartOp( OpIterator producer, OpIterator consumer, Recovery::From from );
00182     };
00183 }
00184 
00185 #endif
00186 

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