SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_port_simics_adapter.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_IFACE_SC_PORT_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_SC_PORT_SIMICS_ADAPTER_H
16
19#include <simics/attribute-traits.h>
20
21#include <systemc-interfaces.h>
22
23#include <string>
24#include <vector>
25
26namespace simics {
27namespace systemc {
28namespace iface {
29
31template<typename TBase, typename TInterface = ScPortInterface>
32class ScPortSimicsAdapter : public SimicsAdapter<sc_port_interface_t> {
33 public:
34 ScPortSimicsAdapter() : SimicsAdapter<sc_port_interface_t>(
35 SC_PORT_INTERFACE, init_iface()) {
36 }
37
38 protected:
39 static attr_value_t port_to_proxies(conf_object_t *obj) {
40 auto proxies = adapter<TBase, TInterface>(obj)->port_to_proxies();
41 return simics::std_to_attr(
42 std::vector<simics::ConfObjectRef>(proxies.begin(),
43 proxies.end()));
44 }
45 static const char *if_typename(conf_object_t *obj) {
46 return adapter<TBase, TInterface>(obj)->if_typename();
47 }
48 static int max_number_of_proxies(conf_object_t *obj) {
49 return adapter<TBase, TInterface>(obj)->max_number_of_proxies();
50 }
51
52 private:
53 std::vector<std::string> description(conf_object_t *obj,
54 DescriptionType type) override {
55 return descriptionBase<TBase, TInterface>(obj, type);
56 }
57 sc_port_interface_t init_iface() {
58 sc_port_interface_t iface = {};
59 iface.port_to_proxies = port_to_proxies;
60 iface.if_typename = if_typename;
61 iface.max_number_of_proxies = max_number_of_proxies;
62 return iface;
63 }
64};
65
66} // namespace iface
67} // namespace systemc
68} // namespace simics
69
70#endif
Definition: sc_port_simics_adapter.h:32
static attr_value_t port_to_proxies(conf_object_t *obj)
Definition: sc_port_simics_adapter.h:39
static const char * if_typename(conf_object_t *obj)
Definition: sc_port_simics_adapter.h:45
static int max_number_of_proxies(conf_object_t *obj)
Definition: sc_port_simics_adapter.h:48
ScPortSimicsAdapter()
Definition: sc_port_simics_adapter.h:34
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
DescriptionType
Definition: description_interface.h:23
Definition: adapter.h:79