17#include "configurable_tracer.h"
20using namespace sc_core;
23#define EN_TRACING_STR "enableTracing"
26: tracer(std::move(name), enable_tx ? ENABLE : NONE, enable_vcd ? ENABLE : NONE, top) {}
29: tracer(std::move(name), type, enable_vcd ? ENABLE : NONE, top) {}
32: tracer(std::move(name), tx_type, sig_type, top) {}
35: tracer(std::move(name), type, tf, top) {}
46 const std::string kind = obj->kind();
51 }
else if(kind ==
"sc_vector") {
53 for(
auto o : obj->get_child_objects())
56 }
else if(kind ==
"sc_module") {
60 for(
auto o : obj->get_child_objects())
62 }
else if(kind ==
"sc_variable") {
65 }
else if(kind ==
"sc_signal" || kind ==
"sc_clock" || kind ==
"sc_buffer" || kind ==
"sc_signal_rv") {
67 try_trace(trf, obj, types_to_trace);
68 }
else if(kind ==
"sc_in" || kind ==
"sc_out" || kind ==
"sc_inout") {
70 try_trace(trf, obj, types_to_trace);
71 }
else if(
const auto* tr =
dynamic_cast<const scc::traceable*
>(obj)) {
72 if(tr->is_trace_enabled())
74 for(
auto o : obj->get_child_objects())
75 descend(o, tr->is_trace_enabled());
82 auto* attr = obj->get_attribute(EN_TRACING_STR);
83 if(attr !=
nullptr &&
dynamic_cast<const sc_core::sc_attribute<bool>*
>(attr) !=
nullptr) {
84 const auto* a =
dynamic_cast<const sc_core::sc_attribute<bool>*
>(attr);
87 std::string hier_name{obj->name()};
88 auto h =
cci_broker.get_param_handle(hier_name.append(
"." EN_TRACING_STR));
90 return h.get_cci_value().get_bool();
96 if(
dynamic_cast<sc_core::sc_module*
>(obj) !=
nullptr ||
dynamic_cast<scc::traceable*
>(obj) !=
nullptr) {
97 auto* attr = obj->get_attribute(EN_TRACING_STR);
98 if(attr ==
nullptr ||
dynamic_cast<const sc_core::sc_attribute<bool>*
>(attr) ==
nullptr) {
99 std::string hier_name{obj->name()};
100 if(hier_name.substr(0, 3) !=
"$$$") {
101 hier_name +=
"." EN_TRACING_STR;
102 auto h =
cci_broker.get_param_handle(hier_name);
104 params.push_back(
new cci::cci_param<bool>(hier_name, trace_enable,
cci_broker,
105 "Enables the signal tracing of this module", cci::CCI_ABSOLUTE_NAME,
110 }
else if(
auto battr =
dynamic_cast<sc_core::sc_attribute<bool>*
>(attr)) {
113 for(
auto* o : obj->get_child_objects())
118void configurable_tracer::end_of_elaboration() {
120 tracer::end_of_elaboration();
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
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
SCC SystemC tracing utilities.
interface defining a traceable component
cci::cci_param_handle default_trace_enable_handle