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