gem5 v25.0.0.1
Loading...
Searching...
No Matches
port_wrapper.cc
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google, LLC.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include "mem/port_wrapper.hh"
29
30namespace gem5
31{
32
37
38void
47
48bool
53
54void
59
60void
65
66void
68 RecvReqRetryCallback retry_cb)
69{
70 recvTimingRespCb = std::move(resp_cb);
71 recvReqRetryCb = std::move(retry_cb);
72}
73
78
84
85bool
90
91void
96
97Tick
99{
100 return recvAtomicCb(packet);
101}
102
103Tick
105 MemBackdoorPtr& backdoor)
106{
108 return ResponsePort::recvAtomicBackdoor(packet, backdoor);
109 }
110 return recvAtomicBackdoorCb(packet, backdoor);
111}
112
113void
118
119void
121 MemBackdoorPtr& backdoor)
122{
125 return;
126 }
127 recvMemBackdoorReqCb(req, backdoor);
128}
129
130void
135
136void
138 RecvRespRetryCallback retry_cb)
139{
140 recvTimingReqCb = std::move(timing_cb);
141 recvRespRetryCb = std::move(retry_cb);
142}
143
144void
146 RecvAtomicBackdoorCallback backdoor_cb)
147{
148 recvAtomicCb = std::move(atomic_cb);
149 recvAtomicBackdoorCb = std::move(backdoor_cb);
150}
151
152void
155{
156 recvFunctionalCb = std::move(func_cb);
157 recvMemBackdoorReqCb = std::move(backdoor_cb);
158}
159
160} // namespace gem5
const std::string name() const
Return port name (for DPRINTF).
Definition port.hh:111
RecvTimingRespCallback recvTimingRespCb
RequestPortWrapper(const std::string &name, PortID id=InvalidPortID)
void recvRangeChange() override
Called to receive an address range change from the peer response port.
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
bool recvTimingResp(PacketPtr) override
Receive a timing response from the peer.
std::function< bool(PacketPtr)> RecvTimingRespCallback
void setRangeChangeCallback(RecvReqRetryCallback)
void setTimingCallbacks(RecvTimingRespCallback, RecvReqRetryCallback)
RecvReqRetryCallback recvReqRetryCb
RecvRangeChangeCallback recvRangeChangeCb
std::function< void()> RecvReqRetryCallback
virtual void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition port.hh:297
RequestPort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Request port.
Definition port.cc:125
void setTimingCallbacks(RecvTimingReqCallback, RecvRespRetryCallback)
RecvAtomicBackdoorCallback recvAtomicBackdoorCb
std::function< void()> RecvRespRetryCallback
std::function< void(const MemBackdoorReq &, MemBackdoorPtr &)> RecvMemBackdoorReqCallback
RecvMemBackdoorReqCallback recvMemBackdoorReqCb
ResponsePortWrapper(const std::string &name, PortID id=InvalidPortID)
Tick recvAtomic(PacketPtr) override
Receive an atomic request packet from the peer.
Tick recvAtomicBackdoor(PacketPtr, MemBackdoorPtr &) override
Default implementations.
void recvRespRetry() override
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
void setFunctionalCallbacks(RecvFunctionalCallback, RecvMemBackdoorReqCallback=nullptr)
RecvFunctionalCallback recvFunctionalCb
void setGetAddrRangesCallback(GetAddrRangesCallback)
std::function< AddrRangeList()> GetAddrRangesCallback
RecvAtomicCallback recvAtomicCb
std::function< void(PacketPtr)> RecvFunctionalCallback
void recvFunctional(PacketPtr) override
Receive a functional request packet from the peer.
AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
RecvTimingReqCallback recvTimingReqCb
GetAddrRangesCallback getAddrRangesCb
void recvMemBackdoorReq(const MemBackdoorReq &, MemBackdoorPtr &) override
Receive a request for a back door to a range of memory.
std::function< bool(PacketPtr)> RecvTimingReqCallback
RecvRespRetryCallback recvRespRetryCb
std::function< Tick(PacketPtr, MemBackdoorPtr &)> RecvAtomicBackdoorCallback
std::function< Tick(PacketPtr)> RecvAtomicCallback
bool recvTimingReq(PacketPtr) override
Receive a timing request from the peer.
void setAtomicCallbacks(RecvAtomicCallback, RecvAtomicBackdoorCallback=nullptr)
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Default implementations.
Definition port.cc:262
ResponsePort(const std::string &name, SimObject *_owner, PortID id=InvalidPortID)
Response port.
Definition port.cc:218
void recvMemBackdoorReq(const MemBackdoorReq &req, MemBackdoorPtr &backdoor) override
Receive a request for a back door to a range of memory.
Definition port.cc:273
std::list< AddrRange > AddrRangeList
Convenience typedef for a collection of address ranges.
Definition addr_range.hh:64
Bitfield< 33 > id
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
MemBackdoor * MemBackdoorPtr
Definition backdoor.hh:127
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
Packet * PacketPtr
PortWrapper Object Declaration.

Generated on Sat Oct 18 2025 08:06:45 for gem5 by doxygen 1.14.0