SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
sc_signal_access_base.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2017 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_SC_SIGNAL_ACCESS_BASE_H
17#define SIMICS_SYSTEMC_SC_SIGNAL_ACCESS_BASE_H
18
21
22namespace simics {
23namespace systemc {
24
25#define __SIMICS_SYSTEMC_SIGNAL_DECLARE_TRANSFORM(type) \
26bool attrToValue(const attr_value_t *attr, type *value) const; \
27attr_value_t valueToAttr(type value) const;
28
29#define __SIMICS_SYSTEMC_SIGNAL_COMMA ,
30
31#define __SIMICS_SYSTEMC_SIGNAL_WRITE_BASE(signal, type, obj, \
32 value, set_func) \
33do { \
34 signal *s = dynamic_cast<signal *>(obj); \
35 if (s) { \
36 type v; \
37 if (set_func(value, &v)) { \
38 *s = v; \
39 return true; \
40 } \
41 } \
42} while (0)
43
44#define SIMICS_SYSTEMC_SIGNAL_WRITE(type, obj, value, set_func) \
45__SIMICS_SYSTEMC_SIGNAL_WRITE_BASE(sc_core::sc_signal<type>, \
46 type, obj, value, set_func); \
47__SIMICS_SYSTEMC_SIGNAL_WRITE_BASE(sc_core::sc_signal<type \
48 __SIMICS_SYSTEMC_SIGNAL_COMMA \
49 sc_core::SC_MANY_WRITERS>, \
50 type, obj, value, set_func); \
51__SIMICS_SYSTEMC_SIGNAL_WRITE_BASE(sc_core::sc_out<type>, \
52 type, obj, value, set_func); \
53__SIMICS_SYSTEMC_SIGNAL_WRITE_BASE(sc_core::sc_inout<type>, \
54 type, obj, value, set_func);
55
56#define __SIMICS_SYSTEMC_SIGNAL_READ_BASE(signal, type, obj, \
57 value, get_func) \
58do { \
59 const signal *s = dynamic_cast<const signal *>(obj); \
60 if (s) { \
61 *value = get_func(s->read()); \
62 return true; \
63 } \
64} while (0)
65
66#define SIMICS_SYSTEMC_SIGNAL_READ(type, obj, value, get_func) \
67__SIMICS_SYSTEMC_SIGNAL_READ_BASE(sc_core::sc_signal<type>, \
68 type, obj, value, get_func); \
69__SIMICS_SYSTEMC_SIGNAL_READ_BASE(sc_core::sc_signal<type \
70 __SIMICS_SYSTEMC_SIGNAL_COMMA \
71 sc_core::SC_MANY_WRITERS>, \
72 type, obj, value, get_func); \
73__SIMICS_SYSTEMC_SIGNAL_READ_BASE(sc_core::sc_in<type>, \
74 type, obj, value, get_func); \
75__SIMICS_SYSTEMC_SIGNAL_READ_BASE(sc_core::sc_inout<type>, \
76 type, obj, value, get_func);
77
78class ScSignalAccessBase : public Registrant<ScSignalAccessInterface> {
79 public:
85#ifndef _WIN32
86 __SIMICS_SYSTEMC_SIGNAL_DECLARE_TRANSFORM(long long unsigned int) // NOLINT
87#endif
94};
95
96} // namespace systemc
97} // namespace simics
98
99#endif
Definition: registry.h:88
Definition: sc_signal_access_base.h:78
Definition: pci_bus_interface.h:24
#define __SIMICS_SYSTEMC_SIGNAL_DECLARE_TRANSFORM(type)
Definition: sc_signal_access_base.h:25