SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_register_access_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_REGISTER_ACCESS_SIMICS_ADAPTER_H
17#define SIMICS_SYSTEMC_IFACE_SC_REGISTER_ACCESS_SIMICS_ADAPTER_H
18
21#include <simics/types/buffer.h>
22#include <simics/types/bytes.h>
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 = ScRegisterAccessInterface>
36 : public SimicsAdapter<sc_register_access_interface_t> {
37 public:
39 : SimicsAdapter<sc_register_access_interface_t>(
40 SC_REGISTER_ACCESS_INTERFACE, init_iface()) {
41 }
42
43 protected:
44 static ::exception_type_t read(conf_object_t *obj, ::uint64 address,
45 buffer_t value) {
46 types::buffer_t v = {value.data, value.len};
47 return static_cast<::exception_type_t>(
48 adapter<TBase, TInterface>(obj)->read(address, v));
49 }
50 static ::exception_type_t write(conf_object_t *obj, ::uint64 address,
51 bytes_t value) {
52 types::bytes_t v = {value.data, value.len};
53 return static_cast<::exception_type_t>(
54 adapter<TBase, TInterface>(obj)->write(address, v));
55 }
56
57 private:
58 sc_register_access_interface_t init_iface() {
59 sc_register_access_interface_t iface = {};
60 iface.read = read;
61 iface.write = write;
62 return iface;
63 }
64};
65
66} // namespace iface
67} // namespace systemc
68} // namespace simics
69
70#endif
Definition: sc_register_access_simics_adapter.h:36
::exception_type_t read(conf_object_t *obj, ::uint64 address, buffer_t value)
Definition: sc_register_access_simics_adapter.h:44
::exception_type_t write(conf_object_t *obj, ::uint64 address, bytes_t value)
Definition: sc_register_access_simics_adapter.h:50
ScRegisterAccessSimicsAdapter()
Definition: sc_register_access_simics_adapter.h:38
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