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// -*- mode: C++; c-file-style: "virtutech-c++" -*-
2
3/*
4 © 2017 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_INJECTION_B_TRANSPORT_INVOKER_H
17#define SIMICS_SYSTEMC_INJECTION_B_TRANSPORT_INVOKER_H
18
20
21#include <systemc>
22#include <tlm>
23#include <utility> // move
24
25namespace simics {
26namespace systemc {
27namespace injection {
28
30template <typename TYPES>
32 typedef typename TYPES::tlm_payload_type transaction_type;
33 typedef typename TYPES::tlm_phase_type phase_type;
34
35 class Invoker {
36 public:
37 Invoker(transaction_type *transaction, sc_core::sc_time *offset,
38 tlm::tlm_fw_transport_if<TYPES> *socket)
39 : transaction_(transaction), offset_(*offset), socket_(socket) {}
40 void operator()() {
41 socket_->b_transport(*transaction_, offset_);
42 transaction_->release();
43 InternalProcesses.erase(sc_core::sc_get_current_process_handle());
44 }
45
46 private:
47 transaction_type *transaction_;
48 sc_core::sc_time offset_;
49 tlm::tlm_fw_transport_if<TYPES> *socket_;
50 };
51
52 public:
53 void enqueue(tlm::tlm_base_socket_if *socket, transaction_type *trans,
54 sc_core::sc_time *offset) {
55 tlm::tlm_fw_transport_if<TYPES> *socket_
56 = dynamic_cast<tlm::tlm_fw_transport_if<TYPES> *>(
57 socket->get_port_base().get_interface());
58 assert(socket_);
59
60 Invoker call(trans, offset, socket_);
61 InternalProcesses.insert(sc_core::sc_spawn(std::move(call)));
62 }
63};
64
65} // namespace injection
66} // namespace systemc
67} // namespace simics
68
69#endif
Definition: b_transport_invoker.h:31
void enqueue(tlm::tlm_base_socket_if *socket, transaction_type *trans, sc_core::sc_time *offset)
Definition: b_transport_invoker.h:53
std::set< sc_core::sc_process_handle > InternalProcesses
Definition: pci_bus_interface.h:24