src/Sim/InorderList/InorderList.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_INORDER_LIST_INORDER_LIST_H
00033 #define SIM_INORDER_LIST_INORDER_LIST_H
00034 
00035 #include "Sim/Op/OpArray/OpArray.h"
00036 #include "Sim/Op/OpInitArgs.h"
00037 #include "Sim/Foundation/Resource/ResourceNode.h"
00038 #include "Sim/ExecUnit/ExecUnitIF.h"
00039 #include "Sim/Foundation/Hook/HookDecl.h"
00040 #include "Sim/Core/DataPredTypes.h"
00041 #include "Sim/Op/OpContainer/OpList.h"
00042 
00043 namespace Onikiri 
00044 {
00045     class Core;
00046     class Thread;
00047     class CheckpointMaster;
00048     class Checkpoint;
00049     class MemOrderManager;
00050     class OpNotifier;
00051     class MemOrderManager;
00052     class RegDepPredIF;
00053     class MemDepPredIF;
00054     class Fetcher;
00055     class Dispatcher;
00056     class Renamer;
00057     class CacheSystem;
00058     class Retirer;
00059 
00060     class InorderList :
00061         public PhysicalResourceNode
00062     {
00063 
00064     public:
00065 
00066         // parameter mapping
00067         BEGIN_PARAM_MAP("")
00068             
00069             BEGIN_PARAM_PATH( GetParamPath() )
00070                 PARAM_ENTRY( "@Capacity", m_capacity );
00071                 PARAM_ENTRY( "@RemoveOpsOnCommit", m_removeOpsOnCommit );
00072             END_PARAM_PATH()
00073 
00074             BEGIN_PARAM_PATH( GetResultPath() )
00075                 PARAM_ENTRY( "@NumRetiredOps",   m_retiredOps )
00076                 PARAM_ENTRY( "@NumRetiredInsns", m_retiredInsns )
00077             END_PARAM_PATH()
00078 
00079         END_PARAM_MAP()
00080 
00081         BEGIN_RESOURCE_MAP()
00082             RESOURCE_ENTRY( CheckpointMaster, "checkpointMaster", m_checkpointMaster )
00083             RESOURCE_ENTRY( Core,     "core",       m_core )
00084             RESOURCE_ENTRY( Thread,   "thread",     m_thread )
00085         END_RESOURCE_MAP()
00086 
00087         InorderList();
00088         virtual ~InorderList();
00089 
00090         // p\bh
00091         void Initialize(InitPhase phase);
00092 
00093         // --- Op Ao
00094         OpIterator ConstructOp(const OpInitArgs& args);
00095         void DestroyOp(OpIterator op);
00096 
00097         // --- tFb`
00098         // Fetcher tFb`
00099         void PushBack(OpIterator op);
00100 
00101         // --- Remove a back op from a list.
00102         void PopBack();
00103 
00104         // --- /O/
00105         // vOEI[_
00106         OpIterator GetCommittedFrontOp();           // R~bgS
00107         OpIterator GetFrontOp();    // R~bg
00108         // tFb`
00109         OpIterator GetBackOp();  
00110 
00111         // opO/IndexOp
00112         // PCOpWO/
00113         OpIterator GetPrevIndexOp(OpIterator op);
00114         OpIterator GetNextIndexOp(OpIterator op);
00115         
00116         // opO/PCOp
00117         // PCOpO/
00118         OpIterator GetPrevPCOp(OpIterator op);
00119         OpIterator GetNextPCOp(OpIterator op);
00120         // opPCOp(MicroOp)
00121         OpIterator GetFrontOpOfSamePC(OpIterator op);
00122 
00123         // 
00124         bool IsEmpty();
00125 
00126         // Return whether an in-order list can reserve entries or not.
00127         bool CanAllocate( int ops );
00128 
00129         // Returns its capacity.
00130         int GetCapacity() const { return m_capacity; }
00131 
00132         // Returns the number of retired instructions.
00133         s64 GetRetiredInstructionCount() const { return m_retiredOps; }
00134 
00135 
00136         // 
00137         // --- 
00138         //
00139 
00140         // nR~bgC^CA
00141         void Commit( OpIterator op );
00142         void Retire( OpIterator op );
00143 
00144         // accessors
00145         OpNotifier* GetNotifier() const { return m_notifier; }
00146         s64 GetRetiredOps()     const { return m_retiredOps;    }
00147         s64 GetRetiredInsns()   const { return m_retiredInsns;  }
00148 
00149         // This method is called when a simulation mode is changed.
00150         virtual void ChangeSimulationMode( PhysicalResourceNode::SimulationMode mode )
00151         {
00152             m_mode = mode;
00153         }
00154 
00155         // \~Xop tbVtbN
00156         static HookPoint<InorderList> s_opFlushHook;
00157 
00158         // Flush all backward ops from 'startOp'.
00159         // This method flushes ops including 'startOp' itself.
00160         // This method must be called from 'Recoverer' because this method does not 
00161         // recover processor states from check-pointed data.
00162         int FlushBackward( OpIterator startOp );
00163 
00164 
00165     protected:
00166         // member variables
00167         Core*               m_core;
00168         CheckpointMaster*   m_checkpointMaster;
00169         Thread*             m_thread;
00170         OpNotifier*         m_notifier;
00171         MemOrderManager*    m_memOrderManager;
00172         RegDepPredIF*       m_regDepPred;
00173         MemDepPredIF*       m_memDepPred;
00174         Fetcher*            m_fetcher;
00175         Renamer*            m_renamer;
00176         Dispatcher*         m_dispatcher;
00177         Retirer*            m_retirer;
00178         CacheSystem*        m_cacheSystem;
00179 
00180         // Ops are pushed into these list in program-order.
00181         OpList  m_inorderList;      // A list of ops that are not committed yet. This list corresponds to a ROB.
00182         OpList  m_committedList;    // A list of ops that are committed and are not retired yet.
00183 
00184         OpArray* m_opArray;
00185 
00186         PhysicalResourceNode::SimulationMode m_mode;
00187 
00188         int m_capacity;             // The capacity of an in-order list(ROB).
00189         bool m_removeOpsOnCommit;   // If this parameter is true, ops are removed on commitment,
00190                                     // otherwise ops are removed on retirement.
00191 
00192         s64 m_retiredOps;
00193         s64 m_retiredInsns;
00194 
00195         // Notify that 'op' is committed/retired/flushed to modules. 
00196         void NotifyCommit( OpIterator op );
00197         void NotifyRetire( OpIterator op );
00198         void NotifyFlush( OpIterator op );
00199 
00200         // ntbV
00201         // tbV\~X
00202         // pCvC
00203         void Flush( OpIterator op );        // tbN
00204 
00205     };  // class InorderList
00206 
00207 }   // namespace Onikiri 
00208 
00209 #endif  // #ifndef SIM_INORDER_LIST_INORDER_LIST_H
00210 
00211 

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