SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_gasket_info_simics_adapter.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2020 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_IFACE_SC_GASKET_INFO_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_SC_GASKET_INFO_SIMICS_ADAPTER_H
18
19#include <simics/base/attr-value.h>
20
23
24#include <systemc-interfaces.h>
25
26#include <string>
27#include <vector>
28
29namespace simics {
30namespace systemc {
31namespace iface {
32
34template<typename TBase, typename TInterface = ScGasketInfoInterface>
36 : public SimicsAdapter<sc_gasket_info_interface_t> {
37 public:
38 ScGasketInfoSimicsAdapter() : SimicsAdapter<sc_gasket_info_interface_t>(
39 SC_GASKET_INFO_INTERFACE, init_iface()) {
40 }
41
42 protected:
43 static attr_value_t simics2tlm(conf_object_t *obj) {
44 return vec2list(adapter<TBase, TInterface>(obj)->simics2tlm());
45 }
46 static attr_value_t tlm2simics(conf_object_t *obj) {
47 return vec2list(adapter<TBase, TInterface>(obj)->tlm2simics());
48 }
49 static attr_value_t simics2systemc(conf_object_t *obj) {
50 return vec2list(adapter<TBase, TInterface>(obj)->simics2systemc());
51 }
52 static attr_value_t systemc2simics(conf_object_t *obj) {
53 return vec2list(adapter<TBase, TInterface>(obj)->systemc2simics());
54 }
55 static attr_value_t vec2list(
56 const std::vector<std::vector<std::string> > *v) {
57 attr_value_t l1 = SIM_alloc_attr_list(v->size());
58 int lidx1 = 0;
59 for (auto i = v->begin(); i != v->end(); ++i) {
60 attr_value_t l2 = SIM_alloc_attr_list(i->size());
61 int lidx2 = 0;
62 SIM_attr_list_set_item(&l1, lidx1++, l2);
63 for (auto j = i->begin(); j != i->end(); ++j) {
64 SIM_attr_list_set_item(&l2, lidx2++,
65 SIM_make_attr_string(j->c_str()));
66 }
67 }
68 return l1;
69 }
70
71 private:
72 std::vector<std::string> description(conf_object_t *obj,
73 DescriptionType type) {
74 return descriptionBase<TBase, TInterface>(obj, type);
75 }
76 sc_gasket_info_interface_t init_iface() {
77 sc_gasket_info_interface_t iface = {};
78 iface.simics2tlm = simics2tlm;
79 iface.tlm2simics = tlm2simics;
80 iface.simics2systemc = simics2systemc;
81 iface.systemc2simics = systemc2simics;
82 return iface;
83 }
84};
85
86} // namespace iface
87} // namespace systemc
88} // namespace simics
89
90#endif
Definition: sc_gasket_info_simics_adapter.h:36
ScGasketInfoSimicsAdapter()
Definition: sc_gasket_info_simics_adapter.h:38
static attr_value_t vec2list(const std::vector< std::vector< std::string > > *v)
Definition: sc_gasket_info_simics_adapter.h:55
static attr_value_t tlm2simics(conf_object_t *obj)
Definition: sc_gasket_info_simics_adapter.h:46
static attr_value_t simics2tlm(conf_object_t *obj)
Definition: sc_gasket_info_simics_adapter.h:43
static attr_value_t systemc2simics(conf_object_t *obj)
Definition: sc_gasket_info_simics_adapter.h:52
static attr_value_t simics2systemc(conf_object_t *obj)
Definition: sc_gasket_info_simics_adapter.h:49
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
DescriptionType
Definition: description_interface.h:25
Definition: pci_bus_interface.h:24