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// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2021 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_MEMORY_ACCESS_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_SC_MEMORY_ACCESS_SIMICS_ADAPTER_H
18
21#include <simics/types/buffer.h>
22#include <simics/types/bytes.h>
23
24#include <systemc-interfaces.h>
25
26namespace simics {
27namespace systemc {
28namespace iface {
29
31template<typename TBase, typename TInterface = ScMemoryAccessInterface>
33 : public SimicsAdapter<sc_memory_access_interface_t> {
34 public:
36 : SimicsAdapter<sc_memory_access_interface_t>(
37 SC_MEMORY_ACCESS_INTERFACE, init_iface()) {
38 }
39
40 protected:
41 static ::exception_type_t read(conf_object_t *obj, ::uint64 address,
42 buffer_t value, bool debug) {
43 types::buffer_t v = {value.data, value.len};
44 return static_cast<::exception_type_t>(
45 adapter<TBase, TInterface>(obj)->read(address, v, debug));
46 }
47 static ::exception_type_t write(conf_object_t *obj, ::uint64 address,
48 bytes_t value, bool debug) {
49 types::bytes_t v = {value.data, value.len};
50 return static_cast<::exception_type_t>(
51 adapter<TBase, TInterface>(obj)->write(address, v, debug));
52 }
53
54 private:
55 sc_memory_access_interface_t init_iface() {
56 sc_memory_access_interface_t iface = {};
57 iface.read = read;
58 iface.write = write;
59 return iface;
60 }
61};
62
63} // namespace iface
64} // namespace systemc
65} // namespace simics
66
67#endif
Definition: sc_memory_access_simics_adapter.h:33
::exception_type_t read(conf_object_t *obj, ::uint64 address, buffer_t value, bool debug)
Definition: sc_memory_access_simics_adapter.h:41
ScMemoryAccessSimicsAdapter()
Definition: sc_memory_access_simics_adapter.h:35
::exception_type_t write(conf_object_t *obj, ::uint64 address, bytes_t value, bool debug)
Definition: sc_memory_access_simics_adapter.h:47
Base class for mapping Simics interface to a C++ interface.
Definition: simics_adapter.h:47
Definition: pci_bus_interface.h:24
Definition: buffer.h:29
uint8_t * data
Definition: buffer.h:30
Definition: bytes.h:28
const uint8_t * data
Definition: bytes.h:29