SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_tlm_bw_transport_simics_adapter.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2017 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_INJECTION_SC_TLM_BW_TRANSPORT_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_INJECTION_SC_TLM_BW_TRANSPORT_SIMICS_ADAPTER_H
18
21
22#include <systemc-interfaces.h>
23
24#include <tlm>
25
26#include <string>
27#include <vector>
28
29namespace simics {
30namespace systemc {
31namespace iface {
32namespace injection {
33
34template<typename TBase,
35 typename TYPES = tlm::tlm_base_protocol_types,
36 typename TInterface = tlm::tlm_bw_transport_if<TYPES> >
38 : public SimicsAdapter<sc_tlm_bw_transport_interface_t> {
39 public:
40 typedef typename TYPES::tlm_payload_type transaction_type;
42 : SimicsAdapter<sc_tlm_bw_transport_interface_t>(
43 SC_TLM_BW_TRANSPORT_INTERFACE, init_iface()) {
44 }
45 static sc_tlm_sync_enum_t nb_transport_bw(conf_object_t *obj,
46 attr_value_t trans,
47 ::uint64 phase, ::uint64 t) {
48 transaction_type *payload = NULL;
49 typename TYPES::tlm_phase_type p;
50 p = static_cast<typename TYPES::tlm_phase_type>(phase);
51 sc_core::sc_time t2 = sc_core::sc_time::from_value(t);
53 payload = registry.attrToPayload(obj, &trans);
54 if (!payload)
55 return SC_TLM_ATTR_ERROR;
56
57 tlm::tlm_sync_enum ret =
58 adapter<TBase, TInterface>(obj)->nb_transport_bw(*payload, p, t2);
59 payload->release();
60 return static_cast<sc_tlm_sync_enum_t>(ret);
61 }
62 static void invalidate_direct_mem_ptr(conf_object_t *obj,
63 ::uint64 start_range,
64 ::uint64 end_range) {
65 return adapter<TBase, TInterface>(obj)->invalidate_direct_mem_ptr(
66 start_range, end_range);
67 }
68
69 private:
70 std::vector<std::string> description(conf_object_t *obj,
71 DescriptionType type) {
72 return descriptionBase<TBase, TInterface>(obj, type);
73 }
74 sc_tlm_bw_transport_interface_t init_iface() {
75 sc_tlm_bw_transport_interface_t iface = {};
76 iface.invalidate_direct_mem_ptr = invalidate_direct_mem_ptr;
77 iface.nb_transport_bw = nb_transport_bw;
78 return iface;
79 }
80};
81
82} // namespace injection
83} // namespace iface
84} // namespace systemc
85} // namespace simics
86
87#endif
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
Definition: sc_tlm_bw_transport_simics_adapter.h:38
static void invalidate_direct_mem_ptr(conf_object_t *obj, ::uint64 start_range, ::uint64 end_range)
Definition: sc_tlm_bw_transport_simics_adapter.h:62
ScTlmBwTransportSimicsAdapter()
Definition: sc_tlm_bw_transport_simics_adapter.h:41
TYPES::tlm_payload_type transaction_type
Definition: sc_tlm_bw_transport_simics_adapter.h:40
static sc_tlm_sync_enum_t nb_transport_bw(conf_object_t *obj, attr_value_t trans, ::uint64 phase, ::uint64 t)
Definition: sc_tlm_bw_transport_simics_adapter.h:45
Definition: inject_registry.h:37
TPAYLOAD * attrToPayload(conf_object_t *obj, attr_value_t *attr)
Definition: inject_registry.h:39
DescriptionType
Definition: description_interface.h:25
Definition: pci_bus_interface.h:24