base.hh (10693:c0979b2ebda5) base.hh (10815:169af9a2779f)
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 39 unchanged lines hidden (view full) ---

48
49#ifndef __BASE_TAGS_HH__
50#define __BASE_TAGS_HH__
51
52#include <string>
53
54#include "base/callback.hh"
55#include "base/statistics.hh"
1/*
2 * Copyright (c) 2012-2013 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 39 unchanged lines hidden (view full) ---

48
49#ifndef __BASE_TAGS_HH__
50#define __BASE_TAGS_HH__
51
52#include <string>
53
54#include "base/callback.hh"
55#include "base/statistics.hh"
56#include "mem/cache/blk.hh"
56#include "params/BaseTags.hh"
57#include "sim/clocked_object.hh"
58
59class BaseCache;
60
61/**
62 * A common base class of Cache tagstore objects.
63 */

--- 110 unchanged lines hidden (view full) ---

174 *Needed to clear all lock tracking at once
175 */
176 virtual void clearLocks() {}
177
178 /**
179 * Print all tags used
180 */
181 virtual std::string print() const = 0;
57#include "params/BaseTags.hh"
58#include "sim/clocked_object.hh"
59
60class BaseCache;
61
62/**
63 * A common base class of Cache tagstore objects.
64 */

--- 110 unchanged lines hidden (view full) ---

175 *Needed to clear all lock tracking at once
176 */
177 virtual void clearLocks() {}
178
179 /**
180 * Print all tags used
181 */
182 virtual std::string print() const = 0;
183
184 /**
185 * Find a block using the memory address
186 */
187 virtual CacheBlk * findBlock(Addr addr, bool is_secure) const = 0;
188
189 /**
190 * Calculate the block offset of an address.
191 * @param addr the address to get the offset of.
192 * @return the block offset.
193 */
194 int extractBlkOffset(Addr addr) const
195 {
196 return (addr & (Addr)(blkSize-1));
197 }
198
199 virtual void invalidate(CacheBlk *blk) = 0;
200
201 virtual CacheBlk* accessBlock(Addr addr, bool is_secure, Cycles &lat,
202 int context_src) = 0;
203
204 virtual Addr extractTag(Addr addr) const = 0;
205
206 virtual void insertBlock(PacketPtr pkt, CacheBlk *blk) = 0;
207
208 virtual Addr regenerateBlkAddr(Addr tag, unsigned set) const = 0;
209
210 virtual CacheBlk* findVictim(Addr addr) = 0;
211
212 virtual int extractSet(Addr addr) const = 0;
213
214 virtual void forEachBlk(CacheBlkVisitor &visitor) = 0;
182};
183
184class BaseTagsCallback : public Callback
185{
186 BaseTags *tags;
187 public:
188 BaseTagsCallback(BaseTags *t) : tags(t) {}
189 virtual void process() { tags->cleanupRefs(); };
190};
191
192class BaseTagsDumpCallback : public Callback
193{
194 BaseTags *tags;
195 public:
196 BaseTagsDumpCallback(BaseTags *t) : tags(t) {}
197 virtual void process() { tags->computeStats(); };
198};
199
200#endif //__BASE_TAGS_HH__
215};
216
217class BaseTagsCallback : public Callback
218{
219 BaseTags *tags;
220 public:
221 BaseTagsCallback(BaseTags *t) : tags(t) {}
222 virtual void process() { tags->cleanupRefs(); };
223};
224
225class BaseTagsDumpCallback : public Callback
226{
227 BaseTags *tags;
228 public:
229 BaseTagsDumpCallback(BaseTags *t) : tags(t) {}
230 virtual void process() { tags->computeStats(); };
231};
232
233#endif //__BASE_TAGS_HH__