mem: Rename Packet::checkFunctional to trySatisfyFunctional
authorRobert Kovacsics <rmk35@cl.cam.ac.uk>
Thu, 19 Jul 2018 17:56:06 +0000 (18:56 +0100)
committerKovacsics Róbert <kovirobi@gmail.com>
Mon, 23 Jul 2018 11:57:50 +0000 (11:57 +0000)
Packet::checkFunctional also wrote data to/from the packet depending
on if it was read/write, respectively, which the 'check' in the name
would suggest otherwise. This renames it to doFunctional, which is
more suggestive. It also renames any function called checkFunctional
which calls Packet::checkFunctional. These are

- Bridge::BridgeMasterPort::checkFunctional
  - calls Packet::checkFunctional
- MSHR::checkFunctional
  - calls Packet::checkFunctional
- MSHR::TargetList::checkFunctional
  - calls Packet::checkFunctional
- Queue<>::checkFunctional
  (of src/mem/cache/queue.hh, not src/cpu/minor/buffers.h)
  - Instantiated with Queue<WriteQueueEntry> and Queue<MSHR>
- WriteQueueEntry
  - calls Packet::checkFunctional
- WriteQueueEntry::TargetList
  - calls Packet::checkFunctional
- MemDelay::checkFunctional
  - calls QueuedSlavePort/QueuedMasterPort::checkFunctional
- Packet::checkFunctional
- PacketQueue::checkFunctional
  - calls Packet::checkFunctional
- QueuedSlavePort::checkFunctional
  - calls PacketQueue::doFunctional
- QueuedMasterPort::checkFunctional
  - calls PacketQueue::doFunctional
- SerialLink::SerialLinkMasterPort::checkFunctional
  - calls Packet::doFunctional

Change-Id: Ieca2579c020c329040da053ba8e25820801b62c5
Reviewed-on: https://gem5-review.googlesource.com/11810
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

24 files changed:
src/mem/bridge.cc
src/mem/bridge.hh
src/mem/cache/base.cc
src/mem/cache/mshr.cc
src/mem/cache/mshr.hh
src/mem/cache/queue.hh
src/mem/cache/write_queue_entry.cc
src/mem/cache/write_queue_entry.hh
src/mem/coherent_xbar.cc
src/mem/dram_ctrl.cc
src/mem/dramsim2.cc
src/mem/mem_delay.cc
src/mem/mem_delay.hh
src/mem/noncoherent_xbar.cc
src/mem/packet.cc
src/mem/packet.hh
src/mem/packet_queue.cc
src/mem/packet_queue.hh
src/mem/qport.hh
src/mem/ruby/slicc_interface/AbstractController.cc
src/mem/serial_link.cc
src/mem/serial_link.hh
src/mem/simple_mem.cc
src/mem/tport.cc

index 0c9e2c15a09c7d4736557d9b47d28eb43cbc653a..1066f47a01073028e37ee34983784a0391765abb 100644 (file)
@@ -361,14 +361,14 @@ Bridge::BridgeSlavePort::recvFunctional(PacketPtr pkt)
 
     // check the response queue
     for (auto i = transmitList.begin();  i != transmitList.end(); ++i) {
-        if (pkt->checkFunctional((*i).pkt)) {
+        if (pkt->trySatisfyFunctional((*i).pkt)) {
             pkt->makeResponse();
             return;
         }
     }
 
     // also check the master port's request queue
-    if (masterPort.checkFunctional(pkt)) {
+    if (masterPort.trySatisfyFunctional(pkt)) {
         return;
     }
 
@@ -379,13 +379,13 @@ Bridge::BridgeSlavePort::recvFunctional(PacketPtr pkt)
 }
 
 bool
-Bridge::BridgeMasterPort::checkFunctional(PacketPtr pkt)
+Bridge::BridgeMasterPort::trySatisfyFunctional(PacketPtr pkt)
 {
     bool found = false;
     auto i = transmitList.begin();
 
     while (i != transmitList.end() && !found) {
-        if (pkt->checkFunctional((*i).pkt)) {
+        if (pkt->trySatisfyFunctional((*i).pkt)) {
             pkt->makeResponse();
             found = true;
         }
index f2cc44501f46b5e90b9e4f16dbf1f70eca39e728..bb772771725da02c38f934d2e491827561ad09b2 100644 (file)
@@ -295,7 +295,7 @@ class Bridge : public MemObject
          *
          * @return true if we find a match
          */
-        bool checkFunctional(PacketPtr pkt);
+        bool trySatisfyFunctional(PacketPtr pkt);
 
       protected:
 
index c1ebdd6c06d22922eae284c07534cc67d931438c..862aa3a9466109a3bd9cae5de92a57616eec0faf 100644 (file)
@@ -664,8 +664,8 @@ BaseCache::functionalAccess(PacketPtr pkt, bool from_cpu_side)
 
     // see if we have data at all (owned or otherwise)
     bool have_data = blk && blk->isValid()
-        && pkt->checkFunctional(&cbpw, blk_addr, is_secure, blkSize,
-                                blk->data);
+        && pkt->trySatisfyFunctional(&cbpw, blk_addr, is_secure, blkSize,
+                                     blk->data);
 
     // data we have is dirty if marked as such or if we have an
     // in-service MSHR that is pending a modified line
@@ -674,10 +674,10 @@ BaseCache::functionalAccess(PacketPtr pkt, bool from_cpu_side)
                       (mshr && mshr->inService && mshr->isPendingModified()));
 
     bool done = have_dirty ||
-        cpuSidePort.checkFunctional(pkt) ||
-        mshrQueue.checkFunctional(pkt, blk_addr) ||
-        writeBuffer.checkFunctional(pkt, blk_addr) ||
-        memSidePort.checkFunctional(pkt);
+        cpuSidePort.trySatisfyFunctional(pkt) ||
+        mshrQueue.trySatisfyFunctional(pkt, blk_addr) ||
+        writeBuffer.trySatisfyFunctional(pkt, blk_addr) ||
+        memSidePort.trySatisfyFunctional(pkt);
 
     DPRINTF(CacheVerbose, "%s: %s %s%s%s\n", __func__,  pkt->print(),
             (blk && blk->isValid()) ? "valid " : "",
index 8629b33779fa8e73b6f01e4d3e500d436fb85adf..ccaec7b970ae29cf4787d74819b5d99154fa9374 100644 (file)
@@ -207,10 +207,10 @@ MSHR::TargetList::clearDownstreamPending()
 
 
 bool
-MSHR::TargetList::checkFunctional(PacketPtr pkt)
+MSHR::TargetList::trySatisfyFunctional(PacketPtr pkt)
 {
     for (auto& t : *this) {
-        if (pkt->checkFunctional(t.pkt)) {
+        if (pkt->trySatisfyFunctional(t.pkt)) {
             return true;
         }
     }
@@ -618,17 +618,17 @@ MSHR::promoteWritable()
 
 
 bool
-MSHR::checkFunctional(PacketPtr pkt)
+MSHR::trySatisfyFunctional(PacketPtr pkt)
 {
     // For printing, we treat the MSHR as a whole as single entity.
     // For other requests, we iterate over the individual targets
     // since that's where the actual data lies.
     if (pkt->isPrint()) {
-        pkt->checkFunctional(this, blkAddr, isSecure, blkSize, nullptr);
+        pkt->trySatisfyFunctional(this, blkAddr, isSecure, blkSize, nullptr);
         return false;
     } else {
-        return (targets.checkFunctional(pkt) ||
-                deferredTargets.checkFunctional(pkt));
+        return (targets.trySatisfyFunctional(pkt) ||
+                deferredTargets.trySatisfyFunctional(pkt));
     }
 }
 
index 050dbd1bf5c9be0d67e6f4124de7c0e2a372eba1..218de9244c0d0d8e506dd07083e28bb392a71ee1 100644 (file)
@@ -235,7 +235,7 @@ class MSHR : public QueueEntry, public Printable
 
         void clearDownstreamPending();
         void clearDownstreamPending(iterator begin, iterator end);
-        bool checkFunctional(PacketPtr pkt);
+        bool trySatisfyFunctional(PacketPtr pkt);
         void print(std::ostream &os, int verbosity,
                    const std::string &prefix) const;
     };
@@ -414,7 +414,7 @@ class MSHR : public QueueEntry, public Printable
      */
     void promoteWritable();
 
-    bool checkFunctional(PacketPtr pkt);
+    bool trySatisfyFunctional(PacketPtr pkt);
 
     /**
      * Prints the contents of this MSHR for debugging.
index 8e5ccf1f4eecca4d992aaf9804aa9f4b24d45f32..1d7ce0c07f3b7ec7a83f780c38b13e5edb5bc80e 100644 (file)
@@ -177,11 +177,11 @@ class Queue : public Drainable
         return nullptr;
     }
 
-    bool checkFunctional(PacketPtr pkt, Addr blk_addr)
+    bool trySatisfyFunctional(PacketPtr pkt, Addr blk_addr)
     {
         pkt->pushLabel(label);
         for (const auto& entry : allocatedList) {
-            if (entry->blkAddr == blk_addr && entry->checkFunctional(pkt)) {
+            if (entry->blkAddr == blk_addr && entry->trySatisfyFunctional(pkt)) {
                 pkt->popLabel();
                 return true;
             }
index e393731b7e0d6c54c5e9a7b74cce52742724a32e..6c8387bcbe0eccc80f35a5a62c340c30c2d78bd6 100644 (file)
@@ -66,10 +66,10 @@ WriteQueueEntry::TargetList::add(PacketPtr pkt, Tick readyTime,
 }
 
 bool
-WriteQueueEntry::TargetList::checkFunctional(PacketPtr pkt)
+WriteQueueEntry::TargetList::trySatisfyFunctional(PacketPtr pkt)
 {
     for (auto& t : *this) {
-        if (pkt->checkFunctional(t.pkt)) {
+        if (pkt->trySatisfyFunctional(t.pkt)) {
             return true;
         }
     }
@@ -122,16 +122,16 @@ WriteQueueEntry::deallocate()
 }
 
 bool
-WriteQueueEntry::checkFunctional(PacketPtr pkt)
+WriteQueueEntry::trySatisfyFunctional(PacketPtr pkt)
 {
     // For printing, we treat the WriteQueueEntry as a whole as single
     // entity. For other requests, we iterate over the individual
     // targets since that's where the actual data lies.
     if (pkt->isPrint()) {
-        pkt->checkFunctional(this, blkAddr, isSecure, blkSize, nullptr);
+        pkt->trySatisfyFunctional(this, blkAddr, isSecure, blkSize, nullptr);
         return false;
     } else {
-        return targets.checkFunctional(pkt);
+        return targets.trySatisfyFunctional(pkt);
     }
 }
 
index 5a4b5a820a01c1bf2ed7f487f9dfb6584929b417..f4ccb1a8c4e037922fc9e2c48c2b10a66c1bf3bc 100644 (file)
@@ -97,7 +97,7 @@ class WriteQueueEntry : public QueueEntry, public Printable
 
         TargetList() {}
         void add(PacketPtr pkt, Tick readyTime, Counter order);
-        bool checkFunctional(PacketPtr pkt);
+        bool trySatisfyFunctional(PacketPtr pkt);
         void print(std::ostream &os, int verbosity,
                    const std::string &prefix) const;
     };
@@ -179,7 +179,7 @@ class WriteQueueEntry : public QueueEntry, public Printable
         targets.pop_front();
     }
 
-    bool checkFunctional(PacketPtr pkt);
+    bool trySatisfyFunctional(PacketPtr pkt);
 
     /**
      * Prints the contents of this MSHR for debugging.
index d46f3893f34591499007df691701f5b9fc5b5785..2bee5bc9d630e54f8ff28b410126e7bc15c80ead 100644 (file)
@@ -1002,7 +1002,7 @@ CoherentXBar::recvFunctional(PacketPtr pkt, PortID slave_port_id)
             // if we find a response that has the data, then the
             // downstream caches/memories may be out of date, so simply stop
             // here
-            if (p->checkFunctional(pkt)) {
+            if (p->trySatisfyFunctional(pkt)) {
                 if (pkt->needsResponse())
                     pkt->makeResponse();
                 return;
@@ -1025,7 +1025,7 @@ CoherentXBar::recvFunctionalSnoop(PacketPtr pkt, PortID master_port_id)
     }
 
     for (const auto& p : slavePorts) {
-        if (p->checkFunctional(pkt)) {
+        if (p->trySatisfyFunctional(pkt)) {
             if (pkt->needsResponse())
                 pkt->makeResponse();
             return;
index 1a3eec48df84a2d959175a3b27bb94bcd3667bfb..ba1a5ca7bb7a9c42cc70e1651833bdf94f437f49 100644 (file)
@@ -2745,7 +2745,7 @@ DRAMCtrl::MemoryPort::recvFunctional(PacketPtr pkt)
 {
     pkt->pushLabel(memory.name());
 
-    if (!queue.checkFunctional(pkt)) {
+    if (!queue.trySatisfyFunctional(pkt)) {
         // Default implementation of SimpleTimingPort::recvFunctional()
         // calls recvAtomic() and throws away the latency; we can save a
         // little here by just not calculating the latency.
index b900d4df07d71769b7251e6ee5e9855e2707769c..6fe8543644c8c34dccfc4f0fb254a5a95762b746 100644 (file)
@@ -169,7 +169,7 @@ DRAMSim2::recvFunctional(PacketPtr pkt)
 
     // potentially update the packets in our response queue as well
     for (auto i = responseQueue.begin(); i != responseQueue.end(); ++i)
-        pkt->checkFunctional(*i);
+        pkt->trySatisfyFunctional(*i);
 
     pkt->popLabel();
 }
index 4a682f3bcaa4ee1ff14878ec524c4bbcd99e57cd..b3c89d2a3dba1e12c93285812729c960739ec93d 100644 (file)
@@ -81,10 +81,10 @@ MemDelay::getSlavePort(const std::string& if_name, PortID idx)
 }
 
 bool
-MemDelay::checkFunctional(PacketPtr pkt)
+MemDelay::trySatisfyFunctional(PacketPtr pkt)
 {
-    return slavePort.checkFunctional(pkt) ||
-        masterPort.checkFunctional(pkt);
+    return slavePort.trySatisfyFunctional(pkt) ||
+        masterPort.trySatisfyFunctional(pkt);
 }
 
 MemDelay::MasterPort::MasterPort(const std::string &_name, MemDelay &_parent)
@@ -107,7 +107,7 @@ MemDelay::MasterPort::recvTimingResp(PacketPtr pkt)
 void
 MemDelay::MasterPort::recvFunctionalSnoop(PacketPtr pkt)
 {
-    if (parent.checkFunctional(pkt)) {
+    if (parent.trySatisfyFunctional(pkt)) {
         pkt->makeResponse();
     } else {
         parent.slavePort.sendFunctionalSnoop(pkt);
@@ -156,7 +156,7 @@ MemDelay::SlavePort::recvTimingReq(PacketPtr pkt)
 void
 MemDelay::SlavePort::recvFunctional(PacketPtr pkt)
 {
-    if (parent.checkFunctional(pkt)) {
+    if (parent.trySatisfyFunctional(pkt)) {
         pkt->makeResponse();
     } else {
         parent.masterPort.sendFunctional(pkt);
index 28c04052bec08b835b6a0355e4fa97aae05c8cf2..7ecb656f59205f0b1ff12cf843545285a3182872 100644 (file)
@@ -125,7 +125,7 @@ class MemDelay : public MemObject
 
     };
 
-    bool checkFunctional(PacketPtr pkt);
+    bool trySatisfyFunctional(PacketPtr pkt);
 
     MasterPort masterPort;
     SlavePort slavePort;
index 7bd04cb3eeb3083cd1ec665bbd30cd34f3efcbcd..b0fe205c10a4ee3ebfeee1fdb18c8ae9fcf09495 100644 (file)
@@ -297,7 +297,7 @@ NoncoherentXBar::recvFunctional(PacketPtr pkt, PortID slave_port_id)
         // if we find a response that has the data, then the
         // downstream caches/memories may be out of date, so simply stop
         // here
-        if (p->checkFunctional(pkt)) {
+        if (p->trySatisfyFunctional(pkt)) {
             if (pkt->needsResponse())
                 pkt->makeResponse();
             return;
index 7a28fbf5bfeff2d06bdf0152e86bb7e20e06014d..866bc9051e6491174f93ca72e7bda65b37213e47 100644 (file)
@@ -225,7 +225,7 @@ MemCmd::commandInfo[] =
 };
 
 bool
-Packet::checkFunctional(Printable *obj, Addr addr, bool is_secure, int size,
+Packet::trySatisfyFunctional(Printable *obj, Addr addr, bool is_secure, int size,
                         uint8_t *_data)
 {
     const Addr func_start = getAddr();
index 5c041120aab78c82ed3023e6725a87ae54f20e39..36a46438a32d774070f25dfe65b5471804e61c28 100644 (file)
@@ -1168,14 +1168,14 @@ class Packet : public Printable
      * accordingly.
      */
     bool
-    checkFunctional(PacketPtr other)
+    trySatisfyFunctional(PacketPtr other)
     {
         // all packets that are carrying a payload should have a valid
         // data pointer
-        return checkFunctional(other, other->getAddr(), other->isSecure(),
-                               other->getSize(),
-                               other->hasData() ?
-                               other->getPtr<uint8_t>() : NULL);
+        return trySatisfyFunctional(other, other->getAddr(), other->isSecure(),
+                                    other->getSize(),
+                                    other->hasData() ?
+                                    other->getPtr<uint8_t>() : NULL);
     }
 
     /**
@@ -1206,8 +1206,8 @@ class Packet : public Printable
      * memory value.
      */
     bool
-    checkFunctional(Printable *obj, Addr base, bool is_secure, int size,
-                    uint8_t *_data);
+    trySatisfyFunctional(Printable *obj, Addr base, bool is_secure, int size,
+                         uint8_t *_data);
 
     /**
      * Push label for PrintReq (safe to call unconditionally).
index a630f1f5f170db14516c96f8aba9046d9f07167c..7aa2fc1f9e106d77bfcfe00242ad6fc168ea4256 100644 (file)
@@ -82,7 +82,7 @@ PacketQueue::hasAddr(Addr addr) const
 }
 
 bool
-PacketQueue::checkFunctional(PacketPtr pkt)
+PacketQueue::trySatisfyFunctional(PacketPtr pkt)
 {
     pkt->pushLabel(label);
 
@@ -92,7 +92,7 @@ PacketQueue::checkFunctional(PacketPtr pkt)
     while (!found && i != transmitList.end()) {
         // If the buffered packet contains data, and it overlaps the
         // current packet, then update data
-        found = pkt->checkFunctional(i->pkt);
+        found = pkt->trySatisfyFunctional(i->pkt);
         ++i;
     }
 
index f7379c90044589f75b1850cc5b41b833fa49de3f..629fca58e2071eaf5c8e26fcfd3996c13263a102 100644 (file)
@@ -169,7 +169,7 @@ class PacketQueue : public Drainable
 
     /** Check the list of buffered packets against the supplied
      * functional request. */
-    bool checkFunctional(PacketPtr pkt);
+    bool trySatisfyFunctional(PacketPtr pkt);
 
     /**
      * Schedule a send event if we are not already waiting for a
index b15bdfec2c678391f5136e18c6b5a2d0f636e1a1..708347a21ba282d13e57af21277691a9bdb53b25 100644 (file)
@@ -93,8 +93,8 @@ class QueuedSlavePort : public SlavePort
 
     /** Check the list of buffered packets against the supplied
      * functional request. */
-    bool checkFunctional(PacketPtr pkt)
-    { return respQueue.checkFunctional(pkt); }
+    bool trySatisfyFunctional(PacketPtr pkt)
+    { return respQueue.trySatisfyFunctional(pkt); }
 };
 
 /**
@@ -159,10 +159,10 @@ class QueuedMasterPort : public MasterPort
 
     /** Check the list of buffered packets against the supplied
      * functional request. */
-    bool checkFunctional(PacketPtr pkt)
+    bool trySatisfyFunctional(PacketPtr pkt)
     {
-        return reqQueue.checkFunctional(pkt) ||
-            snoopRespQueue.checkFunctional(pkt);
+        return reqQueue.trySatisfyFunctional(pkt) ||
+            snoopRespQueue.trySatisfyFunctional(pkt);
     }
 };
 
index 5f7eb65580403f1811140be08281f2a2656d9f17..de7e03dd7dda958d2605ba51eda6ae5e4ebfdaca 100644 (file)
@@ -318,7 +318,7 @@ AbstractController::functionalMemoryWrite(PacketPtr pkt)
     int num_functional_writes = 0;
 
     // Check the buffer from the controller to the memory.
-    if (memoryPort.checkFunctional(pkt)) {
+    if (memoryPort.trySatisfyFunctional(pkt)) {
         num_functional_writes++;
     }
 
index 97563c0d0838c33abe7d3102ea569912ac7350f5..e1f3a001a638c9c4ead55a7990505af97a0961a3 100644 (file)
@@ -393,14 +393,14 @@ SerialLink::SerialLinkSlavePort::recvFunctional(PacketPtr pkt)
 
     // check the response queue
     for (auto i = transmitList.begin();  i != transmitList.end(); ++i) {
-        if (pkt->checkFunctional((*i).pkt)) {
+        if (pkt->trySatisfyFunctional((*i).pkt)) {
             pkt->makeResponse();
             return;
         }
     }
 
     // also check the master port's request queue
-    if (masterPort.checkFunctional(pkt)) {
+    if (masterPort.trySatisfyFunctional(pkt)) {
         return;
     }
 
@@ -411,13 +411,13 @@ SerialLink::SerialLinkSlavePort::recvFunctional(PacketPtr pkt)
 }
 
 bool
-SerialLink::SerialLinkMasterPort::checkFunctional(PacketPtr pkt)
+SerialLink::SerialLinkMasterPort::trySatisfyFunctional(PacketPtr pkt)
 {
     bool found = false;
     auto i = transmitList.begin();
 
     while (i != transmitList.end() && !found) {
-        if (pkt->checkFunctional((*i).pkt)) {
+        if (pkt->trySatisfyFunctional((*i).pkt)) {
             pkt->makeResponse();
             found = true;
         }
index 64f262d0f6f69873289f85981ea8d17d9d22a5ee..6315f1b947b0c70b67def4a27d831f19c500c241 100644 (file)
@@ -288,7 +288,7 @@ class SerialLink : public MemObject
          *
          * @return true if we find a match
          */
-        bool checkFunctional(PacketPtr pkt);
+        bool trySatisfyFunctional(PacketPtr pkt);
 
       protected:
 
index 6914ac4f6522f8aac28f4872658a4a7d9fb8ae3a..64d7d204c3f9438e76d7dd7ed2fd887049541dbc 100644 (file)
@@ -91,7 +91,7 @@ SimpleMemory::recvFunctional(PacketPtr pkt)
     auto p = packetQueue.begin();
     // potentially update the packets in our packet queue as well
     while (!done && p != packetQueue.end()) {
-        done = pkt->checkFunctional(p->pkt);
+        done = pkt->trySatisfyFunctional(p->pkt);
         ++p;
     }
 
index fce4f6ca23ba91fe76d1052de11677c942efefbc..9f0f08814b92ed4961985743a2d56117cbfd5d06 100644 (file)
@@ -54,7 +54,7 @@ SimpleTimingPort::SimpleTimingPort(const std::string& _name,
 void
 SimpleTimingPort::recvFunctional(PacketPtr pkt)
 {
-    if (!respQueue.checkFunctional(pkt)) {
+    if (!respQueue.trySatisfyFunctional(pkt)) {
         // do an atomic access and throw away the returned latency
         recvAtomic(pkt);
     }