SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
signal.h
Go to the documentation of this file.
1// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2013 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_SYSTEMC2SIMICS_SIGNAL_H
17#define SIMICS_SYSTEMC_SYSTEMC2SIMICS_SIGNAL_H
18
19#include <systemc>
20
25
26namespace simics {
27namespace systemc {
28namespace systemc2simics {
29
31 public:
32 friend class SignalSerializable;
34 : simics::systemc::InterfaceProvider("signal"),
35 gasket_(new NullSignal) {
36 }
38
39 // Operator for accessing the signal
40 // NOTE: non-const access is not a supported use-case
41 const sc_core::sc_signal<bool,
42 sc_core::SC_MANY_WRITERS> *operator->() const {
43 FATAL_ERROR_IF(gasket_ == nullptr, "gasket_ is null");
44 FATAL_ERROR_IF(dynamic_cast<Gasket*>(gasket_) == NULL,
45 "Missing call to systemc2simics::Signal::set_pin()");
46 return gasket_->signal();
47 }
48
49 // API: must be called from Adapter CTOR
50 void set_pin(sc_core::sc_inout<bool> *target_pin);
51
52 private:
53 virtual void create_gasket(sc_core::sc_module_name);
54
55 GasketInterface *gasket_;
56};
57
58#if INTC_EXT && USE_SIMICS_CHECKPOINTING
59class SignalSerializable : public SignalBase {
60 public:
61 SignalSerializable();
62
63 private:
64 void create_gasket(sc_core::sc_module_name) override;
65};
66using Signal = SignalSerializable;
67#else
69#endif
70
71} // namespace systemc2simics
72} // namespace systemc
73} // namespace simics
74
75#endif
Returns the interface provided by the associated Simics object.
Definition: interface_provider.h:32
Gasket for translating a SystemC sc_signal of type bool into a Simics signal interface call.
Definition: gasket.h:40
Definition: gasket_interface.h:28
virtual sc_core::sc_signal< bool, sc_core::SC_MANY_WRITERS > * signal()=0
Utility class that counts the number of instances.
Definition: null_signal.h:35
void set_pin(sc_core::sc_inout< bool > *target_pin)
friend class SignalSerializable
Definition: signal.h:32
const sc_core::sc_signal< bool, sc_core::SC_MANY_WRITERS > * operator->() const
Definition: signal.h:42
SignalBase Signal
Definition: signal.h:68
Definition: adapter.h:80