25 #include "sc_vcd_trace.h"
26 #include "scv/scv_tr_db.h"
27 #include "utilities.h"
28 #include <scc/sc_vcd_trace.h>
29 #include <scc/trace.h>
38 #define SCVNS ::scv_tr::
43 #include <lwtr/lwtr.h>
46 using namespace sc_core;
49 tracer::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)
54 , owned{sig_type != NONE} {
55 if(sig_type == ENABLE)
56 sig_type =
static_cast<file_type
>(sig_trace_type.get_value());
57 if(sig_type != NONE) {
60 trf = sc_create_vcd_trace_file(name.c_str());
74 trf->set_time_unit(1, SC_PS);
75 init_tx_db(tx_type == ENABLE ?
static_cast<file_type
>(tx_trace_type.get_value()) : tx_type, std::move(name));
78 tracer::tracer(std::string
const&& name, file_type tx_type, sc_core::sc_trace_file* tf, sc_core::sc_object* top,
79 sc_core::sc_module_name
const& nm)
86 init_tx_db(tx_type == ENABLE ?
static_cast<file_type
>(tx_trace_type.get_value()) : tx_type, std::move(name));
93 scc_close_vcd_trace_file(trf);
96 void tracer::init_tx_db(file_type type, std::string
const&& name) {
102 SCVNS scv_tr_text_init();
106 auto* val = getenv(
"SCC_SCV_TR_COMPRESSION_LEVEL");
107 auto level = val ? atoi(val) : std::numeric_limits<unsigned>::max();
110 SCVNS scv_tr_plain_init();
113 SCVNS scv_tr_compressed_init();
116 SCVNS scv_tr_lz4_init();
128 SCVNS scv_tr_cbor_init(
false);
131 SCVNS scv_tr_cbor_init(
true);
134 lwtr::tx_ftr_init(
false);
137 lwtr::tx_ftr_init(
true);
144 if(type == LWFTR || type == LWCFTR) {
145 lwtr_db =
new lwtr::tx_db(name.c_str());
147 txdb =
new SCVNS scv_tr_db(ss.str().c_str());
150 trf->write_comment(std::string(
"TXREC: ") + ss.str());
155 void tracer::end_of_elaboration() {
160 for(
auto o : sc_get_top_level_objects())
166 void tracer::end_of_simulation() {
173 scc_close_vcd_trace_file(trf);
base class for automatic tracer
bool default_trace_enable
the default for tracing if no attribute is configured
cci::cci_param< bool > close_db_in_eos
sc_core::sc_trace_file * create_fst_trace_file(const char *name, std::function< bool()> enable)
create FST file which uses pull mechanism
sc_core::sc_trace_file * create_vcd_pull_trace_file(const char *name, std::function< bool()> enable=std::function< bool()>())
create VCD file which uses pull mechanism
sc_core::sc_trace_file * create_vcd_push_trace_file(const char *name, std::function< bool()> enable=std::function< bool()>())
create VCD file which uses push mechanism
void scv_tr_mtc_init()
initializes the infrastructure to use a compressed text based transaction recording database with a m...
void scv_tr_sqlite_init()
initializes the infrastructure to use a SQLite based transaction recording database