SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_memory_access_simics_adapter.h
Go to the documentation of this file.
1/*
2 © 2021 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_MEMORY_ACCESS_SIMICS_ADAPTER_H
15#define SIMICS_SYSTEMC_IFACE_SC_MEMORY_ACCESS_SIMICS_ADAPTER_H
16
19#include <simics/types/buffer.h>
20#include <simics/types/bytes.h>
21
22#include <systemc-interfaces.h>
23
24namespace simics {
25namespace systemc {
26namespace iface {
27
29template<typename TBase, typename TInterface = ScMemoryAccessInterface>
31 : public SimicsAdapter<sc_memory_access_interface_t> {
32 public:
34 : SimicsAdapter<sc_memory_access_interface_t>(
35 SC_MEMORY_ACCESS_INTERFACE, init_iface()) {
36 }
37
38 protected:
39 static ::exception_type_t read(conf_object_t *obj, ::uint64 address,
40 buffer_t value, bool debug) {
41 types::buffer_t v = {value.data, value.len};
42 return static_cast<::exception_type_t>(
43 adapter<TBase, TInterface>(obj)->read(address, v, debug));
44 }
45 static ::exception_type_t write(conf_object_t *obj, ::uint64 address,
46 bytes_t value, bool debug) {
47 types::bytes_t v = {value.data, value.len};
48 return static_cast<::exception_type_t>(
49 adapter<TBase, TInterface>(obj)->write(address, v, debug));
50 }
51
52 private:
53 sc_memory_access_interface_t init_iface() {
54 sc_memory_access_interface_t iface = {};
55 iface.read = read;
56 iface.write = write;
57 return iface;
58 }
59};
60
61} // namespace iface
62} // namespace systemc
63} // namespace simics
64
65#endif
Definition: sc_memory_access_simics_adapter.h:31
::exception_type_t read(conf_object_t *obj, ::uint64 address, buffer_t value, bool debug)
Definition: sc_memory_access_simics_adapter.h:39
ScMemoryAccessSimicsAdapter()
Definition: sc_memory_access_simics_adapter.h:33
::exception_type_t write(conf_object_t *obj, ::uint64 address, bytes_t value, bool debug)
Definition: sc_memory_access_simics_adapter.h:45
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:45
Definition: adapter.h:79
Definition: buffer.h:27
uint8_t * data
Definition: buffer.h:28
Definition: bytes.h:26
const uint8_t * data
Definition: bytes.h:27