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