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
49 virtual sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> *signal() {
50 return &signal_;
51 }
52 std::string gasket_name() const override {
53 return name();
54 }
55 const InterfaceProvider *interface_provider() const override {
56 return provider_;
57 }
58
59 private:
60 void update();
61 void call_iface(bool value);
62
63 sc_core::sc_signal<bool, sc_core::SC_MANY_WRITERS> signal_;
65 NullSimulation null_simulation_;
66};
67
68#if INTC_EXT && USE_SIMICS_CHECKPOINTING
69class GasketSerializable : public GasketBase {
70 public:
71 GasketSerializable(sc_core::sc_module_name,
73
74 friend class cci::serialization::access;
75 template <class Archive>
76 void serialize(Archive &ar, const unsigned int version) { // NOLINT
77 ar & SMD(*signal());
78 }
79 static sc_checkpoint::serialization::Serializer<
80 GasketSerializable> gasket_serializer;
81};
82using Gasket = GasketSerializable;
83#else
85#endif
86
87} // namespace systemc2simics
88} // namespace systemc
89} // namespace simics
90
91#endif
Returns the interface provided by the associated Simics object.
Definition: interface_provider.h:32
Definition: null_simulation.h:28
Definition: registry.h:88
Gasket for translating a SystemC sc_signal of type bool into a Simics signal interface call.
Definition: gasket.h:40
std::string gasket_name() const override
Definition: gasket.h:52
GasketBase(sc_core::sc_module_name, simics::systemc::InterfaceProvider *provider)
const InterfaceProvider * interface_provider() const override
Definition: gasket.h:55
virtual sc_core::sc_signal< bool, sc_core::SC_MANY_WRITERS > * signal()
Definition: gasket.h:49
GasketBase Gasket
Definition: gasket.h:84
Definition: adapter.h:80