From 86d6b788f6d7b523c750ffb64d6d8920ec741c49 Mon Sep 17 00:00:00 2001 From: Brad Beckmann Date: Tue, 10 Jul 2012 22:51:54 -0700 Subject: ruby: banked cache array resource model This patch models a cache as separate tag and data arrays. The patch exposes the banked array as another resource that is checked by SLICC before a transition is allowed to execute. This is similar to how TBE entries and slots in output ports are modeled. --- src/mem/ruby/system/BankedArray.hh | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/mem/ruby/system/BankedArray.hh (limited to 'src/mem/ruby/system/BankedArray.hh') diff --git a/src/mem/ruby/system/BankedArray.hh b/src/mem/ruby/system/BankedArray.hh new file mode 100644 index 000000000..2db4d3d95 --- /dev/null +++ b/src/mem/ruby/system/BankedArray.hh @@ -0,0 +1,47 @@ + +#ifndef __MEM_RUBY_SYSTEM_BANKEDARRAY_HH__ +#define __MEM_RUBY_SYSTEM_BANKEDARRAY_HH__ + +#include + +#include "mem/ruby/common/TypeDefines.hh" +#include "sim/eventq.hh" + + + +class BankedArray : public EventManager +{ +private: + unsigned int banks; + unsigned int accessLatency; + unsigned int bankBits; + unsigned int startIndexBit; + + //std::vector busyBanks; + + class TickEvent : public Event + { + public: + TickEvent() : Event() {} + void process() {} + Index idx; + Tick startAccess; + }; + friend class TickEvent; + + // If the tick event is scheduled then the bank is busy + // otherwise, schedule the event and wait for it to complete + std::vector busyBanks; + + unsigned int mapIndexToBank(Index idx); + +public: + BankedArray(unsigned int banks, unsigned int accessLatency, unsigned int startIndexBit); + + // Note: We try the access based on the cache index, not the address + // This is so we don't get aliasing on blocks being replaced + bool tryAccess(Index idx); + +}; + +#endif -- cgit v1.2.3