#include "systemc/ext/channel/sc_clock.hh"
#include "systemc/ext/core/sc_main.hh"
#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name
+#include "systemc/ext/utils/sc_report_handler.hh"
namespace sc_gem5
{
_period(period), _dutyCycle(duty_cycle), _startTime(start_time),
_posedgeFirst(posedge_first)
{
+ if (period == SC_ZERO_TIME) {
+ std::string msg =
+ "increase the period: clock '" +
+ std::string(name) + "'";
+ SC_REPORT_ERROR("(E101) sc_clock period is zero", msg.c_str());
+ }
+
+ if (duty_cycle * period == SC_ZERO_TIME) {
+ std::string msg =
+ "increase the period or increase the duty cycle: clock '" +
+ std::string(name) + "'";
+ SC_REPORT_ERROR("(E102) sc_clock high time is zero", msg.c_str());
+ }
+
+ if (duty_cycle * period == period) {
+ std::string msg =
+ "increase the period or decrease the duty cycle: clock '" +
+ std::string(name) + "'";
+ SC_REPORT_ERROR("(E103) sc_clock low time is zero", msg.c_str());
+ }
+
_gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period);
_gem5DownEdge = new ::sc_gem5::ClockTick(this, false, period);
}