From 842b34107bcb525535c83ab48109c7cd3782fca2 Mon Sep 17 00:00:00 2001 From: Lukas Steiner Date: Tue, 15 Jun 2021 14:26:26 +0200 Subject: [PATCH] Allow positive floats as frequency for traffic initiators. --- DRAMSys/simulator/TraceSetup.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/DRAMSys/simulator/TraceSetup.cpp b/DRAMSys/simulator/TraceSetup.cpp index cff6e372..a9451174 100644 --- a/DRAMSys/simulator/TraceSetup.cpp +++ b/DRAMSys/simulator/TraceSetup.cpp @@ -61,15 +61,11 @@ TraceSetup::TraceSetup(const std::string &uri, if (!value.empty()) { sc_time playerClk; - if (!value["clkMhz"].is_number_unsigned()) - SC_REPORT_FATAL("TraceSetup", "Frequency is not a number."); + if (!value["clkMhz"].is_number() || value["clkMhz"] <= 0) + SC_REPORT_FATAL("TraceSetup", "Frequency is not a positive number."); - unsigned int frequencyMHz = value["clkMhz"]; - - if (frequencyMHz == 0) - SC_REPORT_FATAL("TraceSetup", "Frequency must not be zero."); - else - playerClk = sc_time(1.0 / frequencyMHz, SC_US); + double frequencyMHz = value["clkMhz"]; + playerClk = sc_time(1.0 / frequencyMHz, SC_US); if (!value["name"].is_string()) SC_REPORT_FATAL("TraceSetup", "No trace name defined.");