16 #ifndef SC_INCLUDE_DYNAMIC_PROCESSES
17 #define SC_INCLUDE_DYNAMIC_PROCESSES
19 #include "tick2time.h"
20 #include "time2tick.h"
24 #include "scml_clock/scml_clock_if.h"
30 : sc_core::sc_module(nm) {}
32 void tick2time::end_of_elaboration() {
34 if(
auto scml_clk_if = scml2::get_scml_clock(
clk_i)) {
35 scml_clk_if->register_observer(
this);
36 handle_clock_parameters_updated(scml_clk_if);
40 if(
auto clk_if =
dynamic_cast<sc_core::sc_clock*
>(
clk_i.get_interface())) {
41 this->clk_period = clk_if->period();
42 clk_o.write(clk_period);
44 sc_core::sc_spawn_options opts;
45 opts.set_stack_size(0x1000);
49 wait(
clk_i.posedge_event());
50 clk_period = sc_core::sc_time_stamp() - last_tick;
51 clk_o.write(clk_period);
52 last_tick = sc_core::sc_time_stamp();
59 void tick2time::handle_clock_parameters_updated(scml_clock_if* clk_if) {
60 this->clk_period = clk_if->get_period();
61 clk_o.write(clk_period);
63 void tick2time::handle_clock_deleted(scml_clock_if*){};
66 inline void time2tick::clocker() {
68 auto t =
clk_i.read();
69 if(t == sc_core::SC_ZERO_TIME) {
70 wait(
clk_i.value_changed_event());
tick2time(sc_core::sc_module_name nm)
sc_core::sc_out< sc_core::sc_time > clk_o
the clock output
sc_core::sc_in< bool > clk_i
the clock input
sc_core::sc_out< bool > clk_o
the clock output
sc_core::sc_in< sc_core::sc_time > clk_i
the clock input