Make dataLength parameter required for initiators
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 800,
|
||||
"dataLength": 64,
|
||||
"name": "traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 200,
|
||||
"dataLength": 64,
|
||||
"name": "traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -212,6 +212,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 200,
|
||||
"dataLength": 64,
|
||||
"name": "traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1000,
|
||||
"dataLength": 32,
|
||||
"name": "traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 200,
|
||||
"dataLength": 32,
|
||||
"name": "traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 800,
|
||||
"dataLength": 64,
|
||||
"name": "traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 2000,
|
||||
"dataLength": 64,
|
||||
"name": "../../configs/traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"tracesetup": [
|
||||
{
|
||||
"clkMhz": 2000,
|
||||
"dataLength": 64,
|
||||
"type": "generator",
|
||||
"name": "gen0",
|
||||
"numRequests": 2000,
|
||||
@@ -19,6 +20,7 @@
|
||||
},
|
||||
{
|
||||
"clkMhz": 2000,
|
||||
"dataLength": 64,
|
||||
"type": "generator",
|
||||
"name": "gen1",
|
||||
"numRequests": 2000,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"tracesetup": [
|
||||
{
|
||||
"clkMhz": 2000,
|
||||
"dataLength": 32,
|
||||
"type": "generator",
|
||||
"name": "gen0",
|
||||
"numRequests": 2000,
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 200,
|
||||
"dataLength": 32,
|
||||
"name": "../../configs/traces/example.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -79,12 +79,13 @@ struct TracePlayer
|
||||
|
||||
uint64_t clkMhz{};
|
||||
std::string name;
|
||||
unsigned dataLength;
|
||||
std::optional<unsigned int> maxPendingReadRequests;
|
||||
std::optional<unsigned int> maxPendingWriteRequests;
|
||||
};
|
||||
|
||||
NLOHMANN_JSONIFY_ALL_THINGS(
|
||||
TracePlayer, clkMhz, name, maxPendingReadRequests, maxPendingWriteRequests)
|
||||
TracePlayer, clkMhz, name, dataLength, maxPendingReadRequests, maxPendingWriteRequests)
|
||||
|
||||
struct TrafficGeneratorActiveState
|
||||
{
|
||||
@@ -136,7 +137,7 @@ struct TrafficGenerator
|
||||
|
||||
std::optional<uint64_t> seed;
|
||||
std::optional<uint64_t> maxTransactions;
|
||||
std::optional<unsigned> dataLength;
|
||||
unsigned dataLength;
|
||||
std::optional<unsigned> dataAlignment;
|
||||
|
||||
uint64_t numRequests{};
|
||||
@@ -174,7 +175,7 @@ struct TrafficGeneratorStateMachine
|
||||
|
||||
std::optional<uint64_t> seed;
|
||||
std::optional<uint64_t> maxTransactions;
|
||||
std::optional<unsigned> dataLength;
|
||||
unsigned dataLength;
|
||||
std::optional<unsigned> dataAlignment;
|
||||
std::vector<std::variant<TrafficGeneratorActiveState, TrafficGeneratorIdleState>> states;
|
||||
std::vector<TrafficGeneratorStateTransition> transitions;
|
||||
@@ -200,7 +201,8 @@ struct RowHammer
|
||||
std::string name;
|
||||
std::optional<unsigned int> maxPendingReadRequests;
|
||||
std::optional<unsigned int> maxPendingWriteRequests;
|
||||
|
||||
|
||||
unsigned dataLength;
|
||||
uint64_t numRequests{};
|
||||
uint64_t rowIncrement{};
|
||||
};
|
||||
@@ -210,6 +212,7 @@ NLOHMANN_JSONIFY_ALL_THINGS(RowHammer,
|
||||
name,
|
||||
maxPendingReadRequests,
|
||||
maxPendingWriteRequests,
|
||||
dataLength,
|
||||
numRequests,
|
||||
rowIncrement)
|
||||
|
||||
|
||||
@@ -85,7 +85,6 @@ Simulator::instantiateInitiator(const DRAMSys::Config::Initiator& initiator)
|
||||
{
|
||||
uint64_t memorySize = dramSys->getMemSpec().getSimMemSizeInBytes();
|
||||
sc_core::sc_time interfaceClk = dramSys->getMemSpec().tCK;
|
||||
unsigned int defaultDataLength = dramSys->getMemSpec().defaultBytesPerBurst;
|
||||
|
||||
return std::visit(
|
||||
[=](auto&& config) -> std::unique_ptr<RequestIssuer>
|
||||
@@ -94,8 +93,7 @@ Simulator::instantiateInitiator(const DRAMSys::Config::Initiator& initiator)
|
||||
if constexpr (std::is_same_v<T, DRAMSys::Config::TrafficGenerator> ||
|
||||
std::is_same_v<T, DRAMSys::Config::TrafficGeneratorStateMachine>)
|
||||
{
|
||||
auto generator =
|
||||
std::make_unique<TrafficGenerator>(config, memorySize, defaultDataLength);
|
||||
auto generator = std::make_unique<TrafficGenerator>(config, memorySize);
|
||||
|
||||
return std::make_unique<RequestIssuer>(config.name.c_str(),
|
||||
std::move(generator),
|
||||
@@ -124,11 +122,8 @@ Simulator::instantiateInitiator(const DRAMSys::Config::Initiator& initiator)
|
||||
SC_REPORT_FATAL("Simulator", report.c_str());
|
||||
}
|
||||
|
||||
auto player = std::make_unique<StlPlayer>(tracePath.c_str(),
|
||||
config.clkMhz,
|
||||
defaultDataLength,
|
||||
*traceType,
|
||||
storageEnabled);
|
||||
auto player = std::make_unique<StlPlayer>(
|
||||
config, tracePath.c_str(), *traceType, storageEnabled);
|
||||
|
||||
return std::make_unique<RequestIssuer>(config.name.c_str(),
|
||||
std::move(player),
|
||||
@@ -141,7 +136,7 @@ Simulator::instantiateInitiator(const DRAMSys::Config::Initiator& initiator)
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, DRAMSys::Config::RowHammer>)
|
||||
{
|
||||
auto hammer = std::make_unique<RowHammer>(config, defaultDataLength);
|
||||
auto hammer = std::make_unique<RowHammer>(config);
|
||||
|
||||
return std::make_unique<RequestIssuer>(config.name.c_str(),
|
||||
std::move(hammer),
|
||||
|
||||
@@ -39,12 +39,11 @@
|
||||
#include "SequentialState.h"
|
||||
|
||||
TrafficGenerator::TrafficGenerator(DRAMSys::Config::TrafficGeneratorStateMachine const& config,
|
||||
uint64_t memorySize,
|
||||
unsigned int defaultDataLength) :
|
||||
uint64_t memorySize) :
|
||||
stateTransistions(config.transitions),
|
||||
generatorPeriod(sc_core::sc_time(1.0 / static_cast<double>(config.clkMhz), sc_core::SC_US))
|
||||
{
|
||||
unsigned int dataLength = config.dataLength.value_or(defaultDataLength);
|
||||
unsigned int dataLength = config.dataLength;
|
||||
unsigned int dataAlignment = config.dataAlignment.value_or(dataLength);
|
||||
|
||||
for (auto const& state : config.states)
|
||||
@@ -62,13 +61,13 @@ TrafficGenerator::TrafficGenerator(DRAMSys::Config::TrafficGeneratorStateMachine
|
||||
DRAMSys::Config::AddressDistribution::Random)
|
||||
{
|
||||
auto producer = std::make_unique<RandomState>(activeState.numRequests,
|
||||
config.seed.value_or(0),
|
||||
activeState.rwRatio,
|
||||
activeState.minAddress,
|
||||
activeState.maxAddress,
|
||||
memorySize,
|
||||
dataLength,
|
||||
dataAlignment);
|
||||
config.seed.value_or(0),
|
||||
activeState.rwRatio,
|
||||
activeState.minAddress,
|
||||
activeState.maxAddress,
|
||||
memorySize,
|
||||
dataLength,
|
||||
dataAlignment);
|
||||
|
||||
producers.emplace(activeState.id, std::move(producer));
|
||||
}
|
||||
@@ -76,13 +75,13 @@ TrafficGenerator::TrafficGenerator(DRAMSys::Config::TrafficGeneratorStateMachine
|
||||
{
|
||||
auto producer =
|
||||
std::make_unique<SequentialState>(activeState.numRequests,
|
||||
config.seed.value_or(0),
|
||||
activeState.rwRatio,
|
||||
activeState.addressIncrement,
|
||||
activeState.minAddress,
|
||||
activeState.maxAddress,
|
||||
memorySize,
|
||||
dataLength);
|
||||
config.seed.value_or(0),
|
||||
activeState.rwRatio,
|
||||
activeState.addressIncrement,
|
||||
activeState.minAddress,
|
||||
activeState.maxAddress,
|
||||
memorySize,
|
||||
dataLength);
|
||||
|
||||
producers.emplace(activeState.id, std::move(producer));
|
||||
}
|
||||
@@ -98,35 +97,34 @@ TrafficGenerator::TrafficGenerator(DRAMSys::Config::TrafficGeneratorStateMachine
|
||||
}
|
||||
|
||||
TrafficGenerator::TrafficGenerator(DRAMSys::Config::TrafficGenerator const& config,
|
||||
uint64_t memorySize,
|
||||
unsigned int defaultDataLength) :
|
||||
uint64_t memorySize) :
|
||||
generatorPeriod(sc_core::sc_time(1.0 / static_cast<double>(config.clkMhz), sc_core::SC_US))
|
||||
{
|
||||
unsigned int dataLength = config.dataLength.value_or(defaultDataLength);
|
||||
unsigned int dataLength = config.dataLength;
|
||||
unsigned int dataAlignment = config.dataAlignment.value_or(dataLength);
|
||||
|
||||
if (config.addressDistribution == DRAMSys::Config::AddressDistribution::Random)
|
||||
{
|
||||
auto producer = std::make_unique<RandomState>(config.numRequests,
|
||||
config.seed.value_or(0),
|
||||
config.rwRatio,
|
||||
config.minAddress,
|
||||
config.maxAddress,
|
||||
memorySize,
|
||||
dataLength,
|
||||
dataAlignment);
|
||||
config.seed.value_or(0),
|
||||
config.rwRatio,
|
||||
config.minAddress,
|
||||
config.maxAddress,
|
||||
memorySize,
|
||||
dataLength,
|
||||
dataAlignment);
|
||||
producers.emplace(0, std::move(producer));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto producer = std::make_unique<SequentialState>(config.numRequests,
|
||||
config.seed.value_or(0),
|
||||
config.rwRatio,
|
||||
config.addressIncrement,
|
||||
config.minAddress,
|
||||
config.maxAddress,
|
||||
memorySize,
|
||||
dataLength);
|
||||
config.seed.value_or(0),
|
||||
config.rwRatio,
|
||||
config.addressIncrement,
|
||||
config.minAddress,
|
||||
config.maxAddress,
|
||||
memorySize,
|
||||
dataLength);
|
||||
producers.emplace(0, std::move(producer));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,13 +47,10 @@ class RequestProducer;
|
||||
class TrafficGenerator : public RequestProducer
|
||||
{
|
||||
public:
|
||||
TrafficGenerator(DRAMSys::Config::TrafficGenerator const& config,
|
||||
uint64_t memorySize,
|
||||
unsigned int defaultDataLength);
|
||||
TrafficGenerator(DRAMSys::Config::TrafficGenerator const& config, uint64_t memorySize);
|
||||
|
||||
TrafficGenerator(DRAMSys::Config::TrafficGeneratorStateMachine const& config,
|
||||
uint64_t memorySize,
|
||||
unsigned int defaultDataLength);
|
||||
uint64_t memorySize);
|
||||
|
||||
uint64_t totalRequests() override;
|
||||
Request nextRequest() override;
|
||||
|
||||
@@ -35,11 +35,11 @@
|
||||
|
||||
#include "RowHammer.h"
|
||||
|
||||
RowHammer::RowHammer(DRAMSys::Config::RowHammer const& config, unsigned int dataLength) :
|
||||
RowHammer::RowHammer(DRAMSys::Config::RowHammer const& config) :
|
||||
generatorPeriod(sc_core::sc_time(1.0 / static_cast<double>(config.clkMhz), sc_core::SC_US)),
|
||||
numberOfRequests(config.numRequests),
|
||||
rowIncrement(config.rowIncrement),
|
||||
dataLength(dataLength)
|
||||
dataLength(config.dataLength)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
class RowHammer : public RequestProducer
|
||||
{
|
||||
public:
|
||||
RowHammer(DRAMSys::Config::RowHammer const& config, unsigned int dataLength);
|
||||
RowHammer(DRAMSys::Config::RowHammer const& config);
|
||||
|
||||
Request nextRequest() override;
|
||||
sc_core::sc_time nextTrigger() override { return generatorPeriod; }
|
||||
|
||||
@@ -44,15 +44,14 @@
|
||||
|
||||
static constexpr std::size_t LINE_BUFFER_SIZE = 10000;
|
||||
|
||||
StlPlayer::StlPlayer(std::filesystem::path const& trace,
|
||||
unsigned int clkMhz,
|
||||
unsigned int defaultDataLength,
|
||||
StlPlayer::StlPlayer(DRAMSys::Config::TracePlayer const& config,
|
||||
std::filesystem::path const& trace,
|
||||
TraceType traceType,
|
||||
bool storageEnabled) :
|
||||
traceType(traceType),
|
||||
storageEnabled(storageEnabled),
|
||||
playerPeriod(sc_core::sc_time(1.0 / static_cast<double>(clkMhz), sc_core::SC_US)),
|
||||
defaultDataLength(defaultDataLength),
|
||||
playerPeriod(sc_core::sc_time(1.0 / static_cast<double>(config.clkMhz), sc_core::SC_US)),
|
||||
defaultDataLength(config.dataLength),
|
||||
traceFile(trace)
|
||||
{
|
||||
if (!traceFile.is_open())
|
||||
|
||||
@@ -42,6 +42,8 @@
|
||||
|
||||
#include "simulator/request/RequestProducer.h"
|
||||
|
||||
#include <DRAMSys/config/TraceSetup.h>
|
||||
|
||||
#include <systemc>
|
||||
#include <tlm>
|
||||
|
||||
@@ -61,9 +63,8 @@ public:
|
||||
Relative,
|
||||
};
|
||||
|
||||
StlPlayer(std::filesystem::path const& trace,
|
||||
unsigned int clkMhz,
|
||||
unsigned int defaultDataLength,
|
||||
StlPlayer(DRAMSys::Config::TracePlayer const& config,
|
||||
std::filesystem::path const& trace,
|
||||
TraceType traceType,
|
||||
bool storageEnabled);
|
||||
|
||||
|
||||
@@ -215,6 +215,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"name": "mytrace.stl"
|
||||
},
|
||||
{
|
||||
@@ -222,12 +223,14 @@
|
||||
"addressDistribution": "random",
|
||||
"clkMhz": 100,
|
||||
"name": "MyTestGen",
|
||||
"dataLength": 64,
|
||||
"numRequests": 1000,
|
||||
"rwRatio": 0.5
|
||||
},
|
||||
{
|
||||
"type": "statemachine",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"maxPendingReadRequests": 8,
|
||||
"name": "MyTestGen",
|
||||
"states": [
|
||||
@@ -260,6 +263,7 @@
|
||||
{
|
||||
"type": "rowhammer",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"name": "MyTestHammer",
|
||||
"numRequests": 4000,
|
||||
"rowIncrement": 2097152
|
||||
|
||||
@@ -318,6 +318,7 @@ DRAMSys::Config::TracePlayer ConfigurationTest::createTracePlayer()
|
||||
{
|
||||
DRAMSys::Config::TracePlayer player;
|
||||
player.clkMhz = 100;
|
||||
player.dataLength = 64;
|
||||
player.name = "mytrace.stl";
|
||||
|
||||
return player;
|
||||
@@ -327,6 +328,7 @@ DRAMSys::Config::TrafficGenerator ConfigurationTest::createTraceGeneratorOneStat
|
||||
{
|
||||
DRAMSys::Config::TrafficGenerator gen;
|
||||
gen.clkMhz = 100;
|
||||
gen.dataLength = 64;
|
||||
gen.name = "MyTestGen";
|
||||
|
||||
gen.numRequests = 1000;
|
||||
@@ -345,6 +347,7 @@ ConfigurationTest::createTraceGeneratorMultipleStates()
|
||||
DRAMSys::Config::TrafficGeneratorStateMachine gen;
|
||||
|
||||
gen.clkMhz = 100;
|
||||
gen.dataLength = 64;
|
||||
gen.name = "MyTestGen";
|
||||
gen.maxPendingReadRequests = 8;
|
||||
|
||||
@@ -381,6 +384,7 @@ DRAMSys::Config::RowHammer ConfigurationTest::createTraceHammer()
|
||||
DRAMSys::Config::RowHammer hammer;
|
||||
|
||||
hammer.clkMhz = 100;
|
||||
hammer.dataLength = 64;
|
||||
hammer.name = "MyTestHammer";
|
||||
hammer.numRequests = 4000;
|
||||
hammer.rowIncrement = 2097152;
|
||||
@@ -720,12 +724,14 @@ TEST_F(ConfigurationTest, TraceSetup)
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"name": "mytrace.stl"
|
||||
},
|
||||
{
|
||||
"type": "generator",
|
||||
"addressDistribution": "random",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"name": "MyTestGen",
|
||||
"numRequests": 1000,
|
||||
"rwRatio": 0.5
|
||||
@@ -733,6 +739,7 @@ TEST_F(ConfigurationTest, TraceSetup)
|
||||
{
|
||||
"type": "statemachine",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"maxPendingReadRequests": 8,
|
||||
"name": "MyTestGen",
|
||||
"states": [
|
||||
@@ -765,6 +772,7 @@ TEST_F(ConfigurationTest, TraceSetup)
|
||||
{
|
||||
"type": "rowhammer",
|
||||
"clkMhz": 100,
|
||||
"dataLength": 64,
|
||||
"name": "MyTestHammer",
|
||||
"numRequests": 4000,
|
||||
"rowIncrement": 2097152
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 533,
|
||||
"dataLength": 64,
|
||||
"name": "traces/trace_test2.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -213,6 +213,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 933,
|
||||
"dataLength": 64,
|
||||
"name": "traces/trace_test3.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -220,6 +220,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1600,
|
||||
"dataLength": 64,
|
||||
"name": "traces/trace_test3.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -128,11 +128,13 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1000,
|
||||
"dataLength": 64,
|
||||
"name": "traces/trace1_test4.stl"
|
||||
},
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1000,
|
||||
"dataLength": 64,
|
||||
"name": "traces/trace2_test4.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -131,11 +131,13 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1600,
|
||||
"dataLength": 32,
|
||||
"name": "traces/trace1_test4.stl"
|
||||
},
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1600,
|
||||
"dataLength": 32,
|
||||
"name": "traces/trace2_test4.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -183,6 +183,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1600,
|
||||
"dataLength": 32,
|
||||
"name": "traces/trace_lpddr4.stl"
|
||||
}
|
||||
]
|
||||
|
||||
@@ -205,6 +205,7 @@
|
||||
{
|
||||
"type": "player",
|
||||
"clkMhz": 1600,
|
||||
"dataLength": 32,
|
||||
"name": "traces/trace_lpddr5.stl"
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user