sc_clock.cc (13297:bd7203a206f6) sc_clock.cc (13324:c8b709468e61)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 21 unchanged lines hidden (view full) ---

30#include "base/logging.hh"
31#include "base/types.hh"
32#include "sim/core.hh"
33#include "sim/eventq.hh"
34#include "systemc/core/kernel.hh"
35#include "systemc/core/process_types.hh"
36#include "systemc/core/sched_event.hh"
37#include "systemc/core/scheduler.hh"
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 21 unchanged lines hidden (view full) ---

30#include "base/logging.hh"
31#include "base/types.hh"
32#include "sim/core.hh"
33#include "sim/eventq.hh"
34#include "systemc/core/kernel.hh"
35#include "systemc/core/process_types.hh"
36#include "systemc/core/sched_event.hh"
37#include "systemc/core/scheduler.hh"
38#include "systemc/ext/channel/messages.hh"
38#include "systemc/ext/channel/sc_clock.hh"
39#include "systemc/ext/core/sc_main.hh"
40#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name
41#include "systemc/ext/utils/sc_report_handler.hh"
42
43namespace sc_gem5
44{
45

--- 62 unchanged lines hidden (view full) ---

108 sc_interface(), sc_signal<bool>(name, posedge_first ? false : true),
109 _period(period), _dutyCycle(duty_cycle), _startTime(start_time),
110 _posedgeFirst(posedge_first)
111{
112 if (period == SC_ZERO_TIME) {
113 std::string msg =
114 "increase the period: clock '" +
115 std::string(name) + "'";
39#include "systemc/ext/channel/sc_clock.hh"
40#include "systemc/ext/core/sc_main.hh"
41#include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name
42#include "systemc/ext/utils/sc_report_handler.hh"
43
44namespace sc_gem5
45{
46

--- 62 unchanged lines hidden (view full) ---

109 sc_interface(), sc_signal<bool>(name, posedge_first ? false : true),
110 _period(period), _dutyCycle(duty_cycle), _startTime(start_time),
111 _posedgeFirst(posedge_first)
112{
113 if (period == SC_ZERO_TIME) {
114 std::string msg =
115 "increase the period: clock '" +
116 std::string(name) + "'";
116 SC_REPORT_ERROR("(E101) sc_clock period is zero", msg.c_str());
117 SC_REPORT_ERROR(SC_ID_CLOCK_PERIOD_ZERO_, msg.c_str());
117 }
118
119 if (duty_cycle * period == SC_ZERO_TIME) {
120 std::string msg =
121 "increase the period or increase the duty cycle: clock '" +
122 std::string(name) + "'";
118 }
119
120 if (duty_cycle * period == SC_ZERO_TIME) {
121 std::string msg =
122 "increase the period or increase the duty cycle: clock '" +
123 std::string(name) + "'";
123 SC_REPORT_ERROR("(E102) sc_clock high time is zero", msg.c_str());
124 SC_REPORT_ERROR(SC_ID_CLOCK_HIGH_TIME_ZERO_, msg.c_str());
124 }
125
126 if (duty_cycle * period == period) {
127 std::string msg =
128 "increase the period or decrease the duty cycle: clock '" +
129 std::string(name) + "'";
125 }
126
127 if (duty_cycle * period == period) {
128 std::string msg =
129 "increase the period or decrease the duty cycle: clock '" +
130 std::string(name) + "'";
130 SC_REPORT_ERROR("(E103) sc_clock low time is zero", msg.c_str());
131 SC_REPORT_ERROR(SC_ID_CLOCK_LOW_TIME_ZERO_, msg.c_str());
131 }
132
133 _gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period);
134 _gem5DownEdge = new ::sc_gem5::ClockTick(this, false, period);
135}
136
137sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu,
138 double duty_cycle) :

--- 61 unchanged lines hidden ---
132 }
133
134 _gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period);
135 _gem5DownEdge = new ::sc_gem5::ClockTick(this, false, period);
136}
137
138sc_clock::sc_clock(const char *name, double period_v, sc_time_unit period_tu,
139 double duty_cycle) :

--- 61 unchanged lines hidden ---