scc  2022.4.0
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 <string>
23 #include <vector>
24 
25 #ifdef HAS_SCV
26 class scv_tr_db;
27 #else
28 namespace scv_tr {
29 class scv_tr_db;
30 }
31 #endif
32 namespace lwtr {
33 class tx_db;
34 }
35 namespace sc_core {
36 class sc_object;
37 class sc_trace_file;
38 } // namespace sc_core
39 
45 namespace scc {
51 class tracer : public tracer_base {
52 public:
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  };
78  cci::cci_param<unsigned> tx_trace_type{"tx_trace_type", CFTR,
79  "Type of TX trace file used for recording. See also scc::tracer::file_type"};
83  cci::cci_param<unsigned> sig_trace_type{"sig_trace_type", FST,
84  "Type of signal trace file used for recording. See also scc::tracer::wave_type"};
88  cci::cci_param<bool> close_db_in_eos{"close_db_in_eos", false,
89  "Close the waveform/transaction tracing databases during end_of_simulation"};
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 
156 protected:
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};
169  cci::cci_broker_handle cci_broker;
170 
171 private:
172  void init_tx_db(file_type type, std::string const&& name);
173  bool owned{false};
174  sc_core::sc_object* top{nullptr};
175 };
176 
177 } /* namespace scc */ // end of scc-sysc
179 #endif /* _SCC_TRACER_H_ */
base class for automatic tracer
Definition: tracer_base.h:78
tracer_base(const sc_core::sc_module_name &nm)
named constructor
Definition: tracer_base.h:86
a component traversing the SystemC object hierarchy and tracing the objects
Definition: tracer.h:51
cci::cci_param< unsigned > sig_trace_type
Definition: tracer.h:83
virtual ~tracer() override
the destructor
Definition: tracer.cpp:89
cci::cci_param< bool > close_db_in_eos
Definition: tracer.h:88
cci::cci_param< unsigned > tx_trace_type
Definition: tracer.h:78
file_type
defines the transaction trace output type
Definition: tracer.h:59
cci::cci_broker_handle cci_broker
the cci broker
Definition: tracer.h:169
SCC SystemC utilities.
SystemC Verification Library (SCV) Transaction Recording.