gem5  v22.1.0.0
port_terminator.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 The Regents of the University of California.
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 #ifndef __MEM_PORT_TERMINATOR_HH__
30 #define __MEM_PORT_TERMINATOR_HH__
31 
45 #include <vector>
46 
47 #include "mem/port.hh"
48 #include "params/PortTerminator.hh"
49 #include "sim/sim_object.hh"
50 
51 namespace gem5
52 {
53 
54 class PortTerminator : public SimObject
55 {
56  private:
66  class ReqPort : public RequestPort
67  {
68  public:
69  ReqPort(const std::string &name, PortTerminator *owner):
71  {}
72  protected:
73  bool recvTimingResp(PacketPtr pkt) override
74  {
75  panic("Received an unexpected response. RequestPorts on a "
76  "PortTerminator never issue any requests. Therefore, they should "
77  "never receive a response.\n");
78  }
79 
80  void recvReqRetry() override
81  {
82  return;
83  }
84 
85  void recvRangeChange() override
86  {
87  return;
88  }
89  };
90 
97  class RespPort : public ResponsePort
98  {
99  public:
100  RespPort(const std::string &name, PortTerminator *owner):
102  {}
103  };
104 
106 
108 
109  public:
110  PortTerminator(const PortTerminatorParams &params);
111 
112  Port &getPort(const std::string &if_name,
113  PortID idx = InvalidPortID) override;
114 };
115 
116 }
117 
118 #endif // __MEM_PORT_TERMINATOR_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
definition of the ReqPort class.
bool recvTimingResp(PacketPtr pkt) override
Receive a timing response from the peer.
ReqPort(const std::string &name, PortTerminator *owner)
void recvReqRetry() override
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
void recvRangeChange() override
Called to receive an address range change from the peer response port.
definition of the RespPort class.
RespPort(const std::string &name, PortTerminator *owner)
PortTerminator(const PortTerminatorParams &params)
std::vector< ReqPort > reqPorts
std::vector< RespPort > respPorts
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Ports are used to interface objects to each other.
Definition: port.hh:62
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:111
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:79
SimObject & owner
Definition: port.hh:86
A ResponsePort is a specialization of a port.
Definition: port.hh:270
SimObject & owner
Definition: port.hh:279
Abstract superclass for simulation objects.
Definition: sim_object.hh:148
STL vector class.
Definition: stl.hh:37
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
const Params & params() const
Definition: sim_object.hh:176
Port Object Declaration.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const PortID InvalidPortID
Definition: types.hh:246
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245

Generated on Wed Dec 21 2022 10:22:37 for gem5 by doxygen 1.9.1