mem-cache: Add match functions to QueueEntry
[gem5.git] / src / mem / packet.cc
index e1c760cd05c95a4b1ad3ee78232af85e186d6d2d..1d1b5b8d797bf4b36cdbffefae5f6d0529234731 100644 (file)
@@ -227,6 +227,12 @@ MemCmd::commandInfo[] =
       InvalidCmd, "InvalidateResp" }
 };
 
+AddrRange
+Packet::getAddrRange() const
+{
+    return RangeSize(getAddr(), getSize());
+}
+
 bool
 Packet::trySatisfyFunctional(Printable *obj, Addr addr, bool is_secure, int size,
                         uint8_t *_data)
@@ -390,6 +396,32 @@ Packet::print() const {
     return str.str();
 }
 
+bool
+Packet::matchBlockAddr(const Addr addr, const bool is_secure,
+                       const int blk_size) const
+{
+    return (getBlockAddr(blk_size) == addr) && (isSecure() == is_secure);
+}
+
+bool
+Packet::matchBlockAddr(const PacketPtr pkt, const int blk_size) const
+{
+    return matchBlockAddr(pkt->getBlockAddr(blk_size), pkt->isSecure(),
+                          blk_size);
+}
+
+bool
+Packet::matchAddr(const Addr addr, const bool is_secure) const
+{
+    return (getAddr() == addr) && (isSecure() == is_secure);
+}
+
+bool
+Packet::matchAddr(const PacketPtr pkt) const
+{
+    return matchAddr(pkt->getAddr(), pkt->isSecure());
+}
+
 Packet::PrintReqState::PrintReqState(std::ostream &_os, int _verbosity)
     : curPrefixPtr(new std::string("")), os(_os), verbosity(_verbosity)
 {