45#include "DRAMsim3/src/dramsim3.h"
56 const std::string& working_dir,
57 std::function<
void(uint64_t)> read_cb,
58 std::function<
void(uint64_t)> write_cb) :
59 dramsim(
dramsim3::GetMemorySystem(config_file, working_dir,
61 _clockPeriod(0.0), _queueSize(0), _burstSize(0)
68 fatal(
"DRAMsim3 wrapper failed to get clock\n");
75 fatal(
"DRAMsim3 wrapper failed to get queue size\n");
80 unsigned int dataBusBits =
dramsim->GetBusBits();
81 unsigned int burstLength =
dramsim->GetBurstLength();
83 if (!dataBusBits || !burstLength)
84 fatal(
"DRAMsim3 wrapper failed to get burst size\n");
109 std::function<
void(uint64_t)> write_complete)
111 dramsim->RegisterCallbacks(read_complete, write_complete);
117 return dramsim->WillAcceptTransaction(
addr, is_write);
123 [[maybe_unused]]
bool success =
dramsim->AddTransaction(
addr, is_write);
DRAMsim3Wrapper(const std::string &config_file, const std::string &working_dir, std::function< void(uint64_t)> read_cb, std::function< void(uint64_t)> write_cb)
Create an instance of the DRAMsim3 multi-channel memory controller using a specific config and system...
void setCallbacks(std::function< void(uint64_t)> read_complete, std::function< void(uint64_t)> write_complete)
Set the callbacks to use for read and write completion.
unsigned int burstSize() const
Get the burst size in bytes used by DRAMsim3.
void printStats()
Print the stats gathered in DRAMsim3.
void tick()
Progress the memory controller one cycle.
void enqueue(uint64_t addr, bool is_write)
Enqueue a packet.
unsigned int queueSize() const
Get the transaction queue size used by DRAMsim3.
void resetStats()
Reset stats (useful for fastforwarding switch)
dramsim3::MemorySystem * dramsim
double clockPeriod() const
Get the internal clock period used by DRAMsim3, specified in ns.
bool canAccept(uint64_t addr, bool is_write) const
Determine if the controller can accept a new packet or not.
DRAMsim3Wrapper declaration.
#define fatal(...)
This implements a cprintf based fatal() function.
Forward declaration to avoid includes.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.