SystemC Library API Reference Manual
Reference documentation for the Simics SystemC Library.
 
Loading...
Searching...
No Matches
b_transport_invoker.h
Go to the documentation of this file.
1/*
2 © 2017 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_INJECTION_B_TRANSPORT_INVOKER_H
15#define SIMICS_SYSTEMC_INJECTION_B_TRANSPORT_INVOKER_H
16
18
19#include <systemc>
20#include <tlm>
21#include <utility> // move
22
23namespace simics {
24namespace systemc {
25namespace injection {
26
28template <typename TYPES>
30 typedef typename TYPES::tlm_payload_type transaction_type;
31 typedef typename TYPES::tlm_phase_type phase_type;
32
33 class Invoker {
34 public:
35 Invoker(transaction_type *transaction, sc_core::sc_time *offset,
36 tlm::tlm_fw_transport_if<TYPES> *socket)
37 : transaction_(transaction), offset_(*offset), socket_(socket) {}
38 void operator()() {
39 socket_->b_transport(*transaction_, offset_);
40 transaction_->release();
41 InternalProcesses.erase(sc_core::sc_get_current_process_handle());
42 }
43
44 private:
45 transaction_type *transaction_;
46 sc_core::sc_time offset_;
47 tlm::tlm_fw_transport_if<TYPES> *socket_;
48 };
49
50 public:
51 void enqueue(tlm::tlm_base_socket_if *socket, transaction_type *trans,
52 sc_core::sc_time *offset) {
53#ifdef SYSTEMC_2_3_3
54 tlm::tlm_fw_transport_if<TYPES> *socket_
55 = dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *>(
56 socket->get_port_base().get_interface());
57#elif defined SYSTEMC_2_3_4 || defined SYSTEMC_3_0_0
58 tlm::tlm_fw_transport_if<TYPES> *socket_
59 = dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *>(
60 socket->get_base_port().get_interface());
61#endif
62 assert(socket_);
63
64 Invoker call(trans, offset, socket_);
65 InternalProcesses.insert(sc_core::sc_spawn(std::move(call)));
66 }
67};
68
69} // namespace injection
70} // namespace systemc
71} // namespace simics
72
73#endif
Definition: b_transport_invoker.h:29
void enqueue(tlm::tlm_base_socket_if *socket, transaction_type *trans, sc_core::sc_time *offset)
Definition: b_transport_invoker.h:51
std::set< sc_core::sc_process_handle > InternalProcesses
Definition: adapter.h:79