17 #ifndef _SCC_SC_CLOCK_EXT_H_
18 #define _SCC_SC_CLOCK_EXT_H_
20 #include <cci_configuration>
21 #include <sysc/communication/sc_clock.h>
34 cci::cci_param<sc_core::sc_time> period;
35 cci::cci_param<double> duty_cycle;
36 cci::cci_param<sc_core::sc_time> initial_delay;
38 sc_clock_ext(
const char* name_,
const sc_core::sc_time& period_,
double duty_cycle_ = 0.5,
39 const sc_core::sc_time& start_time_ = sc_core::SC_ZERO_TIME,
bool posedge_first_ =
true)
40 : sc_core::sc_clock(name_, period_, duty_cycle_, start_time_, posedge_first_)
41 , period(get_cci_name(name_,
"period"), period_,
"The period of the generated clock")
42 , duty_cycle(get_cci_name(name_,
"duty_cycle"), duty_cycle_,
"The duty cycle of the generated clock")
43 , initial_delay(get_cci_name(name_,
"start_time"), start_time_,
"The start time of the generated clock") {
50 void end_of_elaboration()
override {
51 init(period.get_value(), duty_cycle.get_value(), initial_delay.get_value(), m_posedge_first);
52 if(initial_delay.get_value() != m_start_time) {
54 m_next_posedge_event.cancel();
55 m_next_posedge_event.notify(initial_delay.get_value());
57 m_next_negedge_event.cancel();
58 m_next_negedge_event.notify(initial_delay.get_value());
62 void period_write_callback(
const cci::cci_param_write_event<int>& ev) {}
63 static inline std::string get_cci_name(
const char* base,
const char* name) {
return std::string(base) +
"_" + name; }
A clock source with construction time configurable start delay.