Allow positive floats as frequency for traffic initiators.

This commit is contained in:
Lukas Steiner
2021-06-15 14:26:26 +02:00
parent b0a4356874
commit 842b34107b

View File

@@ -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.");