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