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
44template<unsigned int BUSWIDTH = 32,
45 typename TYPES = tlm::tlm_base_protocol_types>
46class Gasket : public sc_core::sc_module,
47 public GasketInterface,
49 public:
50 Gasket(sc_core::sc_module_name, const ConfObjectRef &obj);
51 virtual ~Gasket() = default;
52
54 InternalInterface *internal);
55
56 // GasketInterface
57 bool trigger(iface::Transaction *transaction) override;
58 ConfObjectRef &simics_obj() override;
60 void set_type(ClassType *type) override;
61 ClassType *type() override;
62 sc_core::sc_object *get_target_socket() override;
63 void set_dmi(bool enable) override;
64 bool is_dmi_enabled() override;
65 std::string gasket_name() const override;
67 tlm::tlm_generic_payload &payload() override;
69 bool trigger_transaction() override;
72 void set_inquiry(bool inquiry) override;
73
74 template <typename Socket>
75 void bind(Socket &sock) { // NOLINT
76 initiator_socket_.bind(sock);
77 target_socket_ = &sock;
78 }
79
80 private:
81 void invalidate_direct_mem_ptr(sc_dt::uint64 start_range,
82 sc_dt::uint64 end_range);
84 iface::Transaction *transaction);
85 void send_transaction(iface::Transaction *transaction);
86 void update_dmi_data_table(iface::Transaction *transaction,
87 tlm::tlm_generic_payload *payload_before_send);
88 void log_failed_transaction(iface::Transaction *transaction);
89
90 // ThreadCallbackInterface
91 void run(ThreadInterface *call) override;
92 void block(ThreadInterface *call) override;
93 void finish(ThreadInterface *call) override;
94 void exception(ThreadInterface *call) override;
95 iface::SimulationInterface *simulation(ThreadInterface *call) override;
96
97 class ThreadData : public Thread {
98 public:
99 ThreadData()
100 : transaction_(NULL), must_call_sc_pause_(false),
101 must_reset_extension_(false),
102 simulation_(NULL), internal_(NULL) {}
103 void init(iface::Transaction *transaction,
104 iface::SimulationInterface *simulation,
105 InternalInterface *internal) {
106 transaction_ = *transaction;
107 must_call_sc_pause_ = false;
108 must_reset_extension_ = false;
109 simulation_ = simulation;
110 internal_ = internal;
111 }
112 const char *thread_name() override {
113 return sc_core::sc_gen_unique_name("on_transaction");
114 }
115
116 iface::Transaction transaction_;
117 bool must_call_sc_pause_;
118 bool must_reset_extension_;
119 iface::SimulationInterface *simulation_;
120 InternalInterface *internal_;
121 };
122
123 ConfObjectRef simics_obj_;
124 iface::Transaction *transaction_;
125 ClassType *type_;
126 sc_core::sc_object* target_socket_;
127 tlm_utils::simple_initiator_socket<Gasket, BUSWIDTH, TYPES>
128 initiator_socket_;
129 DmiDataTable dmi_data_table_;
130 bool dmi_;
131 ThreadPool<ThreadData> thread_pool_;
132 iface::SimulationInterface *simulation_;
133 InternalInterface *internal_;
134 iface::TransactionPool pool_;
135
136 // deprecated
137 tlm::tlm_generic_payload deprecated_payload_;
138 iface::Transaction deprecated_transaction_;
139};
140
141} // namespace simics2tlm
142} // namespace systemc
143} // namespace simics
144
145#include "gasket.cc" // necessary for class templates to work NOLINT(build/include)
146
147#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:30
Interface used by simics2tlm gaskets, implemented by Gasket base class.
Definition: gasket_interface.h:35
Implements core functionality for sending a TLM2 transaction over a socket.
Definition: gasket.h:48
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:75
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:80