SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
proxy.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_AWARENESS_PROXY_H
15#define SIMICS_SYSTEMC_AWARENESS_PROXY_H
16
17#include <simics/cc-api.h>
18
19
25#include <systemc>
26#include <tlm>
27
28#include <string>
29#include <unordered_map>
30#include <map>
31#include <vector>
32
33namespace simics {
34namespace systemc {
35namespace awareness {
36
37class Proxy : public simics::ConfObject, public ProxyInterface,
40 public:
41 explicit Proxy(simics::ConfObjectRef o);
42 // ProxyInterface
43 void init(sc_core::sc_object *obj,
45 void allProxiesInitialized() override;
46 void breakSimulation() override;
47 ConfObjectRef simics_obj() override;
48 sc_core::sc_object *systemc_obj() override;
49 void buildEventObjects() override;
53 void simulationStarted() override;
54 void simulationEnded() override;
55
56 // ScObjectInterface
57 std::vector<std::string> sc_print() const override;
58 std::vector<std::string> sc_dump() const override;
59 attr_value_t sc_kind() const override;
60 const char *sc_name() const override;
61
62 virtual void set_attributes(Attributes *attributes);
63 virtual void resizeExtensions(tlm::tlm_generic_payload *payload) const;
64
65 template <class T> T *feature() {
66 return dynamic_cast<T *> (feature(ClassType::typeForClass<T>()));
67 }
68 static attr_value_t getAttribute(lang_void *ptr, conf_object_t *obj,
69 attr_value_t *idx);
70 static set_error_t setAttribute(lang_void *ptr, conf_object_t *obj,
71 attr_value_t *val,
72 attr_value_t *idx);
73 static ProxyInterface *findProxy(sc_core::sc_object *obj);
74 static ProxyInterface *findProxy(sc_core::sc_interface *iface);
75 static ScEventObject *findScEventObject(sc_core::sc_event *event);
76 virtual ~Proxy();
77
78 protected:
79 sc_core::sc_object *object_;
80 sc_core::sc_interface *iface_;
81
82 private:
83 Attributes *attributes_;
84 // Owning collection of ScEventObject instances created by this proxy.
85 // Each element must be removed from sc_events_ before being deleted.
86 std::vector<ScEventObject *> events_;
87 static std::unordered_map<sc_core::sc_object *, ProxyInterface *> proxies_;
88 // Non-owning lookup index from sc_event to ScEventObject. Entries are
89 // inserted in buildEventObjects() and must be erased in ~Proxy() before
90 // the owned ScEventObject (in events_) is deleted.
91 static std::unordered_map<sc_core::sc_event *, ScEventObject *> sc_events_;
92 static std::unordered_map<sc_core::sc_interface *, ProxyInterface *>
93 proxies_by_iface_;
94 std::map<ClassType, ProxyFeatureInterface *> features_;
95};
96
97} // namespace awareness
98} // namespace systemc
99} // namespace simics
100
101#endif
Definition: class_type.h:23
Interface to the SystemC simulation.
Definition: simulation_interface_proxy.h:25
Definition: attributes.h:26
Definition: proxy_feature_interface.h:26
Definition: proxy_interface.h:27
Definition: proxy.h:39
virtual void set_attributes(Attributes *attributes)
sc_core::sc_object * systemc_obj() override
sc_core::sc_interface * iface_
Definition: proxy.h:80
std::vector< std::string > sc_dump() const override
ProxyFeatureInterface * feature(ClassType type) override
attr_value_t sc_kind() const override
virtual void resizeExtensions(tlm::tlm_generic_payload *payload) const
static ScEventObject * findScEventObject(sc_core::sc_event *event)
sc_core::sc_object * object_
Definition: proxy.h:79
static set_error_t setAttribute(lang_void *ptr, conf_object_t *obj, attr_value_t *val, attr_value_t *idx)
void init(sc_core::sc_object *obj, iface::SimulationInterface *simulation) override
static ProxyInterface * findProxy(sc_core::sc_interface *iface)
ConfObjectRef simics_obj() override
const char * sc_name() const override
Proxy(simics::ConfObjectRef o)
static ProxyInterface * findProxy(sc_core::sc_object *obj)
std::vector< std::string > sc_print() const override
void addFeature(ProxyFeatureInterface *feature) override
T * feature()
Definition: proxy.h:65
static attr_value_t getAttribute(lang_void *ptr, conf_object_t *obj, attr_value_t *idx)
iface::SimulationInterface * simulation() override
Definition: sc_event_object.h:25
Definition: sc_object_interface.h:27
Interface to the SystemC simulation.
Definition: simulation_interface.h:25
Definition: adapter.h:79