Make BlockingRead/WriteDelay configurable
This commit is contained in:
@@ -60,7 +60,9 @@ void to_json(json_t &j, const McConfig &c)
|
||||
{"ThinkDelayFw", c.thinkDelayFw},
|
||||
{"ThinkDelayBw", c.thinkDelayBw},
|
||||
{"PhyDelayFw", c.phyDelayFw},
|
||||
{"PhyDelayBw", c.phyDelayBw}};
|
||||
{"PhyDelayBw", c.phyDelayBw},
|
||||
{"BlockingReadDelay", c.blockingReadDelay},
|
||||
{"BlockingWriteDelay", c.blockingWriteDelay}};
|
||||
|
||||
remove_null_values(j);
|
||||
}
|
||||
@@ -132,6 +134,12 @@ void from_json(const json_t &j, McConfig &c)
|
||||
if (j_mcconfig.contains("PhyDelayBw"))
|
||||
j_mcconfig.at("PhyDelayBw").get_to(c.phyDelayBw);
|
||||
|
||||
if (j_mcconfig.contains("BlockingReadDelay"))
|
||||
j_mcconfig.at("BlockingReadDelay").get_to(c.blockingReadDelay);
|
||||
|
||||
if (j_mcconfig.contains("BlockingWriteDelay"))
|
||||
j_mcconfig.at("BlockingWriteDelay").get_to(c.blockingWriteDelay);
|
||||
|
||||
invalidateEnum(c.pagePolicy);
|
||||
invalidateEnum(c.scheduler);
|
||||
invalidateEnum(c.schedulerBuffer);
|
||||
|
||||
@@ -171,6 +171,8 @@ struct McConfig
|
||||
std::optional<unsigned int> thinkDelayBw;
|
||||
std::optional<unsigned int> phyDelayFw;
|
||||
std::optional<unsigned int> phyDelayBw;
|
||||
std::optional<unsigned int> blockingReadDelay;
|
||||
std::optional<unsigned int> blockingWriteDelay;
|
||||
};
|
||||
|
||||
void to_json(json_t &j, const McConfig &c);
|
||||
|
||||
@@ -274,6 +274,16 @@ void Configuration::loadMCConfig(const DRAMSys::Config::McConfig &mcConfig)
|
||||
{
|
||||
phyDelayBw = std::round(sc_time(*_phyDelayBw, SC_NS) / memSpec->tCK) * memSpec->tCK;
|
||||
}
|
||||
|
||||
{
|
||||
auto _blockingReadDelay = mcConfig.blockingReadDelay.value_or(60);
|
||||
blockingReadDelay = std::round(sc_time(_blockingReadDelay, SC_NS) / memSpec->tCK) * memSpec->tCK;
|
||||
}
|
||||
|
||||
{
|
||||
auto _blockingWriteDelay = mcConfig.blockingWriteDelay.value_or(60);
|
||||
blockingWriteDelay = std::round(sc_time(_blockingWriteDelay, SC_NS) / memSpec->tCK) * memSpec->tCK;
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::loadMemSpec(const DRAMSys::Config::MemSpec &memSpecConfig)
|
||||
|
||||
@@ -79,6 +79,8 @@ public:
|
||||
sc_core::sc_time thinkDelayBw = sc_core::SC_ZERO_TIME;
|
||||
sc_core::sc_time phyDelayFw = sc_core::SC_ZERO_TIME;
|
||||
sc_core::sc_time phyDelayBw = sc_core::SC_ZERO_TIME;
|
||||
sc_core::sc_time blockingReadDelay = sc_core::SC_ZERO_TIME;
|
||||
sc_core::sc_time blockingWriteDelay = sc_core::SC_ZERO_TIME;
|
||||
|
||||
// SimConfig
|
||||
std::string simulationName = "default";
|
||||
|
||||
@@ -80,6 +80,7 @@ Controller::Controller(const sc_module_name& name, const Configuration& config,
|
||||
ControllerIF(name, config), addressDecoder(addressDecoder),
|
||||
thinkDelayFw(config.thinkDelayFw), thinkDelayBw(config.thinkDelayBw),
|
||||
phyDelayFw(config.phyDelayFw), phyDelayBw(config.phyDelayBw),
|
||||
blockingReadDelay(config.blockingReadDelay), blockingWriteDelay(config.blockingWriteDelay),
|
||||
minBytesPerBurst(config.memSpec->defaultBytesPerBurst),
|
||||
maxBytesPerBurst(config.memSpec->maxBytesPerBurst)
|
||||
{
|
||||
@@ -416,6 +417,7 @@ tlm_sync_enum Controller::nb_transport_bw(tlm_generic_payload &,
|
||||
void Controller::b_transport(tlm_generic_payload &trans, sc_time &delay)
|
||||
{
|
||||
iSocket->b_transport(trans, delay);
|
||||
delay += trans.is_write() ? blockingWriteDelay : blockingReadDelay;
|
||||
}
|
||||
|
||||
unsigned int Controller::transport_dbg(tlm_generic_payload &trans)
|
||||
|
||||
@@ -74,6 +74,8 @@ protected:
|
||||
const sc_core::sc_time thinkDelayBw;
|
||||
const sc_core::sc_time phyDelayFw;
|
||||
const sc_core::sc_time phyDelayBw;
|
||||
const sc_core::sc_time blockingReadDelay;
|
||||
const sc_core::sc_time blockingWriteDelay;
|
||||
|
||||
private:
|
||||
unsigned totalNumberOfPayloads = 0;
|
||||
|
||||
@@ -103,7 +103,7 @@ DRAMSys::DRAMSys(const sc_core::sc_module_name& name,
|
||||
}
|
||||
}
|
||||
|
||||
const Configuration& DRAMSys::getConfig()
|
||||
const Configuration& DRAMSys::getConfig() const
|
||||
{
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
DRAMSys(const sc_core::sc_module_name& name,
|
||||
const ::DRAMSys::Config::Configuration& configLib);
|
||||
|
||||
const Configuration& getConfig();
|
||||
const Configuration& getConfig() const;
|
||||
|
||||
protected:
|
||||
DRAMSys(const sc_core::sc_module_name& name,
|
||||
|
||||
@@ -63,9 +63,6 @@ using namespace tlm;
|
||||
using namespace DRAMPower;
|
||||
#endif
|
||||
|
||||
const sc_core::sc_time Dram::BLOCKING_READ_LATENCY = sc_core::sc_time(60, sc_core::SC_NS);
|
||||
const sc_core::sc_time Dram::BLOCKING_WRITE_LATENCY = sc_core::sc_time(60, sc_core::SC_NS);
|
||||
|
||||
Dram::Dram(const sc_module_name& name, const Configuration& config)
|
||||
: sc_module(name), memSpec(*config.memSpec), tSocket("socket"), storeMode(config.storeMode),
|
||||
powerAnalysis(config.powerAnalysis), useMalloc(config.useMalloc)
|
||||
@@ -212,8 +209,6 @@ void Dram::b_transport(tlm_generic_payload &trans, sc_time &delay)
|
||||
printedWarning = true;
|
||||
}
|
||||
|
||||
delay += trans.is_write() ? BLOCKING_WRITE_LATENCY : BLOCKING_READ_LATENCY;
|
||||
|
||||
if (storeMode == Configuration::StoreMode::Store)
|
||||
{
|
||||
tlm_command cmd = trans.get_command();
|
||||
|
||||
@@ -75,8 +75,6 @@ protected:
|
||||
virtual unsigned int transport_dbg(tlm::tlm_generic_payload& trans);
|
||||
|
||||
public:
|
||||
static const sc_core::sc_time BLOCKING_READ_LATENCY;
|
||||
static const sc_core::sc_time BLOCKING_WRITE_LATENCY;
|
||||
static constexpr std::string_view BLOCKING_WARNING =
|
||||
"Use the blocking mode of DRAMSys with caution! "
|
||||
"The simulated timings do not reflect the real system!";
|
||||
|
||||
Reference in New Issue
Block a user