src/Sim/Pipeline/PipelineLatch.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_PIPELINE_PIPELINE_LATCH_H
00033 #define SIM_PIPELINE_PIPELINE_LATCH_H
00034 
00035 #include "Utility/RuntimeError.h"
00036 #include "Sim/Foundation/TimeWheel/ClockedResourceBase.h"
00037 #include "Sim/Op/OpArray/OpArray.h"
00038 
00039 namespace Onikiri 
00040 {
00041 
00042     class PipelineLatch : public ClockedResourceBase
00043     {
00044     public:
00045         // Pipeline latch
00046         // PipelineNodeBase can belong to multiple cores (ex. Cache), 
00047         // thus OpList cannot be used. One OpList cannot be used by multiple cores.
00048         //typedef pool_list<OpIterator> List;
00049         enum MaxLatchSize { MAX_LATCH_SIZE = 256 };
00050         typedef fixed_sized_buffer< OpIterator, MAX_LATCH_SIZE, MaxLatchSize > List;
00051         typedef List::iterator iterator;
00052 
00053         iterator begin()    {   return m_latchOut.begin();      }
00054         iterator end()      {   return m_latchOut.end();        }
00055         iterator erase( iterator i )
00056                             {   return m_latchOut.erase( i );   }
00057         void pop_front()    {   m_latchOut.pop_front();         }
00058         size_t   size()     {   return m_latchOut.size();       }
00059 
00060     protected:
00061         typedef ClockedResourceBase BaseType;
00062 
00063         List m_latchIn;
00064         List m_latchOut;
00065         bool m_enableDumpStall;
00066         bool m_latchOutIsStalled;
00067 
00068         bool FindAndEraseFromLatch( List* latch, OpIterator op );
00069         void DumpStallBegin();
00070         void DumpStallEnd();
00071 
00072         // Update a latch
00073         void UpdateLatch();
00074 
00075     public:
00076 
00077         PipelineLatch( const char* name = "" );
00078         virtual void Receive( OpIterator op );
00079         void EnableDumpStall( bool enable );
00080 
00081         // A cycle end handler
00082         // Update the pipeline latch.
00083         virtual void End();
00084 
00085         // A cycle transition handler
00086         virtual void Transition();
00087 
00088         // Stall handlers, which are called in stall begin/end
00089         virtual void BeginStall();
00090         virtual void EndStall();
00091         virtual void Delete( OpIterator op );
00092     };
00093 
00094 }; // namespace Onikiri
00095 
00096 #endif // SIM_PIPELINE_PIPELINE_LATCH_H

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