SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
Loading...
Searching...
No Matches
device_access.h
Go to the documentation of this file.
1
/*
2
© 2018 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_DEVICE_ACCESS_H
15
#define SIMICS_SYSTEMC_DEVICE_ACCESS_H
16
17
#include <
simics/systemc/context.h
>
18
#include <
simics/systemc/iface/simulation_interface.h
>
19
#include <
simics/systemc/kernel_state_modifier.h
>
20
21
namespace
simics
{
22
namespace
systemc {
23
25
template
<
typename
T>
26
class
DeviceAccess
{
27
public
:
28
explicit
DeviceAccess
(
iface::SimulationInterface
*simulation,
29
T *device_pointer)
30
:
context_
(simulation),
kernel_state_modifier_
(simulation),
31
device_pointer_
(device_pointer) {
32
}
33
T &
operator*
() {
34
return
*
device_pointer_
;
35
}
36
const
T &
operator*
()
const
{
37
return
*
device_pointer_
;
38
}
39
T *
operator->
() {
40
return
device_pointer_
;
41
}
42
const
T *
operator->
()
const
{
43
return
device_pointer_
;
44
}
45
virtual
~DeviceAccess
() {
46
}
47
48
protected
:
49
Context
context_
;
50
KernelStateModifier
kernel_state_modifier_
;
51
T *
device_pointer_
;
52
};
53
54
}
// namespace systemc
55
}
// namespace simics
56
57
#endif
simics::systemc::Context
Utility class that handles the context switching, using RAII methodology.
Definition:
context.h:31
simics::systemc::DeviceAccess
Definition:
device_access.h:26
simics::systemc::DeviceAccess::~DeviceAccess
virtual ~DeviceAccess()
Definition:
device_access.h:45
simics::systemc::DeviceAccess::DeviceAccess
DeviceAccess(iface::SimulationInterface *simulation, T *device_pointer)
Definition:
device_access.h:28
simics::systemc::DeviceAccess::device_pointer_
T * device_pointer_
Definition:
device_access.h:51
simics::systemc::DeviceAccess::kernel_state_modifier_
KernelStateModifier kernel_state_modifier_
Definition:
device_access.h:50
simics::systemc::DeviceAccess::operator->
const T * operator->() const
Definition:
device_access.h:42
simics::systemc::DeviceAccess::operator*
T & operator*()
Definition:
device_access.h:33
simics::systemc::DeviceAccess::operator->
T * operator->()
Definition:
device_access.h:39
simics::systemc::DeviceAccess::context_
Context context_
Definition:
device_access.h:49
simics::systemc::KernelStateModifier
Definition:
kernel_state_modifier.h:31
simics::systemc::iface::SimulationInterface
Interface to the SystemC simulation.
Definition:
simulation_interface.h:25
context.h
kernel_state_modifier.h
simics
Definition:
adapter.h:79
simulation_interface.h