17 #ifndef _SYSC_CLOCK_IF_MIXINS_H_
18 #define _SYSC_CLOCK_IF_MIXINS_H_
22 #include "scml_clock/scml_clock_if.h"
27 template <
typename BASE>
31 public scml_clock_observer
35 sc_core::sc_in<bool> clk_i{
"clk_i"};
41 void end_of_elaboration()
override {
43 if(
auto scml_clk_if = scml2::get_scml_clock(clk_i)) {
44 scml_clk_if->register_observer(
this);
45 handle_clock_parameters_updated(scml_clk_if);
46 BASE::end_of_elaboration();
50 auto clk_if =
dynamic_cast<sc_core::sc_clock*
>(clk_i.get_interface());
51 sc_assert(clk_if !=
nullptr);
52 this->set_clock_period(clk_if->period());
53 BASE::end_of_elaboration();
56 void handle_clock_parameters_updated(scml_clock_if* clk_if)
override { this->set_clock_period(clk_if->get_period()); }
57 void handle_clock_deleted(scml_clock_if*)
override{};
63 sc_core::sc_in<sc_core::sc_time> clk_i;
69 this->sensitive << clk_i;
73 void clock_cb() { this->set_clock_period(clk_i.read()); }