scc 2025.09
SystemC components library
configurable_tracer.h
1/*******************************************************************************
2 * Copyright 2017, 2018 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_CONFIGURABLE_TRACER_H_
18#define _SCC_CONFIGURABLE_TRACER_H_
19
20#include "tracer.h"
26namespace scc {
35class configurable_tracer : public tracer {
36public:
45 configurable_tracer(std::string const&& name, bool enable_tx = true, bool enable_vcd = true, sc_core::sc_object* top = nullptr);
54 configurable_tracer(std::string const& name, bool enable_tx = true, bool enable_vcd = true, sc_core::sc_object* top = nullptr)
55 : configurable_tracer(std::string(name), enable_tx, enable_vcd, top) {}
56
64 configurable_tracer(std::string const&& name, file_type type, bool enable_vcd = true, sc_core::sc_object* top = nullptr);
73 configurable_tracer(std::string const& name, file_type type, bool enable_vcd = true, sc_core::sc_object* top = nullptr)
74 : configurable_tracer(std::string(name), type, enable_vcd, top) {}
75
83 configurable_tracer(std::string const&& name, file_type tx_type, file_type sig_type, sc_core::sc_object* top = nullptr);
84 configurable_tracer(std::string const& name, file_type tx_type, file_type sig_type, sc_core::sc_object* top = nullptr)
85 : configurable_tracer(std::string(name), tx_type, sig_type, top) {}
94 configurable_tracer(std::string const&& name, file_type type, sc_core::sc_trace_file* tf = nullptr, sc_core::sc_object* top = nullptr);
103 configurable_tracer(std::string const& name, file_type type, sc_core::sc_trace_file* tf = nullptr, sc_core::sc_object* top = nullptr)
104 : configurable_tracer(std::string(name), type, tf, top) {}
105
112 void add_control() { add_control(default_trace_enable_handle.get_cci_value().get<bool>()); }
118 void add_control(bool trace_default) {
119 if(control_added)
120 return;
121 for(auto* o : sc_core::sc_get_top_level_objects())
122 augment_object_hierarchical(o, trace_default);
123 control_added = true;
124 }
125
126protected:
128 void descend(const sc_core::sc_object*, bool trace_all = false) override;
130 bool get_trace_enabled(const sc_core::sc_object*, bool = false);
132 void augment_object_hierarchical(sc_core::sc_object*, bool);
133
134 void end_of_elaboration() override;
136 std::vector<cci::cci_param_untyped*> params;
137 bool control_added{false};
138};
139
140} /* namespace scc */ // end of scc-sysc
142#endif /* _SCC_CONFIGURABLE_TRACER_H_ */
configurable tracer for automatic port and signal tracing
configurable_tracer(std::string const &name, bool enable_tx=true, bool enable_vcd=true, sc_core::sc_object *top=nullptr)
void add_control(bool trace_default)
configurable_tracer(std::string const &name, file_type type, bool enable_vcd=true, sc_core::sc_object *top=nullptr)
configurable_tracer(std::string const &&name, bool enable_tx=true, bool enable_vcd=true, sc_core::sc_object *top=nullptr)
bool get_trace_enabled(const sc_core::sc_object *, bool=false)
check for existence of 'enableTracing' attribute and return value of default otherwise
void augment_object_hierarchical(sc_core::sc_object *, bool)
add the 'enableTracing' attribute to sc_module
configurable_tracer(std::string const &name, file_type type, sc_core::sc_trace_file *tf=nullptr, sc_core::sc_object *top=nullptr)
void descend(const sc_core::sc_object *, bool trace_all=false) override
depth-first walk thru the design hierarchy and trace signals resp. call trace() function
std::vector< cci::cci_param_untyped * > params
array of created cci parameter
file_type
defines the transaction trace output type
Definition tracer.h:59
SCC TLM utilities.
cci::cci_param_handle default_trace_enable_handle
Definition tracer_base.h:84