From f9e833b1aba5642df9411fdc5e1ee11456cc6d61 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 25 Mar 2019 18:08:27 -0700 Subject: [PATCH] mem: Teach SimpleMem to return a MemBackdoor when appropriate. 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 Reviewed-by: Jason Lowe-Power Reviewed-by: Daniel Carvalho Reviewed-by: Nikos Nikoleris Maintainer: Jason Lowe-Power --- src/mem/simple_mem.cc | 17 +++++++++++++++++ src/mem/simple_mem.hh | 25 +++++++------------------ 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/mem/simple_mem.cc b/src/mem/simple_mem.cc index 32fea1e89..297aa6135 100644 --- a/src/mem/simple_mem.cc +++ b/src/mem/simple_mem.cc @@ -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) { diff --git a/src/mem/simple_mem.hh b/src/mem/simple_mem.hh index c8c3db516..dda4aedb9 100644 --- a/src/mem/simple_mem.hh +++ b/src/mem/simple_mem.hh @@ -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__ -- 2.30.2