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/*
2 © 2013 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_SYSTEMC2SIMICS_SIGNAL_H
15#define SIMICS_SYSTEMC_SYSTEMC2SIMICS_SIGNAL_H
16
17#include <systemc>
18
23
24namespace simics {
25namespace systemc {
26namespace systemc2simics {
27
29 public:
30 friend class SignalSerializable;
32 : simics::systemc::InterfaceProvider("signal"),
33 gasket_(new NullSignal) {
34 }
36
37 // Operator for accessing the signal
38 // NOTE: non-const access is not a supported use-case
39 const sc_core::sc_signal<bool,
40 sc_core::SC_MANY_WRITERS> *operator->() const {
41 FATAL_ERROR_IF(gasket_ == nullptr, "gasket_ is null");
42 FATAL_ERROR_IF(dynamic_cast<Gasket*>(gasket_) == NULL,
43 "Missing call to systemc2simics::Signal::set_pin()");
44 return gasket_->signal();
45 }
46
47 // API: must be called from Adapter CTOR
48 // initial_value sets the sc_signal's initial state (default false/low).
49 // Pass true for active-low signals that start deasserted (high).
50 void set_pin(sc_core::sc_inout<bool> *target_pin,
51 bool initial_value = false);
52
53 private:
54 virtual void create_gasket(sc_core::sc_module_name,
55 bool initial_value = false);
56
57 GasketInterface *gasket_;
58};
59
60#if INTC_EXT && USE_SIMICS_CHECKPOINTING
61class SignalSerializable : public SignalBase {
62 public:
63 SignalSerializable();
64
65 private:
66 void create_gasket(sc_core::sc_module_name,
67 bool initial_value = false) override;
68};
69using Signal = SignalSerializable;
70#else
72#endif
73
74} // namespace systemc2simics
75} // namespace systemc
76} // namespace simics
77
78#endif
Returns the interface provided by the associated Simics object.
Definition: interface_provider.h:30
Gasket for translating a SystemC sc_signal of type bool into a Simics signal interface call.
Definition: gasket.h:38
Definition: gasket_interface.h:26
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:33
friend class SignalSerializable
Definition: signal.h:30
const sc_core::sc_signal< bool, sc_core::SC_MANY_WRITERS > * operator->() const
Definition: signal.h:40
void set_pin(sc_core::sc_inout< bool > *target_pin, bool initial_value=false)
SignalBase Signal
Definition: signal.h:71
Definition: adapter.h:79