summaryrefslogtreecommitdiff
path: root/src/systemc/ext/channel/sc_inout.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/ext/channel/sc_inout.hh')
-rw-r--r--src/systemc/ext/channel/sc_inout.hh64
1 files changed, 56 insertions, 8 deletions
diff --git a/src/systemc/ext/channel/sc_inout.hh b/src/systemc/ext/channel/sc_inout.hh
index 54b0ae7da..7f19443d5 100644
--- a/src/systemc/ext/channel/sc_inout.hh
+++ b/src/systemc/ext/channel/sc_inout.hh
@@ -35,8 +35,8 @@
#include "../core/sc_event.hh"
#include "../core/sc_port.hh"
#include "../dt/bit/sc_logic.hh"
+#include "../utils/sc_trace_file.hh"
#include "sc_signal_inout_if.hh"
-#include "warn_unimpl.hh"
namespace sc_dt
{
@@ -111,6 +111,11 @@ class sc_inout : public sc_port<sc_signal_inout_if<T>, 1>
delete initValue;
initValue = nullptr;
}
+
+ for (auto params: traceParamsVec)
+ sc_trace(params->tf, (*this)->read(), params->name);
+
+ traceParamsVec.clear();
}
const T &read() const { return (*this)->read(); }
@@ -159,19 +164,30 @@ class sc_inout : public sc_port<sc_signal_inout_if<T>, 1>
virtual const char *kind() const { return "sc_inout"; }
+ void
+ add_trace(sc_trace_file *tf, const std::string &name) const
+ {
+ traceParamsVec.push_back(new sc_trace_params(tf, name));
+ }
+
private:
T *initValue;
mutable sc_event_finder_t<sc_signal_inout_if<T> > _valueChangedFinder;
+ mutable sc_trace_params_vec traceParamsVec;
+
// Disabled
sc_inout(const sc_inout<T> &);
};
template <class T>
inline void
-sc_trace(sc_trace_file *, const sc_inout<T> &, const std::string &)
+sc_trace(sc_trace_file *tf, const sc_inout<T> &i, const std::string &name)
{
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
+ if (i.size())
+ sc_trace(tf, i->read(), name);
+ else
+ i.add_trace(tf, name);
}
template <>
@@ -259,6 +275,11 @@ class sc_inout<bool> : public sc_port<sc_signal_inout_if<bool>, 1>
delete initValue;
initValue = nullptr;
}
+
+ for (auto params: traceParamsVec)
+ sc_trace(params->tf, (*this)->read(), params->name);
+
+ traceParamsVec.clear();
}
const bool &read() const { return (*this)->read(); }
@@ -314,21 +335,32 @@ class sc_inout<bool> : public sc_port<sc_signal_inout_if<bool>, 1>
virtual const char *kind() const { return "sc_inout"; }
+ void
+ add_trace(sc_trace_file *tf, const std::string &name) const
+ {
+ traceParamsVec.push_back(new sc_trace_params(tf, name));
+ }
+
private:
bool *initValue;
mutable sc_event_finder_t<sc_signal_inout_if<bool> > _valueChangedFinder;
mutable sc_event_finder_t<sc_signal_inout_if<bool> > _posFinder;
mutable sc_event_finder_t<sc_signal_inout_if<bool> > _negFinder;
+ mutable sc_trace_params_vec traceParamsVec;
+
// Disabled
sc_inout(const sc_inout<bool> &);
};
template <>
inline void sc_trace<bool>(
- sc_trace_file *, const sc_inout<bool> &, const std::string &)
+ sc_trace_file *tf, const sc_inout<bool> &i, const std::string &name)
{
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
+ if (i.size())
+ sc_trace(tf, i->read(), name);
+ else
+ i.add_trace(tf, name);
}
template <>
@@ -433,6 +465,11 @@ class sc_inout<sc_dt::sc_logic> :
delete initValue;
initValue = nullptr;
}
+
+ for (auto params: traceParamsVec)
+ sc_trace(params->tf, (*this)->read(), params->name);
+
+ traceParamsVec.clear();
}
const sc_dt::sc_logic &read() const { return (*this)->read(); }
@@ -488,6 +525,12 @@ class sc_inout<sc_dt::sc_logic> :
virtual const char *kind() const { return "sc_inout"; }
+ void
+ add_trace(sc_trace_file *tf, const std::string &name) const
+ {
+ traceParamsVec.push_back(new sc_trace_params(tf, name));
+ }
+
private:
sc_dt::sc_logic *initValue;
mutable sc_event_finder_t<
@@ -495,16 +538,21 @@ class sc_inout<sc_dt::sc_logic> :
mutable sc_event_finder_t<sc_signal_inout_if<sc_dt::sc_logic> > _posFinder;
mutable sc_event_finder_t<sc_signal_inout_if<sc_dt::sc_logic> > _negFinder;
+ mutable sc_trace_params_vec traceParamsVec;
+
// Disabled
sc_inout(const sc_inout<sc_dt::sc_logic> &);
};
template <>
inline void
-sc_trace<sc_dt::sc_logic>(sc_trace_file *, const sc_inout<sc_dt::sc_logic> &,
- const std::string &)
+sc_trace<sc_dt::sc_logic>(sc_trace_file *tf,
+ const sc_inout<sc_dt::sc_logic> &i, const std::string &name)
{
- sc_channel_warn_unimpl(__PRETTY_FUNCTION__);
+ if (i.size())
+ sc_trace(tf, i->read(), name);
+ else
+ i.add_trace(tf, name);
}
} // namespace sc_core