gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
dramsys_wrapper.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Fraunhofer IESE
3 * All rights reserved
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include "dramsys_wrapper.hh"
30
31namespace gem5
32{
33
34namespace memory
35{
36
39 ::DRAMSys::Config::Configuration const &config,
42 dramsys(std::make_shared<::DRAMSys::DRAMSys>("DRAMSys", config)),
44{
45 tSocket.register_nb_transport_fw(this, &DRAMSysWrapper::nb_transport_fw);
46 iSocket.register_nb_transport_bw(this, &DRAMSysWrapper::nb_transport_bw);
47
48 tSocket.register_b_transport(this, &DRAMSysWrapper::b_transport);
49
50 tSocket.register_transport_dbg(this, &DRAMSysWrapper::transport_dbg);
51 iSocket.bind(dramsys->tSocket);
52
53 // Register a callback to compensate for the destructor not
54 // being called.
56 []()
57 {
58 // Workaround for BUG GEM5-1233
60 });
61}
62
65 sc_core::sc_time &delay)
66{
67 // Subtract base address offset
68 payload.set_address(payload.get_address() - range.start());
69
70 iSocket->b_transport(payload, delay);
71}
72
75 tlm::tlm_phase &phase,
76 sc_core::sc_time &fwDelay)
77{
78 // Subtract base address offset
79 payload.set_address(payload.get_address() - range.start());
80
81 return iSocket->nb_transport_fw(payload, phase, fwDelay);
82}
83
86 tlm::tlm_phase &phase,
87 sc_core::sc_time &bwDelay)
88{
89 return tSocket->nb_transport_bw(payload, phase, bwDelay);
90}
91
93{
94 // Subtract base address offset
95 trans.set_address(trans.get_address() - range.start());
96
97 return iSocket->transport_dbg(trans);
98}
99
100} // namespace memory
101} // namespace gem5
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
Definition addr_range.hh:82
tlm::tlm_sync_enum nb_transport_bw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_core::sc_time &bwDelay)
tlm::tlm_sync_enum nb_transport_fw(tlm::tlm_generic_payload &payload, tlm::tlm_phase &phase, sc_core::sc_time &fwDelay)
std::shared_ptr<::DRAMSys::DRAMSys > dramsys
tlm_utils::simple_initiator_socket< DRAMSysWrapper > iSocket
unsigned int transport_dbg(tlm::tlm_generic_payload &trans)
void b_transport(tlm::tlm_generic_payload &payload, sc_core::sc_time &delay)
DRAMSysWrapper(sc_core::sc_module_name name, ::DRAMSys::Config::Configuration const &config, AddrRange range)
tlm_utils::simple_target_socket< DRAMSysWrapper > tSocket
sc_module(const sc_module_name &)
Definition sc_module.cc:266
const char * name() const
Definition sc_object.cc:44
static void stop()
Definition kernel.cc:143
void set_address(const sc_dt::uint64 address)
Definition gp.hh:185
sc_dt::uint64 get_address() const
Definition gp.hh:184
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.
Definition core.cc:143
Overload hash function for BasicBlockRange type.
Definition binary32.hh:81
tlm_sync_enum
Definition fw_bw_ifs.hh:31

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