From a88eb938ee95191661118a3af3318951770c39d0 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Mon, 20 Nov 2023 17:45:27 +0100 Subject: [PATCH] update tracer setup --- .cproject | 6 +++--- src/CLIParser.cpp | 2 +- src/sc_main.cpp | 18 ++++++++++++------ 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.cproject b/.cproject index 448b21e..a7806bc 100644 --- a/.cproject +++ b/.cproject @@ -12,7 +12,7 @@ - + @@ -46,13 +46,13 @@ - + - + diff --git a/src/CLIParser.cpp b/src/CLIParser.cpp index 02e81ff..e80ed7d 100644 --- a/src/CLIParser.cpp +++ b/src/CLIParser.cpp @@ -94,7 +94,7 @@ void CLIParser::build() { ("reset,r", po::value(), "reset address") ("trace-level,t", po::value()->default_value(0), - "enable tracing, or combination of 1=signals and 2=TX text, 4=TX compressed text, 6=TX in SQLite") + "enable tracing, or combination of 1=signals and 2=TX") ("trace-default-on", "enables tracing for all unspecified modules") ("trace-file", po::value()->default_value("system"), diff --git a/src/sc_main.cpp b/src/sc_main.cpp index d0d8f6a..acc45ba 100644 --- a/src/sc_main.cpp +++ b/src/sc_main.cpp @@ -67,11 +67,17 @@ int sc_main(int argc, char *argv[]) { /////////////////////////////////////////////////////////////////////////// // set up tracing & transaction recording /////////////////////////////////////////////////////////////////////////// - auto trace_level = parser.get("trace-level"); - scc::configurable_tracer trace(parser.get("trace-file"), - static_cast(trace_level >> 1), // bit3-bit1 define the kind of transaction trace - (trace_level&0x1) != 0, // bit0 enables vcd - parser.is_set("trace-default-on")); + + std::unique_ptr tracer; + if( auto trace_level = parser.get("trace-level")) { + auto file_name = parser.get("trace-file"); + auto enable_sig_trace = (trace_level&0x1) != 0;// bit0 enables sig trace + auto tx_trace_type = static_cast(trace_level >> 1); // bit3-bit1 define the kind of transaction trace + auto trace_default_on = parser.is_set("trace-default-on"); + cfg.set_value("*.tx_trace_type", static_cast(scc::tracer::file_type::FTR)); + cfg.set_value("*.sig_trace_type", static_cast(scc::tracer::file_type::SC_VCD)); + tracer = scc::make_unique(file_name, tx_trace_type, enable_sig_trace, trace_default_on); + } /////////////////////////////////////////////////////////////////////////// // instantiate top level /////////////////////////////////////////////////////////////////////////// @@ -79,7 +85,7 @@ int sc_main(int argc, char *argv[]) { /////////////////////////////////////////////////////////////////////////// // add non-implemented 'enableTracing' properties /////////////////////////////////////////////////////////////////////////// - trace.add_control(); + if(tracer) tracer->add_control(); /////////////////////////////////////////////////////////////////////////// // dump configuration if requested ///////////////////////////////////////////////////////////////////////////