Deleted Added
sdiff udiff text old ( 11331:cd5c48db28e6 ) new ( 11375:f98df9231cdd )
full compact
1/*
2 * Copyright (c) 2012-2013, 2015 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
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

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

57
58#include "base/misc.hh"
59#include "base/statistics.hh"
60#include "base/trace.hh"
61#include "base/types.hh"
62#include "debug/Cache.hh"
63#include "debug/CachePort.hh"
64#include "mem/cache/mshr_queue.hh"
65#include "mem/mem_object.hh"
66#include "mem/packet.hh"
67#include "mem/qport.hh"
68#include "mem/request.hh"
69#include "params/BaseCache.hh"
70#include "sim/eventq.hh"
71#include "sim/full_system.hh"
72#include "sim/sim_exit.hh"
73#include "sim/system.hh"
74
75class MSHR;
76/**
77 * A basic cache interface. Implements some common functions for speed.
78 */
79class BaseCache : public MemObject
80{
81 /**
82 * Indexes to enumerate the MSHR queues.
83 */
84 enum MSHRQueueIndex {
85 MSHRQueue_MSHRs,
86 MSHRQueue_WriteBuffer
87 };
88

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

185 CacheMasterPort *memSidePort;
186
187 protected:
188
189 /** Miss status registers */
190 MSHRQueue mshrQueue;
191
192 /** Write/writeback buffer */
193 MSHRQueue writeBuffer;
194
195 /**
196 * Allocate a buffer, passing the time indicating when schedule an
197 * event to the queued port to go and ask the MSHR and write queue
198 * if they have packets to send.
199 *
200 * allocateBufferInternal() function is called in:
201 * - MSHR allocateWriteBuffer (unchached write forwarded to WriteBuffer);
202 * - MSHR allocateMissBuffer (miss in MSHR queue);
203 */
204 MSHR *allocateBufferInternal(MSHRQueue *mq, Addr addr, int size,
205 PacketPtr pkt, Tick time,
206 bool sched_send)
207 {
208 // check that the address is block aligned since we rely on
209 // this in a number of places when checking for matches and
210 // overlap
211 assert(addr == blockAlign(addr));
212
213 MSHR *mshr = mq->allocate(addr, size, pkt, time, order++,
214 allocOnFill(pkt->cmd));
215
216 if (mq->isFull()) {
217 setBlocked((BlockedCause)mq->index);
218 }
219
220 if (sched_send)
221 // schedule the send
222 schedMemSideSendEvent(time);
223
224 return mshr;
225 }
226
227 void markInServiceInternal(MSHR *mshr, bool pending_modified_resp)
228 {
229 MSHRQueue *mq = mshr->queue;
230 bool wasFull = mq->isFull();
231 mq->markInService(mshr, pending_modified_resp);
232 if (wasFull && !mq->isFull()) {
233 clearBlocked((BlockedCause)mq->index);
234 }
235 }
236
237 /**
238 * Determine if we should allocate on a fill or not.
239 *
240 * @param cmd Packet command being added as an MSHR target
241 *

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

506
507 Addr blockAlign(Addr addr) const { return (addr & ~(Addr(blkSize - 1))); }
508
509
510 const AddrRangeList &getAddrRanges() const { return addrRanges; }
511
512 MSHR *allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send = true)
513 {
514 return allocateBufferInternal(&mshrQueue,
515 blockAlign(pkt->getAddr()), blkSize,
516 pkt, time, sched_send);
517 }
518
519 MSHR *allocateWriteBuffer(PacketPtr pkt, Tick time)
520 {
521 // should only see writes or clean evicts here
522 assert(pkt->isWrite() || pkt->cmd == MemCmd::CleanEvict);
523
524 return allocateBufferInternal(&writeBuffer,
525 blockAlign(pkt->getAddr()), blkSize,
526 pkt, time, true);
527 }
528
529 /**
530 * Returns true if the cache is blocked for accesses.
531 */
532 bool isBlocked() const
533 {
534 return blocked != 0;

--- 75 unchanged lines hidden ---