Go to the documentation of this file.
44 #include "debug/DRAMsim3.hh"
45 #include "debug/Drain.hh"
50 port(
name() +
".port", *this),
52 this, 0,
std::placeholders::_1)),
54 this, 0,
std::placeholders::_1)),
55 wrapper(
p->configFile,
p->filePath, read_cb, write_cb),
56 retryReq(false), retryResp(false),
startTick(0),
57 nbrOutstandingReads(0), nbrOutstandingWrites(0),
59 tickEvent([
this]{ tick(); },
name())
62 "Instantiated DRAMsim3 with clock %d ns and queue size %d\n",
76 fatal(
"DRAMsim3 %s is unconnected!\n",
name());
82 fatal(
"DRAMsim3 burst size %d does not match cache line size %d\n",
112 DPRINTF(
DRAMsim3,
"Have %d read, %d write, %d responses outstanding\n",
140 if (
system()->isTimingMode()) {
301 if (
p->second.empty())
325 if (
p->second.empty())
338 if (if_name !=
"port") {
362 ranges.push_back(
memory.getAddrRange());
369 return memory.recvAtomic(pkt);
375 memory.recvFunctional(pkt);
382 return memory.recvTimingReq(pkt);
392 DRAMsim3Params::create()
std::unordered_map< Addr, std::queue< PacketPtr > > outstandingWrites
#define fatal(...)
This implements a cprintf based fatal() function.
void readComplete(unsigned id, uint64_t addr)
Read completion callback.
bool scheduled() const
Determine if the current event is scheduled.
unsigned int queueSize() const
Get the transaction queue size used by DRAMsim3.
A ResponsePort is a specialization of a port.
DRAMsim3Wrapper wrapper
The actual DRAMsim3 wrapper.
bool recvTimingReq(PacketPtr pkt)
bool cacheResponding() const
unsigned int burstSize() const
Get the burst size in bytes used by DRAMsim3.
MemoryPort(const std::string &_name, DRAMsim3 &_memory)
bool sendTimingResp(PacketPtr pkt)
Attempt to send a timing response to the request port by calling its corresponding receive function.
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
void writeComplete(unsigned id, uint64_t addr)
Write completion callback.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void recvFunctional(PacketPtr pkt)
void tick()
Progress the controller one clock cycle.
uint64_t Tick
Tick count type.
std::unordered_map< Addr, std::queue< PacketPtr > > outstandingReads
Keep track of what packets are outstanding per address, and do so separately for reads and writes.
double clockPeriod() const
Get the internal clock period used by DRAMsim3, specified in ns.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
std::deque< PacketPtr > responseQueue
Queue to hold response packets until we can send them back.
void resetStats()
Reset stats (useful for fastforwarding switch)
unsigned int nbrOutstanding() const
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
void functionalAccess(PacketPtr pkt)
Perform an untimed memory read or write without changing anything but the memory itself.
@ Drained
Buffers drained, ready for serialization/handover.
DrainState
Object drain/handover states.
An abstract memory represents a contiguous block of physical memory, with an associated address range...
bool retryResp
Are we waiting for a retry for sending a response.
void enqueue(uint64_t addr, bool is_write)
Enqueue a packet.
void schedule(Event &event, Tick when)
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.
void access(PacketPtr pkt)
Perform an untimed memory access and update all the state (e.g.
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Ports are used to interface objects to each other.
bool needsResponse() const
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void signalDrainDone() const
Signal that an object is drained.
unsigned int nbrOutstandingWrites
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
void startup() override
startup() is the final initialization call before simulation.
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
DRAMsim3(const Params *p)
bool retryReq
Is the connected port waiting for a retry from us.
void accessAndRespond(PacketPtr pkt)
When a packet is ready, use the "access()" method in AbstractMemory to actually create the response p...
Tick recvAtomic(PacketPtr pkt)
unsigned int nbrOutstandingReads
Count the number of outstanding transactions so that we can block any further requests until there is...
const std::string & name()
EventFunctionWrapper sendResponseEvent
Event to schedule sending of responses.
EventFunctionWrapper tickEvent
Event to schedule clock ticks.
void tick()
Progress the memory controller one cycle.
virtual const std::string name() const
Overload hash function for BasicBlockRange type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
bool isConnected() const
Is this port currently connected to a peer?
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Tick startTick
Keep track of when the wrapper is started.
AbstractMemoryParams Params
void sendRetryReq()
Send a retry to the request port that previously attempted a sendTimingReq to this response port and ...
bool canAccept(uint64_t addr, bool is_write) const
Determine if the controller can accept a new packet or not.
System * system() const
read the system pointer Implemented for completeness with the setter
void sendRangeChange() const
Called by the owner to send a range change.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
void resetStats() override
Callback to reset stats.
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
@ Draining
Draining buffers pending serialization/handover.
Tick curTick()
The current simulated tick.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17