mem: Teach SimpleMem to return a MemBackdoor when appropriate.
authorGabe Black <gabeblack@google.com>
Tue, 26 Mar 2019 01:08:27 +0000 (18:08 -0700)
committerGabe Black <gabeblack@google.com>
Sun, 14 Apr 2019 01:01:56 +0000 (01:01 +0000)
If the back door SimpleMem inherits from AbstractMem has a pointer and
is hence valid, SimpleMem will return that pointer when asked.

Change-Id: I734daba48e4ae5b4ad8ac9a108e7b12b5e82803f
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17669
Reviewed-by: Anthony Gutierrez <anthony.gutierrez@amd.com>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

src/mem/simple_mem.cc
src/mem/simple_mem.hh

index 32fea1e89082d9703960b0ed97d977f71562bb8f..297aa6135e3941c648769a819bede19f8fb419d8 100644 (file)
@@ -80,6 +80,16 @@ SimpleMemory::recvAtomic(PacketPtr pkt)
     return getLatency();
 }
 
+Tick
+SimpleMemory::recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &_backdoor)
+{
+    Tick latency = recvAtomic(pkt);
+
+    if (backdoor.ptr())
+        _backdoor = &backdoor;
+    return latency;
+}
+
 void
 SimpleMemory::recvFunctional(PacketPtr pkt)
 {
@@ -271,6 +281,13 @@ SimpleMemory::MemoryPort::recvAtomic(PacketPtr pkt)
     return memory.recvAtomic(pkt);
 }
 
+Tick
+SimpleMemory::MemoryPort::recvAtomicBackdoor(
+        PacketPtr pkt, MemBackdoorPtr &_backdoor)
+{
+    return memory.recvAtomicBackdoor(pkt, _backdoor);
+}
+
 void
 SimpleMemory::MemoryPort::recvFunctional(PacketPtr pkt)
 {
index c8c3db516175fdf0c99a983dafb68646a98f9b45..dda4aedb961bd0f19b0cb7ebc237511027bf76a2 100644 (file)
@@ -84,27 +84,20 @@ class SimpleMemory : public AbstractMemory
 
     class MemoryPort : public SlavePort
     {
-
       private:
-
         SimpleMemory& memory;
 
       public:
-
         MemoryPort(const std::string& _name, SimpleMemory& _memory);
 
       protected:
-
-        Tick recvAtomic(PacketPtr pkt);
-
-        void recvFunctional(PacketPtr pkt);
-
-        bool recvTimingReq(PacketPtr pkt);
-
-        void recvRespRetry();
-
+        Tick recvAtomic(PacketPtr pkt) override;
+        Tick recvAtomicBackdoor(
+                PacketPtr pkt, MemBackdoorPtr &_backdoor) override;
+        void recvFunctional(PacketPtr pkt) override;
+        bool recvTimingReq(PacketPtr pkt) override;
+        void recvRespRetry() override;
         AddrRangeList getAddrRanges() const;
-
     };
 
     MemoryPort port;
@@ -192,15 +185,11 @@ class SimpleMemory : public AbstractMemory
     void init() override;
 
   protected:
-
     Tick recvAtomic(PacketPtr pkt);
-
+    Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &_backdoor);
     void recvFunctional(PacketPtr pkt);
-
     bool recvTimingReq(PacketPtr pkt);
-
     void recvRespRetry();
-
 };
 
 #endif //__MEM_SIMPLE_MEMORY_HH__