Fix the verification of generator parameters

Also, clamp the read write ratio instead of generating an error
This commit is contained in:
2025-01-14 14:55:11 +01:00
parent ce15ce9e6e
commit d71e649447
2 changed files with 4 additions and 6 deletions

View File

@@ -57,13 +57,12 @@ RandomProducer::RandomProducer(uint64_t numRequests,
SC_REPORT_FATAL("TrafficGenerator", "minAddress is out of range.");
if (maxAddress > memorySize - 1)
SC_REPORT_FATAL("TrafficGenerator", "minAddress is out of range.");
SC_REPORT_FATAL("TrafficGenerator", "maxAddress is out of range.");
if (maxAddress < minAddress)
SC_REPORT_FATAL("TrafficGenerator", "maxAddress is smaller than minAddress.");
if (rwRatio < 0 || rwRatio > 1)
SC_REPORT_FATAL("TraceSetup", "Read/Write ratio is not a number between 0 and 1.");
rwRatio = std::clamp(rwRatio, 0.0, 1.0);
}
Request RandomProducer::nextRequest()

View File

@@ -57,13 +57,12 @@ SequentialProducer::SequentialProducer(uint64_t numRequests,
SC_REPORT_FATAL("TrafficGenerator", "minAddress is out of range.");
if (maxAddress > memorySize - 1)
SC_REPORT_FATAL("TrafficGenerator", "minAddress is out of range.");
SC_REPORT_FATAL("TrafficGenerator", "maxAddress is out of range.");
if (maxAddress < minAddress)
SC_REPORT_FATAL("TrafficGenerator", "maxAddress is smaller than minAddress.");
if (rwRatio < 0 || rwRatio > 1)
SC_REPORT_FATAL("TraceSetup", "Read/Write ratio is not a number between 0 and 1.");
rwRatio = std::clamp(rwRatio, 0.0, 1.0);
}
Request SequentialProducer::nextRequest()