src/Sim/Predictor/BPred/BTB.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 __BTB_H__
00033 #define __BTB_H__
00034 
00035 #include "Lib/shttl/setassoc_table.h"
00036 #include "Interface/Addr.h"
00037 
00038 #include "Sim/Op/OpArray/OpArray.h"
00039 #include "Sim/Foundation/Resource/ResourceNode.h"
00040 #include "Env/Param/ParamExchange.h"
00041 #include "Sim/ISAInfo.h"
00042 
00043 #include "Sim/Predictor/BPred/BranchType.h"
00044 
00045 namespace Onikiri 
00046 {
00047     // Prediction result of BTB
00048     struct BTBPredict
00049     {
00050         PC            predIndexPC;
00051         PC            target;
00052         BranchType    type;
00053         bool          hit;
00054         bool          dirPredict;
00055     };
00056 
00057     class BTB : public PhysicalResourceNode
00058     {
00059     private:
00060         static const int WORD_BITS = SimISAInfo::INSTRUCTION_WORD_BYTE_SHIFT;
00061         typedef shttl::static_off_hasher<u64, WORD_BITS> HasherType;
00062         typedef shttl::setassoc_table< std::pair<u64, BTBPredict>, HasherType> SetAssocTableType;
00063         SetAssocTableType* m_table;
00064 
00065         int m_numEntryBits;
00066         int m_numWays;
00067 
00068         // statistical information
00069         s64     m_numPred;          // fetch\
00070         s64     m_numTableHit;      // e[uqbg
00071         s64     m_numTableMiss;     // e[u~X
00072         s64     m_numHit;           // ^[Qbgqbg
00073         s64     m_numMiss;          // ^[Qbg~X
00074         s64     m_numUpdate;        // Update
00075         int     m_numEntries;       // Gg
00076 
00077     public:
00078         BEGIN_PARAM_MAP("")
00079             BEGIN_PARAM_PATH( GetParamPath() )
00080                 PARAM_ENTRY("@EntryBits",   m_numEntryBits)
00081                 PARAM_ENTRY("@Ways",        m_numWays)
00082             END_PARAM_PATH()
00083             BEGIN_PARAM_PATH( GetResultPath() )
00084                 PARAM_ENTRY( "@NumPred",          m_numPred)
00085                 PARAM_ENTRY( "@NumUpdate",    m_numUpdate)
00086                 PARAM_ENTRY( "@NumTableHit",      m_numTableHit)
00087                 PARAM_ENTRY( "@NumTableMiss",  m_numTableMiss)
00088                 PARAM_ENTRY( "@NumHit",        m_numHit)
00089                 PARAM_ENTRY( "@NumMiss",       m_numMiss)
00090                 PARAM_ENTRY( "@NumEntries",   m_numEntries)
00091                 RESULT_RATE_SUM_ENTRY( "@TableHitRate", m_numTableHit, m_numTableHit, m_numTableMiss )
00092                 RESULT_RATE_SUM_ENTRY( "@HitRate", m_numHit, m_numHit, m_numMiss )
00093             END_PARAM_PATH()
00094         END_PARAM_MAP()
00095         
00096         BEGIN_RESOURCE_MAP()
00097         END_RESOURCE_MAP()
00098 
00099         using PhysicalResourceNode::LoadParam;
00100         using PhysicalResourceNode::ReleaseParam;
00101 
00102         BTB();
00103         virtual ~BTB();
00104 
00105         void Initialize(InitPhase phase);
00106 
00107         // PCPC\
00108         BTBPredict Predict(const PC& pc);
00109 
00110         // BTBupdate
00111         void Update(const OpIterator& op, const BTBPredict& predict);
00112     };
00113 
00114 }; // namespace Onikiri
00115 
00116 #endif // __BTB_H__
00117 
00118 

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