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// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2015 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_AWARENESS_PROXY_FACTORY_SOCKET_H
17#define SIMICS_SYSTEMC_AWARENESS_PROXY_FACTORY_SOCKET_H
18
19#include <tlm>
20#include <tlm_utils/multi_socket_bases.h>
21
29
30namespace simics {
31namespace systemc {
32namespace awareness {
33
34template <typename PROXY>
35class ProxyFactorySocketBase : public ProxyFactory<PROXY> {
36 public:
37 tlm::tlm_base_socket_if *socket(sc_core::sc_object *object) const {
38 tlm::tlm_base_socket_if *socket =
39 dynamic_cast<tlm::tlm_base_socket_if *>(object);
40 if (socket &&
41 socket->get_protocol_types() == typeid(typename PROXY::types))
42 return socket;
43
44 return NULL;
45 }
46 virtual bool needUniqueConfClassName(sc_core::sc_object *object) const {
47 return true;
48 }
49 void registerInterfaces(sc_core::sc_object *object,
50 conf_class_t *cls) const {
52 if (dynamic_cast<sc_core::sc_port_base *>(object)) {
54 PROXY> >(cls);
55 }
56
57 if (dynamic_cast<sc_core::sc_export_base *>(object)) {
59 PROXY> >(cls);
60 }
61
62 this->template registerInterface<
64 cls);
65 }
66};
67
68template <typename TYPES>
70 : public ProxyFactorySocketBase<ProxyInitiatorSocket<TYPES> > {
71 public:
73
74 bool canManufacture(sc_core::sc_object *object) const {
75 tlm::tlm_base_socket_if *socket = this->socket(object);
76 if (!socket)
77 return false;
78
79 if (socket->get_socket_category() == tlm::TLM_INITIATOR_SOCKET)
80 return true;
81
82 if (socket->get_socket_category() == tlm::TLM_MULTI_INITIATOR_SOCKET)
83 return true;
84
85 return false;
86 }
87 void registerInterfaces(sc_core::sc_object *object,
88 conf_class_t *cls) const {
90 tlm::tlm_base_socket_if *socket = this->socket(object);
91 assert(socket);
92
93 this->template registerInterface<
95 proxy_type, TYPES> >(cls);
96 }
97};
98
99template <typename TYPES>
101 : public ProxyFactorySocketBase<ProxyTargetSocket<TYPES> > {
102 public:
104
105 bool canManufacture(sc_core::sc_object *object) const {
106 tlm::tlm_base_socket_if *socket = this->socket(object);
107 if (!socket)
108 return false;
109
110 if (socket->get_socket_category() == tlm::TLM_TARGET_SOCKET)
111 return true;
112
113 if (socket->get_socket_category() == tlm::TLM_MULTI_TARGET_SOCKET)
114 return true;
115
116 return false;
117 }
118 void registerInterfaces(sc_core::sc_object *object,
119 conf_class_t *cls) const {
121 tlm::tlm_base_socket_if *socket = this->socket(object);
122 assert(socket);
123
124 this->template registerInterface<
126 proxy_type, TYPES> >(cls);
127 }
128};
129
130} // namespace awareness
131} // namespace systemc
132} // namespace simics
133
134#endif
Definition: proxy_factory_socket.h:70
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const
Definition: proxy_factory_socket.h:87
bool canManufacture(sc_core::sc_object *object) const
Definition: proxy_factory_socket.h:74
ProxyInitiatorSocket< TYPES > proxy_type
Definition: proxy_factory_socket.h:72
Definition: proxy_factory_socket.h:35
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const
Definition: proxy_factory_socket.h:49
virtual bool needUniqueConfClassName(sc_core::sc_object *object) const
Definition: proxy_factory_socket.h:46
tlm::tlm_base_socket_if * socket(sc_core::sc_object *object) const
Definition: proxy_factory_socket.h:37
Definition: proxy_factory_socket.h:101
bool canManufacture(sc_core::sc_object *object) const
Definition: proxy_factory_socket.h:105
ProxyTargetSocket< TYPES > proxy_type
Definition: proxy_factory_socket.h:103
void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const
Definition: proxy_factory_socket.h:118
Definition: proxy_factory.h:44
virtual void registerInterfaces(sc_core::sc_object *object, conf_class_t *cls) const
Definition: proxy_factory.h:117
void registerInterface(conf_class_t *cls) const
Definition: proxy_factory.h:179
Definition: proxy_socket.h:242
Definition: sc_export_simics_adapter.h:33
Definition: sc_port_simics_adapter.h:33
Definition: sc_tlm_bw_transport_simics_adapter.h:38
Definition: sc_tlm_fw_transport_simics_adapter.h:40
Definition: provider_controller_simics_adapter.h:36
Definition: pci_bus_interface.h:24