41#ifndef __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
42#define __MEM_RUBY_SLICC_INTERFACE_ABSTRACTCONTROLLER_HH__
47#include <unordered_map>
60#include "mem/ruby/protocol/AccessPermission.hh"
62#include "params/RubyController.hh"
79 virtual const char*
what()
const throw()
80 {
return "Port rejected message based on type"; }
114 virtual void print(std::ostream & out)
const = 0;
135 {
panic(
"functionalRead(Addr,PacketPtr) not implemented"); }
142 {
panic(
"functionalRead(Addr,PacketPtr,WriteMask) not implemented"); }
153 {
fatal(
"Prefetches not implemented!");}
158 const RubyRequestType&
type,
161 const bool& was_miss)
168 {
fatal(
"collateStats() should be overridden!");}
193 if (range.contains(
addr))
return true;
224 MachineType mtype = MachineType_NUM)
const;
260 template<
typename EventType,
typename StateType>
262 EventType
type, StateType initialState,
bool retried,
263 bool isAddressed=
true)
267 assert(m_inTrans.find(
addr) == m_inTrans.end());
283 template<
typename StateType>
285 bool isAddressed=
true)
289 auto iter = m_inTrans.find(
addr);
290 assert(iter != m_inTrans.end());
291 auto &trans = iter->second;
295 "%s: event type=%d not marked as in_trans in SLICC",
296 name(), trans.transaction);
298 auto stat_iter_state = stat_iter_ev->second.find(trans.state);
299 gem5_assert(stat_iter_state != stat_iter_ev->second.end(),
300 "%s: event type=%d has no transition from state=%d",
301 name(), trans.transaction, trans.state);
303 ++(*stat_iter_state->second[(unsigned)finalState]);
308 m_inTrans.erase(iter);
322 template<
typename EventType>
324 bool isAddressed=
true)
328 assert(m_outTrans.find(
addr) == m_outTrans.end());
343 bool isAddressed=
true)
347 auto iter = m_outTrans.find(
addr);
348 assert(iter != m_outTrans.end());
349 auto &trans = iter->second;
353 "%s: event type=%d not marked as out_trans in SLICC",
354 name(), trans.transaction);
356 stat_iter->second->sample(
360 m_outTrans.erase(iter);
375 {
fatal(
"inCache: prefetching not supported");
return false; }
378 {
fatal(
"hasBeenPrefetched: prefetching not supported");
return false; }
382 {
fatal(
"hasBeenPrefetched: prefetching not supported");
return false; }
385 {
fatal(
"inMissQueue: prefetching not supported");
return false; }
388 {
fatal(
"coalesce: prefetching not supported");
return false; }
459 std::unordered_map<MachineType, AddrRangeMap<MachineID, 3>>
483 std::unordered_map<unsigned, std::unordered_map<unsigned,
490 std::unordered_map<unsigned, statistics::Scalar*>
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
ClockedObjectParams Params
Parameters of ClockedObject.
Cycles ticksToCycles(Tick t) const
Cycles is a wrapper class for representing cycle counts, i.e.
Wrap a member function inside MemberEventWrapper to use it as an event callback.
virtual std::string name() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Ports are used to interface objects to each other.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Port that forwards requests and receives responses from the memory controller.
MemoryPort(const std::string &_name, AbstractController *_controller, PortID id=InvalidPortID)
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
AbstractController * controller
void initNetworkPtr(Network *net_ptr)
bool m_mem_ctrl_waiting_retry
std::vector< MessageBuffer * > MsgVecType
bool recvTimingResp(PacketPtr pkt)
void profileMsgDelay(uint32_t virtualNetwork, Cycles delay)
Profiles the delay associated with messages.
NetDest upstreamDestinations
void dequeueMemRespQueue()
std::map< Addr, MsgVecType * > WaitingBufType
virtual void initNetQueues()=0
Initialize the message buffers.
const int m_number_of_TBEs
virtual void notifyCoalesced(const Addr &addr, const RubyRequestType &type, const RequestPtr &req, const DataBlock &data_blk, const bool &was_miss)
Notifies controller of a request coalesced at the sequencer.
void wakeUpBuffer(MessageBuffer *buf, Addr addr)
const int m_transitions_per_cycle
MachineID getMachineID() const
void functionalMemoryRead(PacketPtr)
statistics::Histogram & getDelayVCHist(uint32_t index)
int functionalMemoryWrite(PacketPtr)
virtual void regStats()
Callback to set stat parameters.
virtual void print(std::ostream &out) const =0
Tick recvAtomic(PacketPtr pkt)
const NetDest & allUpstreamDest() const
List of upstream destinations (towards the CPU)
std::unordered_map< Addr, TransMapPair > m_outTransAddressed
void incomingTransactionStart(Addr addr, EventType type, StateType initialState, bool retried, bool isAddressed=true)
Profiles an event that initiates a protocol transactions for a specific line (e.g.
virtual Cycles mandatoryQueueLatency(const RubyRequestType ¶m_type)
const AddrRangeList addrRanges
The address range to which the controller responds on the CPU side.
std::unordered_map< MachineType, AddrRangeMap< MachineID, 3 > > downstreamAddrMap
virtual AccessPermission getAccessPermission(const Addr &addr)=0
const AddrRangeList & getAddrRanges() const
virtual MessageBuffer * getMemReqQueue() const =0
std::set< MessageBuffer * > MsgBufType
unsigned int m_cur_in_port
virtual DMASequencer * getDMASequencer() const =0
virtual int functionalWrite(const Addr &addr, PacketPtr)=0
virtual void recordCacheTrace(int cntrl, CacheRecorder *tr)=0
virtual bool functionalReadBuffers(PacketPtr &)=0
These functions are used by ruby system to read/write the data blocks that exist with in the controll...
bool respondsTo(Addr addr)
const NetDest & allDownstreamDest() const
List of downstream destinations (towards memory)
const unsigned int m_buffer_size
void wakeUpBuffers(Addr addr)
virtual bool hasBeenPrefetched(const Addr &addr, const bool &is_secure, const RequestorID &requestor)
void outgoingTransactionStart(Addr addr, EventType type, bool isAddressed=true)
Profiles an event that initiates a transaction in a peer controller (e.g.
MachineID mapAddressToDownstreamMachine(Addr addr, MachineType mtype=MachineType_NUM) const
Maps an address to the correct dowstream MachineID (i.e.
virtual void enqueuePrefetch(const Addr &, const RubyRequestType &)
Function for enqueuing a prefetch request.
const Cycles m_mandatory_queue_latency
virtual void collateStats()
Function for collating statistics from all the controllers of this particular type.
virtual MessageBuffer * getMemRespQueue() const =0
virtual bool functionalReadBuffers(PacketPtr &, WriteMask &mask)=0
Functional read that reads only blocks not present in the mask.
AbstractController(const Params &p)
virtual void functionalRead(const Addr &addr, PacketPtr)
NetDest downstreamDestinations
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
void memRespQueueDequeued()
RequestorID getRequestorId() const
MemberEventWrapper<&AbstractController::sendRetryRespToMem > mRetryRespEvent
bool isBlocked(Addr) const
std::unordered_map< Addr, TransMapPair > m_inTransAddressed
virtual Sequencer * getCPUSequencer() const =0
std::unordered_map< Addr, TransMapPair > m_inTransUnaddressed
MachineType getType() const
virtual void resetStats()=0
Callback to reset stats.
virtual void functionalRead(const Addr &addr, PacketPtr pkt, WriteMask &mask)
void blockOnQueue(Addr, MessageBuffer *)
MachineID mapAddressToMachine(Addr addr, MachineType mtype) const
Map an address to the correct MachineID.
virtual bool inCache(const Addr &addr, const bool &is_secure)
Functions needed by CacheAccessor.
virtual MessageBuffer * getMandatoryQueue() const =0
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
A function used to return the port associated with this bus object.
virtual bool inMissQueue(const Addr &addr, const bool &is_secure)
void outgoingTransactionEnd(Addr addr, bool retried, bool isAddressed=true)
Profiles the end of an outgoing transaction.
NodeID getVersion() const
gem5::ruby::AbstractController::ControllerStats stats
virtual GPUCoalescer * getGPUCoalescer() const =0
void profileRequest(const std::string &request)
Profiles original cache requests including PUTs.
void incomingTransactionEnd(Addr addr, StateType finalState, bool isAddressed=true)
Profiles an event that ends a transaction.
std::unordered_map< Addr, TransMapPair > m_outTransUnaddressed
std::map< Addr, MessageBuffer * > m_block_map
WaitingBufType m_waiting_buffers
void sendRetryRespToMem()
statistics::Histogram & getDelayHist()
bool serviceMemoryQueue()
virtual bool hasBeenPrefetched(const Addr &addr, const bool &is_secure)
void stallBuffer(MessageBuffer *buf, Addr addr)
virtual int functionalWriteBuffers(PacketPtr &)=0
The return value indicates the number of messages written with the data from the packet.
virtual const char * what() const
This is a proxy for prefetcher class in classic memory.
This is a simple scalar statistic, like a counter.
ClockedObject declaration and implementation.
#define panic(...)
This implements a cprintf based panic() function.
#define gem5_assert(cond,...)
The assert macro will function like a normal assert, but will use panic instead of straight abort().
#define fatal(...)
This implements a cprintf based fatal() function.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< Request > RequestPtr
const PortID InvalidPortID
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
Declaration of the Packet class.
Declaration of the queued port.
A virtual base opaque structure used to hold state associated with the packet (e.g....
std::unordered_map< unsigned, statistics::Histogram * > outTransLatHist
statistics::Scalar fullyBusyCycles
Counter for the number of cycles when the transitions carried out were equal to the maximum allowed.
ControllerStats(statistics::Group *parent)
std::unordered_map< unsigned, statistics::Scalar * > outTransRetryCnt
std::unordered_map< unsigned, std::unordered_map< unsigned, std::vector< statistics::Scalar * > > > inTransStateChanges
statistics::Histogram delayHistogram
Histogram for profiling delay for the messages this controller cares for.
std::unordered_map< unsigned, statistics::Scalar * > inTransRetryCnt
std::vector< statistics::Histogram * > delayVCHistogram
std::unordered_map< unsigned, statistics::Histogram * > inTransLatHist
SenderState(MachineID _id)
MachineType getType() const