1/* 2 * Copyright (c) 2002-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 25 unchanged lines hidden (view full) --- 34/** 35 * @file 36 * Describes a cache based on template policies. 37 */ 38 39#ifndef __CACHE_HH__ 40#define __CACHE_HH__ 41 |
42#include "base/misc.hh" // fatal, panic, and warn |
43 44#include "mem/cache/base_cache.hh" 45#include "mem/cache/cache_blk.hh" 46#include "mem/cache/miss/mshr.hh" 47 48#include "sim/eventq.hh" 49 50//Forward decleration 51class BasePrefetcher; 52 53/** 54 * A template-policy based cache. The behavior of the cache can be altered by 55 * supplying different template policies. TagStore handles all tag and data |
56 * storage @sa TagStore. |
57 */ |
58template |
59class Cache : public BaseCache 60{ 61 public: 62 /** Define the type of cache block to use. */ 63 typedef typename TagStore::BlkType BlkType; 64 /** A typedef for a list of BlkType pointers. */ 65 typedef typename TagStore::BlkList BlkList; 66 67 bool prefetchAccess; 68 69 protected: 70 71 class CpuSidePort : public CachePort 72 { 73 public: 74 CpuSidePort(const std::string &_name, |
75 Cache |
76 77 // BaseCache::CachePort just has a BaseCache *; this function 78 // lets us get back the type info we lost when we stored the 79 // cache pointer there. |
80 Cache 81 return static_cast |
82 } 83 84 virtual void getDeviceAddressRanges(AddrRangeList &resp, 85 bool &snoop); 86 87 virtual bool recvTiming(PacketPtr pkt); 88 89 virtual Tick recvAtomic(PacketPtr pkt); 90 91 virtual void recvFunctional(PacketPtr pkt); 92 }; 93 94 class MemSidePort : public CachePort 95 { 96 public: 97 MemSidePort(const std::string &_name, |
98 Cache |
99 100 // BaseCache::CachePort just has a BaseCache *; this function 101 // lets us get back the type info we lost when we stored the 102 // cache pointer there. |
103 Cache 104 return static_cast |
105 } 106 107 void sendPacket(); 108 109 void processSendEvent(); 110 111 virtual void getDeviceAddressRanges(AddrRangeList &resp, 112 bool &snoop); --- 8 unchanged lines hidden (view full) --- 121 122 typedef EventWrapper<MemSidePort, &MemSidePort::processSendEvent> 123 SendEvent; 124 }; 125 126 /** Tag and data Storage */ 127 TagStore *tags; 128 |
129 /** Prefetcher */ 130 BasePrefetcher *prefetcher; 131 132 /** Temporary cache block for occasional transitory use */ 133 BlkType *tempBlock; 134 135 /** 136 * Can this cache should allocate a block on a line-sized write miss. --- 63 unchanged lines hidden (view full) --- 200 PacketPtr writebackBlk(BlkType *blk); 201 202 public: 203 204 class Params 205 { 206 public: 207 TagStore *tags; |
208 BaseCache::Params baseParams; 209 BasePrefetcher*prefetcher; 210 bool prefetchAccess; 211 const bool doFastWrites; 212 const bool prefetchMiss; 213 |
214 Params(TagStore *_tags, |
215 BaseCache::Params params, 216 BasePrefetcher *_prefetcher, 217 bool prefetch_access, int hit_latency, 218 bool do_fast_writes, 219 bool prefetch_miss) |
220 : tags(_tags), |
221 baseParams(params), 222 prefetcher(_prefetcher), prefetchAccess(prefetch_access), 223 doFastWrites(do_fast_writes), 224 prefetchMiss(prefetch_miss) 225 { 226 } 227 }; 228 --- 101 unchanged lines hidden --- |