SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
gasket.h
Go to the documentation of this file.
1/*
2 © 2019 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_GASKET_H
15#define SIMICS_SYSTEMC_SYSTEMC2SIMICS_GASKET_H
16
17#include <systemc>
22
23#include <string>
24
25#if INTC_EXT && USE_SIMICS_CHECKPOINTING
26#include <systemc-checkpoint/serialization/sc_signal.h>
27#include <systemc-checkpoint/serialization/serializer.h>
28#include <systemc-checkpoint/serialization/smd.h>
29#endif
30
31namespace simics {
32namespace systemc {
33namespace systemc2simics {
34
37class GasketBase : public Registrant<GasketInterface>
38 , public sc_core::sc_module {
39 public:
40#ifndef SYSTEMC_3_0_0
41 // SC_HAS_PROCESS is deprecated and no long needed in 3.0.0
43#endif
44 GasketBase(sc_core::sc_module_name,
46 bool initial_value = false);
47
48 sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> *signal() override {
49 return &signal_;
50 }
51 std::string gasket_name() const override {
52 return name();
53 }
54 const InterfaceProvider *interface_provider() const override {
55 return provider_;
56 }
57
58 void end_of_elaboration() override;
59
60 private:
61 void update();
62 void call_iface(bool value);
63
64 sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> signal_;
66 NullSimulation null_simulation_;
67 bool initial_value_{false};
68};
69
70#if INTC_EXT && USE_SIMICS_CHECKPOINTING
71class GasketSerializable : public GasketBase {
72 public:
73 GasketSerializable(sc_core::sc_module_name,
75 bool initial_value = false);
76
77 friend class cci::serialization::access;
78 template <class Archive>
79 void serialize(Archive &ar, const unsigned int version) { // NOLINT
80 ar & SMD(*signal());
81 }
82 static sc_checkpoint::serialization::Serializer<
83 GasketSerializable> gasket_serializer;
84};
85using Gasket = GasketSerializable;
86#else
88#endif
89
90} // namespace systemc2simics
91} // namespace systemc
92} // namespace simics
93
94#endif
Returns the interface provided by the associated Simics object.
Definition: interface_provider.h:30
Definition: null_simulation.h:26
Definition: registry.h:86
Gasket for translating a SystemC sc_signal of type bool into a Simics signal interface call.
Definition: gasket.h:38
GasketBase(sc_core::sc_module_name, simics::systemc::InterfaceProvider *provider, bool initial_value=false)
std::string gasket_name() const override
Definition: gasket.h:51
sc_core::sc_signal< bool, sc_core::SC_MANY_WRITERS > * signal() override
Definition: gasket.h:48
const InterfaceProvider * interface_provider() const override
Definition: gasket.h:54
GasketBase Gasket
Definition: gasket.h:87
Definition: adapter.h:79