scc 2025.09
SystemC components library
tracer.h
1/*******************************************************************************
2 * Copyright 2016, 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_TRACER_H_
18#define _SCC_TRACER_H_
19
20#include "tracer_base.h"
21#include <cci_configuration>
22#include <memory>
23#include <string>
24
25#ifdef HAS_SCV
26class scv_tr_db;
27#else
28namespace scv_tr {
29class scv_tr_db;
30}
31#endif
32namespace lwtr {
33class tx_db;
34}
35namespace sc_core {
36class sc_object;
37class sc_trace_file;
38} // namespace sc_core
39
45namespace scc {
51class tracer : public tracer_base {
52public:
59 enum file_type {
60 NONE,
61 ENABLE,
62 TEXT,
63 COMPRESSED,
64 SQLITE,
65 FTR,
66 CFTR,
67 LWFTR,
68 LWCFTR,
69 CUSTOM,
70 SC_VCD = TEXT,
71 PULL_VCD = COMPRESSED,
72 PUSH_VCD = SQLITE,
73 FST
74 };
75
79 cci::cci_param_handle tx_trace_type_handle;
80
84 cci::cci_param_handle sig_trace_type_handle;
85
89 cci::cci_param_handle close_db_in_eos_handle;
98 tracer(std::string const&& name, file_type tx_type, file_type sig_type, sc_core::sc_object* top = nullptr)
99 : tracer(std::move(name), tx_type, sig_type, top, tracer_base::get_name().c_str()) {}
108 tracer(std::string const& name, file_type tx_type = ENABLE, file_type sig_type = ENABLE, sc_core::sc_object* top = nullptr)
109 : tracer(std::string(name), tx_type, sig_type, top) {}
118 tracer(std::string const&& name, file_type type, bool enable = true, sc_core::sc_object* top = nullptr)
119 : tracer(name, type, enable ? ENABLE : NONE, top) {}
128 tracer(std::string const& name, file_type type, bool enable = true, sc_core::sc_object* top = nullptr)
129 : tracer(name, type, enable ? ENABLE : NONE, top) {}
138 tracer(std::string const&& name, file_type type, sc_core::sc_trace_file* tf, sc_core::sc_object* top = nullptr)
139 : tracer(std::move(name), type, tf, top, tracer_base::get_name().c_str()) {}
148 tracer(std::string const& name, file_type type, sc_core::sc_trace_file* tf, sc_core::sc_object* top = nullptr)
149 : tracer(std::string(name), type, tf, top) {}
154 virtual ~tracer() override;
155
156protected:
157 tracer(std::string const&& name, file_type tx_type, file_type sig_type, sc_core::sc_object* top, sc_core::sc_module_name const& nm);
158 tracer(std::string const&& name, file_type type, sc_core::sc_trace_file* tf, sc_core::sc_object* top,
159 sc_core::sc_module_name const& nm);
160 void end_of_elaboration() override;
161 void end_of_simulation() override;
162#ifdef HAS_SCV
163 scv_tr_db* txdb;
164#else
165 scv_tr::scv_tr_db* txdb{nullptr};
166#endif
167 lwtr::tx_db* lwtr_db{nullptr};
168 std::unique_ptr<cci::cci_param<unsigned>> tx_trace_type;
169 std::unique_ptr<cci::cci_param<unsigned>> sig_trace_type;
170 std::unique_ptr<cci::cci_param<bool>> close_db_in_eos;
171
172private:
173 void init_tx_db(file_type type, std::string const&& name);
174 void init_cci_handles();
175 bool owned{false};
176};
177
178} /* namespace scc */ // end of scc-sysc
180#endif /* _SCC_TRACER_H_ */
a component traversing the SystemC object hierarchy and tracing the objects
Definition tracer.h:51
cci::cci_param_handle tx_trace_type_handle
Definition tracer.h:79
file_type
defines the transaction trace output type
Definition tracer.h:59
virtual ~tracer() override
the destructor
Definition tracer.cpp:93
cci::cci_param_handle close_db_in_eos_handle
Definition tracer.h:89
cci::cci_param_handle sig_trace_type_handle
Definition tracer.h:84
SCC TLM utilities.
SystemC Verification Library (SCV) Transaction Recording.
tracer_base(const sc_core::sc_module_name &nm)
named constructor
Definition tracer_base.h:91