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