gem5  v22.1.0.0
RubyTester.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 ARM Limited
3  * All rights reserved
4  *
5  * The license below extends only to copyright in the software and shall
6  * not be construed as granting a license to any other intellectual
7  * property including but not limited to intellectual property relating
8  * to a hardware implementation of the functionality of the software
9  * licensed hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
15  * Copyright (c) 2009 Advanced Micro Devices, Inc.
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #ifndef __CPU_RUBYTEST_RUBYTESTER_HH__
43 #define __CPU_RUBYTEST_RUBYTESTER_HH__
44 
45 #include <iostream>
46 #include <string>
47 #include <vector>
48 
50 #include "mem/packet.hh"
51 #include "mem/port.hh"
54 #include "params/RubyTester.hh"
55 #include "sim/clocked_object.hh"
56 
57 namespace gem5
58 {
59 
60 class RubyTester : public ClockedObject
61 {
62  public:
63  class CpuPort : public RequestPort
64  {
65  private:
67  // index for m_last_progress_vector and hitCallback
69 
70  public:
71  //
72  // Currently, each instatiation of the RubyTester::CpuPort supports
73  // only instruction or data requests, not both. However, for those
74  // RubyPorts that support both types of requests, separate InstOnly
75  // and DataOnly CpuPorts will map to that RubyPort
76 
77  CpuPort(const std::string &_name, RubyTester *_tester, PortID _id,
78  PortID _index)
79  : RequestPort(_name, _tester, _id), tester(_tester),
80  globalIdx(_index)
81  {}
82 
83  protected:
84  virtual bool recvTimingResp(PacketPtr pkt);
85  virtual void recvReqRetry()
86  { panic("%s does not expect a retry\n", name()); }
87  };
88 
90  {
92 
93  SenderState(Addr addr, int size) : subBlock(addr, size) {}
94 
95  };
96 
97  typedef RubyTesterParams Params;
98  RubyTester(const Params &p);
99  ~RubyTester();
100 
101  Port &getPort(const std::string &if_name,
102  PortID idx=InvalidPortID) override;
103 
104  bool isInstOnlyCpuPort(int idx);
105  bool isInstDataCpuPort(int idx);
106 
109 
110  void init() override;
111 
112  void wakeup();
113 
115 
116  void printStats(std::ostream& out) const {}
117  void clearStats() {}
118  void printConfig(std::ostream& out) const {}
119 
120  void print(std::ostream& out) const;
121  bool getCheckFlush() { return m_check_flush; }
122 
124  protected:
126 
128 
129  private:
131 
132  void checkForDeadlock();
133 
134  // Private copy constructor and assignment operator
135  RubyTester(const RubyTester& obj);
137 
140 
153 };
154 
155 inline std::ostream&
156 operator<<(std::ostream& out, const RubyTester& obj)
157 {
158  obj.print(out);
159  out << std::flush;
160  return out;
161 }
162 
163 } // namespace gem5
164 
165 #endif // __CPU_RUBYTEST_RUBYTESTER_HH__
const char data[]
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
const std::string _name
Definition: named.hh:41
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
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
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyTester.cc:180
virtual void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: RubyTester.hh:85
CpuPort(const std::string &_name, RubyTester *_tester, PortID _id, PortID _index)
Definition: RubyTester.hh:77
EventFunctionWrapper checkStartEvent
Definition: RubyTester.hh:125
void checkForDeadlock()
Definition: RubyTester.cc:264
void printStats(std::ostream &out) const
Definition: RubyTester.hh:116
RubyTester & operator=(const RubyTester &obj)
std::vector< RequestPort * > readPorts
Definition: RubyTester.hh:144
bool isInstOnlyCpuPort(int idx)
Definition: RubyTester.cc:197
void printConfig(std::ostream &out) const
Definition: RubyTester.hh:118
bool getCheckFlush()
Definition: RubyTester.hh:121
void incrementCheckCompletions()
Definition: RubyTester.hh:114
RequestPort * getWritableCpuPort(int idx)
Definition: RubyTester.cc:218
void hitCallback(ruby::NodeID proc, ruby::SubBlock *data)
Definition: RubyTester.cc:226
RubyTester(const Params &p)
Definition: RubyTester.cc:55
RequestorID requestorId()
Definition: RubyTester.hh:123
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyTester.cc:118
bool isInstDataCpuPort(int idx)
Definition: RubyTester.cc:203
std::vector< RequestPort * > writePorts
Definition: RubyTester.hh:143
RubyTester(const RubyTester &obj)
RequestPort * getReadableCpuPort(int idx)
Definition: RubyTester.cc:210
uint64_t m_checks_to_complete
Definition: RubyTester.hh:145
RequestorID _requestorId
Definition: RubyTester.hh:127
CheckTable * m_checkTable_ptr
Definition: RubyTester.hh:138
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: RubyTester.cc:135
uint64_t m_checks_completed
Definition: RubyTester.hh:142
std::vector< Cycles > m_last_progress_vector
Definition: RubyTester.hh:139
RubyTesterParams Params
Definition: RubyTester.hh:97
void print(std::ostream &out) const
Definition: RubyTester.cc:280
STL vector class.
Definition: stl.hh:37
ClockedObject declaration and implementation.
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
Port Object Declaration.
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 3 > addr
Definition: types.hh:84
unsigned int NodeID
Definition: TypeDefines.hh:42
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const PortID InvalidPortID
Definition: types.hh:246
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
std::ostream & operator<<(std::ostream &os, const ArmSemihosting::InPlaceArg &ipa)
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
uint16_t RequestorID
Definition: request.hh:95
Declaration of the Packet class.
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:468
SenderState(Addr addr, int size)
Definition: RubyTester.hh:93

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