SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_vcd_trace_tool.h
Go to the documentation of this file.
1/*
2 © 2016 Intel Corporation
3
4 This software and the related documents are Intel copyrighted materials, and
5 your use of them is governed by the express license under which they were
6 provided to you ("License"). Unless the License provides otherwise, you may
7 not use, modify, copy, publish, distribute, disclose or transmit this software
8 or the related documents without Intel's prior written permission.
9
10 This software and the related documents are provided as is, with no express or
11 implied warranties, other than those that are expressly stated in the License.
12*/
13
14#ifndef SIMICS_SYSTEMC_TOOLS_SC_VCD_TRACE_TOOL_H
15#define SIMICS_SYSTEMC_TOOLS_SC_VCD_TRACE_TOOL_H
16
18
19#include <tlm>
20#include <time.h>
21
22#include <fstream> // NOLINT(readability/streams)
23#include <iomanip>
24#include <map>
25#include <set>
26#include <string>
27#include <vector>
28
29namespace simics {
30namespace systemc {
31namespace tools {
32
34 public:
35 virtual void init(int uid) = 0;
36 virtual std::string name() const = 0;
37 virtual int pins() const = 0;
38 virtual void value(std::ostream *os) const = 0;
39 virtual void invalid_value(std::ostream *os) const = 0;
40 virtual void print_var(std::ostream *os) const = 0;
41 virtual void print_value(std::ostream *os) const = 0;
42 virtual void print_initial_value(std::ostream *os) const = 0;
43 virtual ~WireInterface() {}
44};
45
46class ScVcdTraceTool : public ScTool {
47 public:
48 explicit ScVcdTraceTool(simics::ConfObjectRef o);
49 virtual ~ScVcdTraceTool();
50 void triggered(scla::ProxyInterface *proxy,
51 const char *event_type,
52 const char *class_type,
53 void *object,
54 sc_core::sc_time *timestamp) override;
55 void fired(scla::ProxyInterface *proxy) override;
56 void signal_port_value_update(scla::ProxyInterface *proxy,
57 sc_core::sc_object *signal) override;
58 void nb_transport_fw_post(scla::ProxyInterface *proxy,
59 tlm::tlm_generic_payload *trans,
60 tlm::tlm_phase *phase,
61 sc_core::sc_time *delay,
62 tlm::tlm_sync_enum *ret) override;
63
64 void b_transport_post(scla::ProxyInterface *proxy,
65 tlm::tlm_generic_payload *trans,
66 sc_core::sc_time *delay) override;
67
68 void transport_dbg_post(scla::ProxyInterface *proxy,
69 tlm::tlm_generic_payload *trans,
70 unsigned int *ret) override;
71
72 void nb_transport_bw_post(scla::ProxyInterface *proxy,
73 tlm::tlm_generic_payload *trans,
74 tlm::tlm_phase *phase,
75 sc_core::sc_time *delay,
76 tlm::tlm_sync_enum *ret) override;
77
78 void set_filepath(const attr_value_t &val);
79 attr_value_t filepath() const;
80 static void initialize(const std::string &module_name);
81
82 protected:
83 void add_wire_to_trace(const std::string &module, WireInterface *wire);
84 void update_gp(scla::ProxyInterface *proxy,
85 tlm::tlm_generic_payload *trans);
86 std::string stem(sc_core::sc_object *obj);
89 std::ostream &scope(std::ostream *os, std::string module);
90 std::ostream &upscope(std::ostream *os);
91 void dumpvars();
92 void changed();
93 int id_;
94 std::string path_header_;
95 std::string path_content_;
97 std::ofstream file_header_;
98 std::ofstream file_content_;
99 std::string filepath_;
100 std::string create_time_;
102 sc_core::sc_time::value_type cycles_;
103 std::map<std::string, std::map<std::string, WireInterface *> > modules_;
104 std::map<double, std::string> resolutions_;
105};
106
107} // namespace tools
108} // namespace systemc
109} // namespace simics
110
111#endif
Definition: sc_tool.h:49
Definition: sc_vcd_trace_tool.h:46
static void initialize(const std::string &module_name)
bool write_header_
Definition: sc_vcd_trace_tool.h:96
void transport_dbg_post(scla::ProxyInterface *proxy, tlm::tlm_generic_payload *trans, unsigned int *ret) override
bool first_time_stamp_
Definition: sc_vcd_trace_tool.h:101
std::map< std::string, std::map< std::string, WireInterface * > > modules_
Definition: sc_vcd_trace_tool.h:103
void fired(scla::ProxyInterface *proxy) override
void nb_transport_fw_post(scla::ProxyInterface *proxy, tlm::tlm_generic_payload *trans, tlm::tlm_phase *phase, sc_core::sc_time *delay, tlm::tlm_sync_enum *ret) override
std::string path_content_
Definition: sc_vcd_trace_tool.h:95
std::ofstream file_header_
Definition: sc_vcd_trace_tool.h:97
std::ostream & upscope(std::ostream *os)
void b_transport_post(scla::ProxyInterface *proxy, tlm::tlm_generic_payload *trans, sc_core::sc_time *delay) override
void signal_port_value_update(scla::ProxyInterface *proxy, sc_core::sc_object *signal) override
std::ofstream file_content_
Definition: sc_vcd_trace_tool.h:98
ScVcdTraceTool(simics::ConfObjectRef o)
std::ostream & scope(std::ostream *os, std::string module)
int id_
Definition: sc_vcd_trace_tool.h:93
void update_gp(scla::ProxyInterface *proxy, tlm::tlm_generic_payload *trans)
std::string stem(sc_core::sc_object *obj)
std::string create_time_
Definition: sc_vcd_trace_tool.h:100
sc_core::sc_time::value_type cycles_
Definition: sc_vcd_trace_tool.h:102
std::map< double, std::string > resolutions_
Definition: sc_vcd_trace_tool.h:104
void set_filepath(const attr_value_t &val)
void triggered(scla::ProxyInterface *proxy, const char *event_type, const char *class_type, void *object, sc_core::sc_time *timestamp) override
std::string path_header_
Definition: sc_vcd_trace_tool.h:94
std::string filepath_
Definition: sc_vcd_trace_tool.h:99
void add_wire_to_trace(const std::string &module, WireInterface *wire)
void nb_transport_bw_post(scla::ProxyInterface *proxy, tlm::tlm_generic_payload *trans, tlm::tlm_phase *phase, sc_core::sc_time *delay, tlm::tlm_sync_enum *ret) override
Definition: sc_vcd_trace_tool.h:33
virtual void invalid_value(std::ostream *os) const =0
virtual std::string name() const =0
virtual void print_initial_value(std::ostream *os) const =0
virtual void print_value(std::ostream *os) const =0
virtual void print_var(std::ostream *os) const =0
virtual void value(std::ostream *os) const =0
virtual ~WireInterface()
Definition: sc_vcd_trace_tool.h:43
Definition: adapter.h:79