SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
proxy_factory_socket.h
Go to the documentation of this file.
1/*
2 © 2015 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_FACTORY_SOCKET_H
15#define SIMICS_SYSTEMC_AWARENESS_PROXY_FACTORY_SOCKET_H
16
17#include <tlm>
18#include <tlm_utils/multi_socket_bases.h>
19
27
28namespace simics {
29namespace systemc {
30namespace awareness {
31
32template <typename PROXY>
33class ProxyFactorySocketBase : public ProxyFactory<PROXY> {
34 public:
35 tlm::tlm_base_socket_if *socket(sc_core::sc_object *object) const {
36 tlm::tlm_base_socket_if *socket =
37 dynamic_cast<tlm::tlm_base_socket_if *>(object);
38 if (socket &&
39 socket->get_protocol_types() == typeid(typename PROXY::types))
40 return socket;
41
42 return NULL;
43 }
44 bool needUniqueConfClassName(sc_core::sc_object *object) const override {
45 return true;
46 }
47 void registerInterfaces(sc_core::sc_object *object,
48 conf_class_t *cls) const override {
50 if (dynamic_cast<sc_core::sc_port_base *>(object)) {
52 PROXY> >(cls);
53 }
54
55 if (dynamic_cast<sc_core::sc_export_base *>(object)) {
57 PROXY> >(cls);
58 }
59
60 this->template registerInterface<
62 cls);
63 }
64};
65
66template <typename TYPES>
68 : public ProxyFactorySocketBase<ProxyInitiatorSocket<TYPES> > {
69 public:
71
72 bool canManufacture(sc_core::sc_object *object) const override {
73 tlm::tlm_base_socket_if *socket = this->socket(object);
74 if (!socket)
75 return false;
76
77 if (socket->get_socket_category() == tlm::TLM_INITIATOR_SOCKET)
78 return true;
79
80 if (socket->get_socket_category() == tlm::TLM_MULTI_INITIATOR_SOCKET)
81 return true;
82
83 return false;
84 }
85 void registerInterfaces(sc_core::sc_object *object,
86 conf_class_t *cls) const override {
88 tlm::tlm_base_socket_if *socket = this->socket(object);
89 assert(socket);
90
91 this->template registerInterface<
93 proxy_type, TYPES> >(cls);
94 }
95};
96
97template <typename TYPES>
99 : public ProxyFactorySocketBase<ProxyTargetSocket<TYPES> > {
100 public:
102
103 bool canManufacture(sc_core::sc_object *object) const override {
104 tlm::tlm_base_socket_if *socket = this->socket(object);
105 if (!socket)
106 return false;
107
108 if (socket->get_socket_category() == tlm::TLM_TARGET_SOCKET)
109 return true;
110
111 if (socket->get_socket_category() == tlm::TLM_MULTI_TARGET_SOCKET)
112 return true;
113
114 return false;
115 }
116 void registerInterfaces(sc_core::sc_object *object,
117 conf_class_t *cls) const override {
119 tlm::tlm_base_socket_if *socket = this->socket(object);
120 assert(socket);
121
122 this->template registerInterface<
124 proxy_type, TYPES> >(cls);
125 }
126};
127
128} // namespace awareness
129} // namespace systemc
130} // namespace simics
131
132#endif
Definition: proxy_factory_socket.h:68
bool canManufacture(sc_core::sc_object *object) const override
Definition: proxy_factory_socket.h:72
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory_socket.h:85
ProxyInitiatorSocket< TYPES > proxy_type
Definition: proxy_factory_socket.h:70
Definition: proxy_factory_socket.h:33
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory_socket.h:47
bool needUniqueConfClassName(sc_core::sc_object *object) const override
Definition: proxy_factory_socket.h:44
tlm::tlm_base_socket_if * socket(sc_core::sc_object *object) const
Definition: proxy_factory_socket.h:35
Definition: proxy_factory_socket.h:99
ProxyTargetSocket< TYPES > proxy_type
Definition: proxy_factory_socket.h:101
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory_socket.h:116
bool canManufacture(sc_core::sc_object *object) const override
Definition: proxy_factory_socket.h:103
Definition: proxy_factory.h:42
void registerInterface(conf_class_t *cls) const
Definition: proxy_factory.h:174
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const override
Definition: proxy_factory.h:112
Definition: proxy_socket.h:273
Definition: sc_export_simics_adapter.h:31
Definition: sc_port_simics_adapter.h:32
Definition: sc_tlm_bw_transport_simics_adapter.h:36
Definition: sc_tlm_fw_transport_simics_adapter.h:38
Definition: provider_controller_simics_adapter.h:34
Definition: adapter.h:79