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 // initial_value sets the sc_signal's initial state (default false/low).
51 // Pass true for active-low signals that start deasserted (high).
52 void set_pin(sc_core::sc_inout<bool> *target_pin,
53 bool initial_value = false);
54
55 private:
56 virtual void create_gasket(sc_core::sc_module_name,
57 bool initial_value = false);
58
59 GasketInterface *gasket_;
60};
61
62#if INTC_EXT && USE_SIMICS_CHECKPOINTING
63class SignalSerializable : public SignalBase {
64 public:
65 SignalSerializable();
66
67 private:
68 void create_gasket(sc_core::sc_module_name,
69 bool initial_value = false) override;
70};
71using Signal = SignalSerializable;
72#else
74#endif
75
76} // namespace systemc2simics
77} // namespace systemc
78} // namespace simics
79
80#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
friend class SignalSerializable
Definition: signal.h:32
const sc_core::sc_signal< bool, sc_core::SC_MANY_WRITERS > * operator->() const
Definition: signal.h:42
void set_pin(sc_core::sc_inout< bool > *target_pin, bool initial_value=false)
SignalBase Signal
Definition: signal.h:73
Definition: adapter.h:81