18 #ifndef SCC_VCD_MT_TRACE_H
19 #define SCC_VCD_MT_TRACE_H
21 #include <scc/observer.h>
22 #include <sysc/tracing/sc_trace.h>
23 #include <sysc/kernel/sc_ver.h>
24 #include <util/thread_pool.h>
49 #define DECL_TRACE_METHOD_A(tp) void trace(const tp& object, const std::string& name) override;
50 #define DECL_TRACE_METHOD_B(tp) void trace(const tp& object, const std::string& name, int width) override;
51 #if (SYSTEMC_VERSION >= 20171012)
52 DECL_TRACE_METHOD_A( sc_core::sc_event )
53 DECL_TRACE_METHOD_A( sc_core::sc_time )
55 DECL_TRACE_METHOD_A(
bool )
56 DECL_TRACE_METHOD_A( sc_dt::sc_bit )
57 DECL_TRACE_METHOD_A( sc_dt::sc_logic )
58 DECL_TRACE_METHOD_B(
unsigned char )
59 DECL_TRACE_METHOD_B(
unsigned short )
60 DECL_TRACE_METHOD_B(
unsigned int )
61 DECL_TRACE_METHOD_B(
unsigned long )
62 #ifdef SYSTEMC_64BIT_PATCHES
63 DECL_TRACE_METHOD_B(
unsigned long long)
65 DECL_TRACE_METHOD_B(
char )
66 DECL_TRACE_METHOD_B(
short )
67 DECL_TRACE_METHOD_B(
int )
68 DECL_TRACE_METHOD_B(
long )
69 DECL_TRACE_METHOD_B( sc_dt::int64 )
70 DECL_TRACE_METHOD_B( sc_dt::uint64 )
71 DECL_TRACE_METHOD_A(
float )
72 DECL_TRACE_METHOD_A(
double )
73 DECL_TRACE_METHOD_A( sc_dt::sc_int_base )
74 DECL_TRACE_METHOD_A( sc_dt::sc_uint_base )
75 DECL_TRACE_METHOD_A( sc_dt::sc_signed )
76 DECL_TRACE_METHOD_A( sc_dt::sc_unsigned )
77 DECL_TRACE_METHOD_A( sc_dt::sc_fxval )
78 DECL_TRACE_METHOD_A( sc_dt::sc_fxval_fast )
79 DECL_TRACE_METHOD_A( sc_dt::sc_fxnum )
80 DECL_TRACE_METHOD_A( sc_dt::sc_fxnum_fast )
81 DECL_TRACE_METHOD_A( sc_dt::sc_bv_base )
82 DECL_TRACE_METHOD_A( sc_dt::sc_lv_base )
83 #undef DECL_TRACE_METHOD_A
84 #undef DECL_TRACE_METHOD_B
86 void trace(
const unsigned int&
object,
87 const std::string& name,
88 const char** enum_literals )
override;
90 #define DECL_REGISTER_METHOD_A(tp) observer::notification_handle* observe(tp const& o, std::string const& nm) override;
91 #if (SYSTEMC_VERSION >= 20171012)
92 DECL_REGISTER_METHOD_A( sc_core::sc_event )
93 DECL_REGISTER_METHOD_A( sc_core::sc_time )
95 DECL_REGISTER_METHOD_A(
bool )
96 DECL_REGISTER_METHOD_A( sc_dt::sc_bit )
97 DECL_REGISTER_METHOD_A( sc_dt::sc_logic )
99 DECL_REGISTER_METHOD_A(
unsigned char )
100 DECL_REGISTER_METHOD_A(
unsigned short )
101 DECL_REGISTER_METHOD_A(
unsigned int )
102 DECL_REGISTER_METHOD_A(
unsigned long )
103 DECL_REGISTER_METHOD_A(
char )
104 DECL_REGISTER_METHOD_A(
short )
105 DECL_REGISTER_METHOD_A(
int )
106 DECL_REGISTER_METHOD_A(
long )
107 DECL_REGISTER_METHOD_A( sc_dt::int64 )
108 DECL_REGISTER_METHOD_A( sc_dt::uint64 )
110 DECL_REGISTER_METHOD_A(
float )
111 DECL_REGISTER_METHOD_A(
double )
112 DECL_REGISTER_METHOD_A( sc_dt::sc_int_base )
113 DECL_REGISTER_METHOD_A( sc_dt::sc_uint_base )
114 DECL_REGISTER_METHOD_A( sc_dt::sc_signed )
115 DECL_REGISTER_METHOD_A( sc_dt::sc_unsigned )
117 DECL_REGISTER_METHOD_A( sc_dt::sc_fxval )
118 DECL_REGISTER_METHOD_A( sc_dt::sc_fxval_fast )
119 DECL_REGISTER_METHOD_A( sc_dt::sc_fxnum )
120 DECL_REGISTER_METHOD_A( sc_dt::sc_fxnum_fast )
122 DECL_REGISTER_METHOD_A( sc_dt::sc_bv_base )
123 DECL_REGISTER_METHOD_A( sc_dt::sc_lv_base )
124 #undef DECL_REGISTER_METHOD_A
127 void write_comment(
const std::string& comment)
override;
130 void cycle(
bool delta_cycle)
override;
132 void set_time_unit(
double v, sc_core::sc_time_unit tu )
override;
134 void set_time_unit(
int exponent10_seconds )
override;
138 #if WITH_SC_TRACING_PHASE_CALLBACKS
140 virtual void trace( sc_trace_file* )
const;
144 std::string prune_name(std::string
const& name);
145 std::string obtain_name();
146 std::function<bool()> check_enabled;
147 std::unique_ptr<trace::gz_writer> vcd_out{
nullptr};
152 bool notify()
override;
154 :compare_and_update{compare_and_update}, trc{trc}, that{owner}{}
155 virtual ~trace_entry(){}
157 std::deque<trace_entry> all_traces;
158 std::vector<trace_entry> active_traces;
159 std::vector<trace::vcd_trace*> changed_traces;
160 std::vector<trace::vcd_trace*> triggered_traces;
161 std::vector<trace::vcd_trace*> record_traces;
162 bool initialized{
false};
163 unsigned vcd_name_index{0};
165 std::future<bool> res;
A handle to be used be the observed object to notify the observer about a change.
The interface defining an observer.