gem5 v23.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 DRAMSysConfiguration::Configuration const &config,
40 bool recordable,
41 AddrRange range) :
42 sc_core::sc_module(name),
43 dramsys(instantiateDRAMSys(recordable, config)),
44 range(range)
45{
46 tSocket.register_nb_transport_fw(this, &DRAMSysWrapper::nb_transport_fw);
47 tSocket.register_transport_dbg(this, &DRAMSysWrapper::transport_dbg);
48 iSocket.register_nb_transport_bw(this, &DRAMSysWrapper::nb_transport_bw);
49 iSocket.bind(dramsys->tSocket);
50
51 // Register a callback to compensate for the destructor not
52 // being called.
54 [this]()
55 {
56 // Workaround for BUG GEM5-1233
58 });
59}
60
61std::shared_ptr<::DRAMSys>
63 bool recordable,
64 DRAMSysConfiguration::Configuration const &config)
65{
66 return recordable
67 ? std::make_shared<::DRAMSysRecordable>("DRAMSys", config)
68 : std::make_shared<::DRAMSys>("DRAMSys", config);
69}
70
73 tlm::tlm_phase &phase,
74 sc_core::sc_time &fwDelay)
75{
76 // Subtract base address offset
77 payload.set_address(payload.get_address() - range.start());
78
79 return iSocket->nb_transport_fw(payload, phase, fwDelay);
80}
81
84 tlm::tlm_phase &phase,
85 sc_core::sc_time &bwDelay)
86{
87 return tSocket->nb_transport_bw(payload, phase, bwDelay);
88}
89
91{
92 // Subtract base address offset
93 trans.set_address(trans.get_address() - range.start());
94
95 return iSocket->transport_dbg(trans);
96}
97
98} // namespace memory
99} // 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
static std::shared_ptr<::DRAMSys > instantiateDRAMSys(bool recordable, DRAMSysConfiguration::Configuration const &config)
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)
DRAMSysWrapper(sc_core::sc_module_name name, DRAMSysConfiguration::Configuration const &config, bool recordable, AddrRange range)
tlm_utils::simple_initiator_socket< DRAMSysWrapper > iSocket
unsigned int transport_dbg(tlm::tlm_generic_payload &trans)
std::shared_ptr<::DRAMSys > dramsys
tlm_utils::simple_target_socket< DRAMSysWrapper > tSocket
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
Addr start() const
Get the start address of the range.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
void registerExitCallback(const std::function< void()> &callback)
Register an exit callback.
Definition core.cc:143
tlm_sync_enum
Definition fw_bw_ifs.hh:31
Definition mem.h:38
const std::string & name()
Definition trace.cc:48

Generated on Mon Jul 10 2023 14:24:32 for gem5 by doxygen 1.9.7