Deleted Added
sdiff udiff text old ( 12429:beefb9f5f551 ) new ( 14005:6cad91d6136c )
full compact
1/*
2 * Copyright (c) 2013-2016 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

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

40/**
41 * @file
42 * Definition of a snoop filter.
43 */
44
45#ifndef __MEM_SNOOP_FILTER_HH__
46#define __MEM_SNOOP_FILTER_HH__
47
48#include <unordered_map>
49#include <utility>
50
51#include "mem/packet.hh"
52#include "mem/port.hh"
53#include "mem/qport.hh"
54#include "params/SnoopFilter.hh"
55#include "sim/sim_object.hh"

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

81 * pkt, instead of proper messages through the bus
82 * (3) there are no clean evict messages telling the snoop filter that a local,
83 * upper cache dropped a line, making the snoop filter pessimistic for now
84 * (4) ordering: there is no single point of order in the system. Instead,
85 * requesting MSHRs track order between local requests and remote snoops
86 */
87class SnoopFilter : public SimObject {
88 public:
89 typedef std::vector<QueuedSlavePort*> SnoopList;
90
91 SnoopFilter (const SnoopFilterParams *p) :
92 SimObject(p), reqLookupResult(cachedLocations.end()), retryItem{0, 0},
93 linesize(p->system->cacheLineSize()), lookupLatency(p->lookup_latency),
94 maxEntryCount(p->max_capacity / p->system->cacheLineSize())
95 {
96 }

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

109 // no need to track this port if it is not snooping
110 if (p->isSnooping()) {
111 slavePorts.push_back(p);
112 localSlavePortIds[p->getId()] = id++;
113 }
114 }
115
116 // make sure we can deal with this many ports
117 fatal_if(id > 8 * sizeof(SnoopMask),
118 "Snoop filter only supports %d snooping ports, got %d\n",
119 8 * sizeof(SnoopMask), id);
120 }
121
122 /**
123 * Lookup a request (from a slave port) in the snoop filter and
124 * return a list of other slave ports that need forwarding of the
125 * resulting snoops. Additionally, update the tracking structures
126 * with new request information. Note that the caller must also
127 * call finishRequest once it is known if the request needs to

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

193 void updateResponse(const Packet *cpkt, const SlavePort& slave_port);
194
195 virtual void regStats();
196
197 protected:
198
199 /**
200 * The underlying type for the bitmask we use for tracking. This
201 * limits the number of snooping ports supported per crossbar. For
202 * the moment it is an uint64_t to offer maximum
203 * scalability. However, it is possible to use e.g. a uint16_t or
204 * uint32_to slim down the footprint of the hash map (and
205 * ultimately improve the simulation performance).
206 */
207 typedef uint64_t SnoopMask;
208
209 /**
210 * Per cache line item tracking a bitmask of SlavePorts who have an
211 * outstanding request to this line (requested) or already share a
212 * cache line with this address (holder).
213 */
214 struct SnoopItem {
215 SnoopMask requested;

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

309 ((SnoopMask)1) << localSlavePortIds[port.getId()];
310}
311
312inline SnoopFilter::SnoopList
313SnoopFilter::maskToPortList(SnoopMask port_mask) const
314{
315 SnoopList res;
316 for (const auto& p : slavePorts)
317 if (port_mask & portToMask(*p))
318 res.push_back(p);
319 return res;
320}
321
322#endif // __MEM_SNOOP_FILTER_HH__