24 using Iface = sc_core::sc_signal_inout_if<T>;
25 using ValueChangedCallback = std::function<
void(
const T&)>;
31 ValueChangedCallback m_cb;
32 sc_core::sc_event m_ev;
37 void register_value_changed_cb(
const ValueChangedCallback&
cb) { m_cb =
cb; }
41 void notify() { m_ev.notify(); }
46 virtual const sc_core::sc_event& default_event()
const {
return m_ev; }
48 virtual const sc_core::sc_event& value_changed_event()
const {
return m_ev; }
50 virtual const T& read()
const {
return m_val; }
52 virtual const T& get_data_ref()
const {
return m_val; }
54 virtual bool event()
const
62 virtual void write(
const T&
val)
82 using Iface = sc_core::sc_signal_inout_if<bool>;
83 using ValueChangedCallback = std::function<
void(
const bool&)>;
89 ValueChangedCallback m_cb;
90 sc_core::sc_event m_ev;
91 sc_core::sc_event m_posedge_ev;
92 sc_core::sc_event m_negedge_ev;
96 : m_parent{ parent }, m_val{
false }, m_cb{
nullptr }, m_ev{}
100 void register_value_changed_cb(
const ValueChangedCallback&
cb) { m_cb =
cb; }
104 void notify() { m_ev.notify(); }
109 virtual const sc_core::sc_event& default_event()
const {
return m_ev; }
111 virtual const sc_core::sc_event& value_changed_event()
const {
return m_ev; }
113 virtual const sc_core::sc_event& posedge_event()
const {
return m_posedge_ev; }
115 virtual const sc_core::sc_event& negedge_event()
const {
return m_negedge_ev; }
117 virtual const bool& read()
const {
return m_val; }
119 virtual const bool& get_data_ref()
const {
return m_val; }
121 virtual bool event()
const
128 virtual bool posedge()
const
135 virtual bool negedge()
const
143 virtual void write(
const bool&
val)
154 val ? m_posedge_ev.notify() : m_negedge_ev.notify();
165 using Iface =
typename TargetSignalSocketProxy<T>::Iface;
166 using Parent = sc_core::sc_export<Iface>;
167 using ValueChangedCallback =
typename TargetSignalSocketProxy<T>::ValueChangedCallback;
173 TargetSignalSocket(
const char* name): Parent(name), m_proxy(*
this) { Parent::bind(m_proxy); }
175 void register_value_changed_cb(
const ValueChangedCallback&
cb) { m_proxy.register_value_changed_cb(
cb); }
177 const T& read()
const {
return m_proxy.read(); }