scc 2025.09
SystemC components library
tracer_base.h
1/*******************************************************************************
2 * Copyright 2019 MINRES Technologies GmbH
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *******************************************************************************/
16
17#ifndef _SCC_TRACER_BASE_H_
18#define _SCC_TRACER_BASE_H_
19
20#include "utilities.h"
21#include <cci_configuration>
22#include <sysc/tracing/sc_trace.h>
23#include <type_traits>
24
30namespace scc {
36enum class trace_types : unsigned {
37 NONE = 0x0,
38 SIGNALS = 0x1,
39 PORTS = 0x2,
40 SOCKETS = 0x4,
41 VARIABLES = 0x8,
42 ALL = 0xff
43};
44
53 return static_cast<trace_types>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs));
54}
55
64 return static_cast<trace_types>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs));
65}
66
80struct tracer_base : public sc_core::sc_module {
84 cci::cci_param_handle default_trace_enable_handle;
91 tracer_base(const sc_core::sc_module_name& nm)
92 : tracer_base(nm, nullptr, false) {}
93
101 tracer_base(const sc_core::sc_module_name& nm, sc_core::sc_trace_file* tf, bool owned = true);
114 void set_trace_types(trace_types t) { types_to_trace = t; }
121 const sc_core::sc_trace_file* get_trace_file() const { return trf; }
128 sc_core::sc_trace_file* get_trace_file() { return trf; }
136 void set_trace_file(sc_core::sc_trace_file* trf) { this->trf = trf; }
137
138 static void set_default_trace_enable(bool);
139
140 static bool get_default_trace_enable();
141
142protected:
143 static std::string get_name();
144
145 virtual void descend(const sc_core::sc_object*, bool trace_all);
146
147 static void try_trace(sc_core::sc_trace_file* trace_file, const sc_core::sc_object* object, trace_types t);
148
149 sc_core::sc_trace_file* trf{nullptr};
150
151 trace_types types_to_trace{trace_types::ALL};
152
156 cci::cci_broker_handle cci_broker;
157
158 std::unique_ptr<cci::cci_param<bool>> default_trace_enable;
159};
160
161} // namespace scc // end of scc-sysc
163#endif /* _SCC_TRACER_BASE_H_ */
SCC TLM utilities.
trace_types
identifies the various type to be traced
Definition tracer_base.h:36
trace_types operator&(trace_types lhs, trace_types rhs)
operator overload to allow boolean and operations on trace_types
Definition tracer_base.h:63
trace_types operator|(trace_types lhs, trace_types rhs)
operator overload to allow boolean or operations on trace_types
Definition tracer_base.h:52
const sc_core::sc_trace_file * get_trace_file() const
get the tracefile used by this tracer
cci::cci_param_handle default_trace_enable_handle
Definition tracer_base.h:84
void set_trace_file(sc_core::sc_trace_file *trf)
set the trace file of this tracer
tracer_base(const sc_core::sc_module_name &nm)
named constructor
Definition tracer_base.h:91
cci::cci_broker_handle cci_broker
void set_trace_types(trace_types t)
set the types to trace
~tracer_base()
destructor