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 © 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_SIMICS2TLM_GASKET_H
15#define SIMICS_SYSTEMC_SIMICS2TLM_GASKET_H
16
17#include <simics/cc-api.h>
26
27#include <systemc>
28#include <tlm>
29#include <tlm_utils/simple_initiator_socket.h>
30
31#include <string>
32
33namespace simics {
34namespace systemc {
35namespace simics2tlm {
36
53template<unsigned int BUSWIDTH = 32,
54 typename TYPES = tlm::tlm_base_protocol_types>
55class Gasket : public sc_core::sc_module,
56 public GasketInterface,
58 public:
59 Gasket(sc_core::sc_module_name, const ConfObjectRef &obj);
60 virtual ~Gasket() = default;
61
63 InternalInterface *internal);
64
65 // GasketInterface
66 bool trigger(iface::Transaction *transaction) override;
67 ConfObjectRef &simics_obj() override;
69 void set_type(ClassType *type) override;
70 ClassType *type() override;
71 sc_core::sc_object *get_target_socket() override;
72 void set_dmi(bool enable) override;
73 bool is_dmi_enabled() override;
74 std::string gasket_name() const override;
76 tlm::tlm_generic_payload &payload() override;
78 bool trigger_transaction() override;
81 void set_inquiry(bool inquiry) override;
82
83 template <typename Socket>
84 void bind(Socket &sock) { // NOLINT
85 initiator_socket_.bind(sock);
86 target_socket_ = &sock;
87 }
88
89 private:
90 void invalidate_direct_mem_ptr(sc_dt::uint64 start_range,
91 sc_dt::uint64 end_range);
93 iface::Transaction *transaction);
94 void send_transaction(iface::Transaction *transaction);
95 void update_dmi_data_table(iface::Transaction *transaction,
96 tlm::tlm_generic_payload *payload_before_send);
97 void log_failed_transaction(iface::Transaction *transaction);
98
99 // ThreadCallbackInterface
100 void run(ThreadInterface *call) override;
101 void block(ThreadInterface *call) override;
102 void finish(ThreadInterface *call) override;
103 void exception(ThreadInterface *call) override;
104 iface::SimulationInterface *simulation(ThreadInterface *call) override;
105
106 class ThreadData : public Thread {
107 public:
108 ThreadData()
109 : transaction_(NULL), must_call_sc_pause_(false),
110 must_reset_extension_(false),
111 simulation_(NULL), internal_(NULL) {}
112 void init(iface::Transaction *transaction,
113 iface::SimulationInterface *simulation,
114 InternalInterface *internal) {
115 transaction_ = *transaction;
116 must_call_sc_pause_ = false;
117 must_reset_extension_ = false;
118 simulation_ = simulation;
119 internal_ = internal;
120 }
121 const char *thread_name() override {
122 return sc_core::sc_gen_unique_name("on_transaction");
123 }
124
125 iface::Transaction transaction_;
126 bool must_call_sc_pause_;
127 bool must_reset_extension_;
128 iface::SimulationInterface *simulation_;
129 InternalInterface *internal_;
130 };
131
132 ConfObjectRef simics_obj_;
133 iface::Transaction *transaction_;
134 ClassType *type_;
135 sc_core::sc_object* target_socket_;
136 tlm_utils::simple_initiator_socket<Gasket, BUSWIDTH, TYPES>
137 initiator_socket_;
138 DmiDataTable dmi_data_table_;
139 bool dmi_;
140 ThreadPool<ThreadData> thread_pool_;
141 iface::SimulationInterface *simulation_;
142 InternalInterface *internal_;
143 iface::TransactionPool pool_;
144
145 // deprecated
146 tlm::tlm_generic_payload deprecated_payload_;
147 iface::Transaction deprecated_transaction_;
148};
149
150} // namespace simics2tlm
151} // namespace systemc
152} // namespace simics
153
154#include "gasket.cc" // necessary for class templates to work NOLINT(build/include)
155
156#endif
Definition: class_type.h:23
Definition: internal_interface.h:23
Definition: thread_pool.h:31
Definition: thread_pool.h:42
Definition: thread_pool.h:55
Interface to the SystemC simulation.
Definition: simulation_interface.h:25
Definition: transaction_extension.h:54
Class that encapsulates a generic_payload and returns it to the TransactionPool when the Transaction ...
Definition: transaction.h:29
Definition: dmi_data_table.h:27
Interface used by simics2tlm gaskets, implemented by Gasket base class.
Definition: gasket_interface.h:33
Core helper for sending a TLM2 transaction over a socket.
Definition: gasket.h:57
ConfObjectRef & simics_obj() override
sc_core::sc_object * get_target_socket() override
Gasket(sc_core::sc_module_name, const ConfObjectRef &obj)
bool trigger_transaction() override
Deprecated, use the trigger(iface::Transaction *transaction) instead.
bool trigger(iface::Transaction *transaction) override
void init(iface::SimulationInterface *simulation, InternalInterface *internal)
DmiDataTable * get_dmi_data_table() override
tlm::tlm_generic_payload & payload() override
Deprecated, use the TransactionPool::acquire() instead.
void set_type(ClassType *type) override
void bind(Socket &sock)
Definition: gasket.h:84
void set_dmi(bool enable) override
std::string gasket_name() const override
void set_inquiry(bool inquiry) override
Deprecated, use the TransactionExtension::set_transport_debug(bool) instead.
Definition: adapter.h:79