SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
null_gasket.h
Go to the documentation of this file.
1/*
2 © 2014 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_SIMICS2TLM_NULL_GASKET_H
15#define SIMICS_SYSTEMC_SIMICS2TLM_NULL_GASKET_H
16
19
20#if defined(__GNUC__) && !defined(_MSC_VER)
21#include <cxxabi.h>
22#endif
23
24#include <cstdlib>
25#include <set>
26#include <string>
27#include <typeinfo>
28#include <vector>
29
30namespace simics {
31namespace systemc {
32namespace simics2tlm {
33
40 public simics::systemc::InstanceCounter<NullGasket> {
41 public:
43 tracked_instances().insert(this);
44 }
45 ~NullGasket() override {
46 tracked_instances().erase(this);
47 }
48
49 bool trigger(iface::Transaction *transaction) override {
50 return false;
51 }
52 simics::ConfObjectRef &simics_obj() override {
53 return obj_;
54 }
56 return &dmi_data_table_;
57 }
58 void set_type(ClassType *type) override {
59 type_ = type;
60 }
61 ClassType *type() override {
62 return type_;
63 }
64 sc_core::sc_object *get_target_socket() override {
65 return nullptr;
66 }
67 void set_dmi(bool enable) override {
68 }
69 bool is_dmi_enabled() override {
70 return false;
71 }
72 std::string gasket_name() const override {
73 if (!type_)
74 return "unknown simics2tlm gasket";
75
76 return demangle(typeid(*type_).name());
77 }
78
79 static std::vector<std::string> missing_gasket_names() {
80 std::set<std::string> unique_names;
81 for (const auto *gasket : tracked_instances()) {
82 unique_names.insert(gasket->gasket_name());
83 }
84
85 return std::vector<std::string>(unique_names.begin(),
86 unique_names.end());
87 }
88
89 // deprecated
90 tlm::tlm_generic_payload &payload() override {
91 return transaction_;
92 }
93 bool trigger_transaction() override {
94 return false;
95 }
96 void set_inquiry(bool inquiry) override {
97 }
98
99 private:
100 // demangle the ABI-mangled string for GCC
101 static std::string demangle(const char *name) {
102#if defined(__GNUC__) && !defined(_MSC_VER)
103 int status = 0;
104 char *demangled = abi::__cxa_demangle(name, nullptr, nullptr,
105 &status);
106 std::string result = (status == 0 && demangled) ? demangled : name;
107 std::free(demangled);
108 return result;
109#else
110 return name;
111#endif
112 }
113
114 typedef std::set<const NullGasket *> TrackedInstances;
115 static TrackedInstances &tracked_instances() {
116 static TrackedInstances instances;
117 return instances;
118 }
119
120 ClassType *type_ {nullptr};
121 simics::ConfObjectRef obj_;
122 tlm::tlm_generic_payload transaction_;
123 DmiDataTable dmi_data_table_;
124};
125
126} // namespace simics2tlm
127} // namespace systemc
128} // namespace simics
129
130#endif
Definition: class_type.h:23
Keeps track of (counts) the number of instances for this type of class.
Definition: instance_counter.h:30
static int instances()
Definition: instance_counter.h:40
Class that encapsulates a generic_payload and returns it to the TransactionPool when the Transaction ...
Definition: transaction.h:29
Definition: dmi_data_table.h:27
Interface used by simics2tlm gaskets, implemented by Gasket base class.
Definition: gasket_interface.h:33
Definition: null_gasket.h:40
bool is_dmi_enabled() override
Definition: null_gasket.h:69
sc_core::sc_object * get_target_socket() override
Definition: null_gasket.h:64
std::string gasket_name() const override
Definition: null_gasket.h:72
NullGasket()
Definition: null_gasket.h:42
void set_type(ClassType *type) override
Definition: null_gasket.h:58
bool trigger_transaction() override
Deprecated, use the trigger(iface::Transaction *transaction) instead.
Definition: null_gasket.h:93
DmiDataTable * get_dmi_data_table() override
Definition: null_gasket.h:55
bool trigger(iface::Transaction *transaction) override
Definition: null_gasket.h:49
ClassType * type() override
Definition: null_gasket.h:61
simics::ConfObjectRef & simics_obj() override
Definition: null_gasket.h:52
tlm::tlm_generic_payload & payload() override
Deprecated, use the TransactionPool::acquire() instead.
Definition: null_gasket.h:90
void set_dmi(bool enable) override
Definition: null_gasket.h:67
void set_inquiry(bool inquiry) override
Deprecated, use the TransactionExtension::set_transport_debug(bool) instead.
Definition: null_gasket.h:96
static std::vector< std::string > missing_gasket_names()
Definition: null_gasket.h:79
~NullGasket() override
Definition: null_gasket.h:45
Definition: adapter.h:79