Browse Source

Added default for trace variable automatically added

pull/3/head
Eyck Jentzsch 1 year ago
parent
commit
43371da3e7
2 changed files with 9 additions and 5 deletions
  1. 3
    1
      incl/scc/configurable_tracer.h
  2. 6
    4
      src/configurable_tracer.cpp

+ 3
- 1
incl/scc/configurable_tracer.h View File

@@ -46,8 +46,9 @@ public:
* @param name basename of the trace file(s)
* @param type type of trace file for transactions
* @param enable enable VCD (signal based) tracing
* @param default value of attribute enableTracing if not defined by module or CCIs
*/
configurable_tracer(std::string &&, file_type, bool = true);
configurable_tracer(std::string &&, file_type, bool = true, bool = false);

~configurable_tracer();

@@ -56,6 +57,7 @@ public:
}

protected:
const bool default_trace_enable;
void descend(const sc_core::sc_object *) override;
bool get_trace_enabled(const sc_core::sc_object *, bool = false);
void augment_object_hierarchical(const sc_core::sc_object *);

+ 6
- 4
src/configurable_tracer.cpp View File

@@ -35,10 +35,12 @@

using namespace scc;

configurable_tracer::configurable_tracer(std::string &&name, file_type type, bool enable_vcd)
configurable_tracer::configurable_tracer(std::string &&name, file_type type, bool enable_vcd, bool default_enable)
: tracer(std::move(name), type, enable_vcd)
, cci_originator("configurable_tracer")
, cci_broker(cci::cci_get_global_broker(cci_originator)) {
, cci_broker(cci::cci_get_global_broker(cci_originator))
, default_trace_enable(default_enable)
{
// for(auto* o:sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext))
// augment_object_hierarchical(o);
}
@@ -63,7 +65,7 @@ void configurable_tracer::descend(const sc_core::sc_object *obj) {
} else if (strcmp(kind, "sc_vector") == 0) {
return;
}
auto trace_enable = get_trace_enabled(obj, false);
auto trace_enable = get_trace_enabled(obj, default_trace_enable);
if (trace_enable) obj->trace(trf);
for (auto o : obj->get_child_objects())
if (trace_enable ||
@@ -94,7 +96,7 @@ void configurable_tracer::augment_object_hierarchical(const sc_core::sc_object *
hier_name += ".enableTracing";
auto h = cci_broker.get_param_handle(hier_name);
if (!h.is_valid()) // we have no cci_param so create one
params.push_back(new cci::cci_param<bool>(hier_name, false, "", cci::CCI_ABSOLUTE_NAME,
params.push_back(new cci::cci_param<bool>(hier_name, default_trace_enable, "", cci::CCI_ABSOLUTE_NAME,
cci::cci_originator(obj->name())));
}
for (auto *o : obj->get_child_objects()) augment_object_hierarchical(o);

Loading…
Cancel
Save