src/Sim/Predictor/LatPred/LatPredResult.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_PREDICTOR_LAT_PRED_LAT_PRED_RESULT_H
00033 #define SIM_PREDICTOR_LAT_PRED_LAT_PRED_RESULT_H
00034 
00035 #include "Sim/Op/OpArray/OpArray.h"
00036 
00037 namespace Onikiri 
00038 {
00039     class HitMissPredIF;
00040 
00041     // Result of latency prediction
00042     class LatPredResult
00043     {
00044     public:
00045         
00046         static const int MAX_COUNT = 6;
00047 
00048         // A result of latency prediction is returned as a list of 'Scheduling' objects.
00049         // The following examples are the case of a 3-level memory hierarchy,
00050         // L1(3cycles) / L2(5cycles) / Mem(8cycles).
00051         //
00052         // ( [latency, wakeup] )
00053         // L1 hit/L2 hit, predicted as
00054         //   0: [3,    true ]
00055         //   1: [3+5,  true ]
00056         //   2: [3+5+8,true ]
00057         //
00058         // L1 miss/L2 hit, predicted as
00059         //   0: [3,    false]
00060         //   1: [3+5,  true ]
00061         //   2: [3+5+8,true ]
00062         //
00063         // L1 miss/L2 miss, predicted as
00064         //   0: [3,    false]
00065         //   1: [3+5,  false]
00066         //   2: [3+5+8,false]
00067 
00068         struct Scheduling
00069         {
00070             int  latency;   // A total latency of this level.
00071             bool wakeup;    // Consumers are woke up or not at this latency
00072             
00073             Scheduling( int l = -1, bool w = false ) :
00074                 latency( l ),
00075                 wakeup ( w )
00076             {
00077             }
00078         };
00079 
00080         LatPredResult() : 
00081             m_scheduling(),
00082             m_schedulingCount(-1)
00083         {
00084         }
00085 
00086         const Scheduling& Get( int index = 0 ) const
00087         {
00088             ASSERT( index < m_schedulingCount );
00089             return m_scheduling[ index ];
00090         }
00091 
00092         void Set( int index, const Scheduling& scheduling )
00093         {
00094             ASSERT( index < MAX_COUNT );
00095             m_scheduling[ index ] = scheduling;
00096         }
00097 
00098         void Set( int index, int latency, bool wakeup )
00099         {
00100             Set( index, Scheduling( latency, wakeup ) );
00101         }
00102 
00103         void SetCount( int count )
00104         {
00105             ASSERT( count < MAX_COUNT );
00106             m_schedulingCount = count;
00107         }
00108 
00109         int GetCount() const
00110         {
00111             return m_schedulingCount;
00112         }
00113 
00114     protected:
00115         boost::array< Scheduling, MAX_COUNT > m_scheduling;
00116         int m_schedulingCount;
00117     };
00118 
00119 
00120 }; // namespace Onikiri
00121 
00122 #endif // SIM_PREDICTOR_LAT_PRED_LAT_PRED_RESULT_H
00123 

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