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