Browse Source

Added default for trace variable automatically added

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:
46 46
      * @param name basename of the trace file(s)
47 47
      * @param type type of trace file for transactions
48 48
      * @param enable enable VCD (signal based) tracing
49
+     * @param default value of attribute enableTracing if not defined by module or CCIs
49 50
      */
50
-    configurable_tracer(std::string &&, file_type, bool = true);
51
+    configurable_tracer(std::string &&, file_type, bool = true, bool = false);
51 52
 
52 53
     ~configurable_tracer();
53 54
 
@@ -56,6 +57,7 @@ public:
56 57
     }
57 58
 
58 59
 protected:
60
+    const bool default_trace_enable;
59 61
     void descend(const sc_core::sc_object *) override;
60 62
     bool get_trace_enabled(const sc_core::sc_object *, bool = false);
61 63
     void augment_object_hierarchical(const sc_core::sc_object *);

+ 6
- 4
src/configurable_tracer.cpp View File

@@ -35,10 +35,12 @@
35 35
 
36 36
 using namespace scc;
37 37
 
38
-configurable_tracer::configurable_tracer(std::string &&name, file_type type, bool enable_vcd)
38
+configurable_tracer::configurable_tracer(std::string &&name, file_type type, bool enable_vcd, bool default_enable)
39 39
 : tracer(std::move(name), type, enable_vcd)
40 40
 , cci_originator("configurable_tracer")
41
-, cci_broker(cci::cci_get_global_broker(cci_originator)) {
41
+, cci_broker(cci::cci_get_global_broker(cci_originator))
42
+, default_trace_enable(default_enable)
43
+{
42 44
     //    for(auto* o:sc_core::sc_get_top_level_objects(sc_core::sc_curr_simcontext))
43 45
     //        augment_object_hierarchical(o);
44 46
 }
@@ -63,7 +65,7 @@ void configurable_tracer::descend(const sc_core::sc_object *obj) {
63 65
     } else if (strcmp(kind, "sc_vector") == 0) {
64 66
         return;
65 67
     }
66
-    auto trace_enable = get_trace_enabled(obj, false);
68
+    auto trace_enable = get_trace_enabled(obj, default_trace_enable);
67 69
     if (trace_enable) obj->trace(trf);
68 70
     for (auto o : obj->get_child_objects())
69 71
         if (trace_enable ||
@@ -94,7 +96,7 @@ void configurable_tracer::augment_object_hierarchical(const sc_core::sc_object *
94 96
             hier_name += ".enableTracing";
95 97
             auto h = cci_broker.get_param_handle(hier_name);
96 98
             if (!h.is_valid()) // we have no cci_param so create one
97
-                params.push_back(new cci::cci_param<bool>(hier_name, false, "", cci::CCI_ABSOLUTE_NAME,
99
+                params.push_back(new cci::cci_param<bool>(hier_name, default_trace_enable, "", cci::CCI_ABSOLUTE_NAME,
98 100
                                                           cci::cci_originator(obj->name())));
99 101
         }
100 102
         for (auto *o : obj->get_child_objects()) augment_object_hierarchical(o);