}
// Initial target is used just for stats
- MSHR::Target *initial_tgt = mshr->getTarget();
+ QueueEntry::Target *initial_tgt = mshr->getTarget();
int stats_cmd_idx = initial_tgt->pkt->cmdToIndex();
Tick miss_latency = curTick() - initial_tgt->recvTime;
void
Cache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)
{
- MSHR::Target *initial_tgt = mshr->getTarget();
+ QueueEntry::Target *initial_tgt = mshr->getTarget();
// First offset for critical word first calculations
const int initial_offset = initial_tgt->pkt->getOffset(blkSize);
/** True if the entry is just a simple forward from an upper level */
bool isForward;
- class Target {
+ class Target : public QueueEntry::Target {
public:
enum Source {
FromPrefetcher
};
- const Tick recvTime; //!< Time when request was received (for stats)
- const Tick readyTime; //!< Time when request is ready to be serviced
- const Counter order; //!< Global order (for memory consistency mgmt)
- const PacketPtr pkt; //!< Pending request packet.
const Source source; //!< Request from cpu, memory, or prefetcher?
/**
Target(PacketPtr _pkt, Tick _readyTime, Counter _order,
Source _source, bool _markedPending, bool alloc_on_fill)
- : recvTime(curTick()), readyTime(_readyTime), order(_order),
- pkt(_pkt), source(_source), markedPending(_markedPending),
- allocOnFill(alloc_on_fill)
+ : QueueEntry::Target(_pkt, _readyTime, _order), source(_source),
+ markedPending(_markedPending), allocOnFill(alloc_on_fill)
{}
};
* Returns a reference to the first target.
* @return A pointer to the first target.
*/
- Target *getTarget()
+ QueueEntry::Target *getTarget() override
{
assert(hasTargets());
return &targets.front();
NoncoherentCache::serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt,
CacheBlk *blk)
{
- MSHR::Target *initial_tgt = mshr->getTarget();
// First offset for critical word first calculations
- const int initial_offset = initial_tgt->pkt->getOffset(blkSize);
+ const int initial_offset = mshr->getTarget()->pkt->getOffset(blkSize);
MSHR::TargetList targets = mshr->extractServiceableTargets(pkt);
for (auto &target: targets) {
bool _isUncacheable;
public:
+ /**
+ * A queue entry is holding packets that will be serviced as soon as
+ * resources are available. Since multiple references to the same
+ * address can arrive while a packet is not serviced, each packet is
+ * stored in a target containing its availability, order and other info,
+ * and the queue entry stores these similar targets in a list.
+ */
+ class Target {
+ public:
+ const Tick recvTime; //!< Time when request was received (for stats)
+ const Tick readyTime; //!< Time when request is ready to be serviced
+ const Counter order; //!< Global order (for memory consistency mgmt)
+ const PacketPtr pkt; //!< Pending request packet.
+
+ /**
+ * Default constructor. Assigns the current tick as the arrival time
+ * of the packet.
+ *
+ * @param _pkt The pending request packet.
+ * @param ready_time The tick at which the packet will be serviceable.
+ * @param _order Global order.
+ */
+ Target(PacketPtr _pkt, Tick ready_time, Counter _order)
+ : recvTime(curTick()), readyTime(ready_time), order(_order),
+ pkt(_pkt)
+ {}
+ };
/** True if the entry has been sent downstream. */
bool inService;
*/
virtual bool sendPacket(BaseCache &cache) = 0;
+ /**
+ * Returns a pointer to the first target.
+ *
+ * @return A pointer to the first target.
+ */
+ virtual Target* getTarget() = 0;
};
#endif // __MEM_CACHE_QUEUE_ENTRY_HH__
friend class WriteQueue;
public:
-
- class Target {
- public:
-
- const Tick recvTime; //!< Time when request was received (for stats)
- const Tick readyTime; //!< Time when request is ready to be serviced
- const Counter order; //!< Global order (for memory consistency mgmt)
- const PacketPtr pkt; //!< Pending request packet.
-
- Target(PacketPtr _pkt, Tick _readyTime, Counter _order)
- : recvTime(curTick()), readyTime(_readyTime), order(_order),
- pkt(_pkt)
- {}
- };
-
class TargetList : public std::list<Target> {
public:
* Returns a reference to the first target.
* @return A pointer to the first target.
*/
- Target *getTarget()
+ Target *getTarget() override
{
assert(hasTargets());
return &targets.front();