29 #ifndef __LEARNING_GEM5_SIMPLE_CACHE_SIMPLE_CACHE_HH__ 30 #define __LEARNING_GEM5_SIMPLE_CACHE_SIMPLE_CACHE_HH__ 32 #include <unordered_map> 36 #include "params/SimpleCache.hh" 74 SlavePort(name, owner), id(id), owner(owner), needRetry(false),
75 blockedPacket(nullptr)
108 {
panic(
"recvAtomic unimpl."); }
154 MasterPort(name, owner), owner(owner), blockedPacket(nullptr)
170 bool recvTimingResp(
PacketPtr pkt)
override;
177 void recvReqRetry()
override;
186 void recvRangeChange()
override;
326 #endif // __LEARNING_GEM5_SIMPLE_CACHE_SIMPLE_CACHE_HH__ A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
#define panic(...)
This implements a cprintf based panic() function.
Stats::Scalar hits
Cache statistics.
Ports are used to interface objects to each other.
Tick recvAtomic(PacketPtr pkt) override
Receive an atomic request packet from the master port.
void sendRangeChange() const
Called by the owner to send a range change.
Cycles is a wrapper class for representing cycle counts, i.e.
const PortID InvalidPortID
A very simple cache object.
void handleFunctional(PacketPtr pkt)
Handle a packet functionally.
int waitingPortId
The port to send the response when we recieve it back.
const unsigned blockSize
The block size for the cache.
SimpleCache(SimpleCacheParams *params)
constructor
const unsigned capacity
Number of blocks in the cache (size of cache / block size)
Port on the memory-side that receives responses.
bool handleRequest(PacketPtr pkt, int port_id)
Handle the request from the CPU side.
Port on the CPU-side that receives requests.
A SlavePort is a specialisation of a port.
Declaration of Statistics objects.
const Params * params() const
This is a simple scalar statistic, like a counter.
CPUSidePort(const std::string &name, int id, SimpleCache *owner)
Constructor.
void sendResponse(PacketPtr pkt)
Send the packet to the CPU side.
void accessTiming(PacketPtr pkt)
Access the cache for a timing access.
void trySendRetry()
Send a retry to the peer port only if it is needed.
bool handleResponse(PacketPtr pkt)
Handle the respone from the memory side.
std::unordered_map< Addr, uint8_t * > cacheStore
An incredibly simple cache storage. Maps block addresses to data.
uint64_t Tick
Tick count type.
bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the master port.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
MemSidePort(const std::string &name, SimpleCache *owner)
Constructor.
void insert(PacketPtr pkt)
Insert a block into the cache.
PacketPtr blockedPacket
If we tried to send a packet and it was blocked, store it here.
ClockedObject declaration and implementation.
int id
Since this is a vector port, need to know what number this one is.
void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the master port.
void regStats() override
Register the stats.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
const Cycles latency
Latency to check the cache. Number of cycles for both hit and miss.
SimpleCache * owner
The object that owns this object (SimpleCache)
Tick missTime
For tracking the miss latency.
SimpleCache * owner
The object that owns this object (SimpleCache)
MemSidePort memPort
Instantiation of the memory-side port.
const std::string name() const
Return port name (for DPRINTF).
PacketPtr originalPacket
Packet that we are currently handling.
bool needRetry
True if the port needs to send a retry req.
std::vector< CPUSidePort > cpuPorts
Instantiation of the CPU-side port.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void sendPacket(PacketPtr pkt)
Send a packet across this port.
AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
PacketPtr blockedPacket
If we tried to send a packet and it was blocked, store it here.
Stats::Histogram missLatency
bool accessFunctional(PacketPtr pkt)
This is where we actually update / read from the cache.
void recvRespRetry() override
Called by the master port if sendTimingResp was called on this slave port (causing recvTimingResp to ...
bool blocked
True if this cache is currently blocked waiting for a response.