gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
adapters.hh
Go to the documentation of this file.
1/*****************************************************************************
2
3 Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4 more contributor license agreements. See the NOTICE file distributed
5 with this work for additional information regarding copyright ownership.
6 Accellera licenses this file to you under the Apache License, Version 2.0
7 (the "License"); you may not use this file except in compliance with the
8 License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15 implied. See the License for the specific language governing
16 permissions and limitations under the License.
17
18 *****************************************************************************/
19
20#ifndef __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_ADAPTERS_HH__
21#define __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_ADAPTERS_HH__
22
24
25namespace tlm
26{
27
28template <typename REQ, typename RSP>
30 public virtual tlm_transport_if<REQ, RSP>
31{
32 public:
35
41
44 sc_core::sc_gen_unique_name("transport_to_master")))
45 {
46 target_export( *this );
47 }
48
49 RSP
50 transport(const REQ &req)
51 {
52 mutex.lock();
53 master_port->put(req);
54 rsp = master_port->get();
55
56 mutex.unlock();
57 return rsp;
58 }
59
60 private:
62 RSP rsp;
63};
64
65template <typename REQ, typename RSP>
67{
68 public:
70
73
77
82
83 private:
84 void
86 {
87 REQ req;
88 RSP rsp;
89
90 while (true) {
91 slave_port->get(req);
92 rsp = initiator_port->transport(req);
93 slave_port->put(rsp);
94 }
95 }
96};
97
98} // namespace tlm
99
100#endif /* __SYSTEMC_EXT_TLM_CORE_1_REQ_RSP_ADAPTERS_HH__ */
sc_module(const sc_module_name &)
Definition sc_module.cc:266
SC_HAS_PROCESS(tlm_slave_to_transport)
sc_core::sc_port< tlm_transport_if< REQ, RSP > > initiator_port
Definition adapters.hh:72
tlm_slave_to_transport(sc_core::sc_module_name nm)
Definition adapters.hh:74
sc_core::sc_port< tlm_slave_if< REQ, RSP > > slave_port
Definition adapters.hh:71
sc_core::sc_export< tlm_transport_if< REQ, RSP > > target_export
Definition adapters.hh:33
RSP transport(const REQ &req)
Definition adapters.hh:50
sc_core::sc_mutex mutex
Definition adapters.hh:61
sc_core::sc_port< tlm_master_if< REQ, RSP > > master_port
Definition adapters.hh:34
tlm_transport_to_master(sc_core::sc_module_name nm)
Definition adapters.hh:36
const char * sc_gen_unique_name(const char *seed)
Definition sc_module.cc:820

Generated on Mon May 26 2025 09:19:14 for gem5 by doxygen 1.13.2