gem5  v21.1.0.2
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);
136  RubyTester& operator=(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__
gem5::RubyTester::getWritableCpuPort
RequestPort * getWritableCpuPort(int idx)
Definition: RubyTester.cc:218
gem5::operator<<
std::ostream & operator<<(std::ostream &os, const ArmSemihosting::InPlaceArg &ipa)
Definition: semihosting.cc:1045
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:252
gem5::RubyTester::CpuPort::globalIdx
PortID globalIdx
Definition: RubyTester.hh:68
gem5::RubyTester::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyTester.cc:118
gem5::RubyTester::hitCallback
void hitCallback(ruby::NodeID proc, ruby::SubBlock *data)
Definition: RubyTester.cc:226
gem5::RubyTester::m_last_progress_vector
std::vector< Cycles > m_last_progress_vector
Definition: RubyTester.hh:139
gem5::Port::name
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:111
gem5::RubyTester::m_deadlock_threshold
int m_deadlock_threshold
Definition: RubyTester.hh:146
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::RubyTester::getReadableCpuPort
RequestPort * getReadableCpuPort(int idx)
Definition: RubyTester.cc:210
gem5::RubyTester::m_num_inst_only_ports
int m_num_inst_only_ports
Definition: RubyTester.hh:151
gem5::RubyTester::print
void print(std::ostream &out) const
Definition: RubyTester.cc:280
gem5::ruby::SubBlock
Definition: SubBlock.hh:44
std::vector
STL vector class.
Definition: stl.hh:37
gem5::RubyTester::isInstDataCpuPort
bool isInstDataCpuPort(int idx)
Definition: RubyTester.cc:203
gem5::RubyTester
Definition: RubyTester.hh:60
gem5::RubyTester::m_wakeup_frequency
int m_wakeup_frequency
Definition: RubyTester.hh:149
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:253
CheckTable.hh
gem5::RubyTester::m_checks_to_complete
uint64_t m_checks_to_complete
Definition: RubyTester.hh:145
packet.hh
gem5::RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:77
gem5::RubyTester::SenderState
Definition: RubyTester.hh:89
gem5::RubyTester::m_num_inst_data_ports
int m_num_inst_data_ports
Definition: RubyTester.hh:152
gem5::RubyTester::requestorId
RequestorID requestorId()
Definition: RubyTester.hh:123
gem5::RubyTester::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: RubyTester.cc:135
gem5::RubyTester::operator=
RubyTester & operator=(const RubyTester &obj)
gem5::RubyTester::printStats
void printStats(std::ostream &out) const
Definition: RubyTester.hh:116
gem5::RubyTester::getCheckFlush
bool getCheckFlush()
Definition: RubyTester.hh:121
gem5::CheckTable
Definition: CheckTable.hh:45
gem5::RubyTester::RubyTester
RubyTester(const Params &p)
Definition: RubyTester.cc:55
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::RubyTester::isInstOnlyCpuPort
bool isInstOnlyCpuPort(int idx)
Definition: RubyTester.cc:197
gem5::RubyTester::CpuPort::CpuPort
CpuPort(const std::string &_name, RubyTester *_tester, PortID _id, PortID _index)
Definition: RubyTester.hh:77
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
TypeDefines.hh
gem5::RubyTester::CpuPort::tester
RubyTester * tester
Definition: RubyTester.hh:66
gem5::RubyTester::m_check_flush
bool m_check_flush
Definition: RubyTester.hh:150
port.hh
gem5::RubyTester::CpuPort::recvTimingResp
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyTester.cc:180
gem5::RubyTester::checkForDeadlock
void checkForDeadlock()
Definition: RubyTester.cc:264
gem5::RubyTester::printConfig
void printConfig(std::ostream &out) const
Definition: RubyTester.hh:118
gem5::Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:457
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::RubyTester::Params
RubyTesterParams Params
Definition: RubyTester.hh:97
gem5::RubyTester::_requestorId
RequestorID _requestorId
Definition: RubyTester.hh:127
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::RubyTester::wakeup
void wakeup()
Definition: RubyTester.cc:247
gem5::EventFunctionWrapper
Definition: eventq.hh:1115
gem5::RubyTester::writePorts
std::vector< RequestPort * > writePorts
Definition: RubyTester.hh:143
gem5::RubyTester::m_checkTable_ptr
CheckTable * m_checkTable_ptr
Definition: RubyTester.hh:138
gem5::RubyTester::CpuPort::recvReqRetry
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
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
clocked_object.hh
gem5::RubyTester::incrementCheckCompletions
void incrementCheckCompletions()
Definition: RubyTester.hh:114
gem5::RubyTester::CpuPort
Definition: RubyTester.hh:63
gem5::RubyTester::checkStartEvent
EventFunctionWrapper checkStartEvent
Definition: RubyTester.hh:125
gem5::RubyTester::m_num_readers
int m_num_readers
Definition: RubyTester.hh:148
gem5::ruby::NodeID
unsigned int NodeID
Definition: TypeDefines.hh:40
gem5::RubyTester::clearStats
void clearStats()
Definition: RubyTester.hh:117
gem5::RequestorID
uint16_t RequestorID
Definition: request.hh:95
gem5::RubyTester::readPorts
std::vector< RequestPort * > readPorts
Definition: RubyTester.hh:144
gem5::RubyTester::m_num_cpus
int m_num_cpus
Definition: RubyTester.hh:141
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::RubyTester::m_checks_completed
uint64_t m_checks_completed
Definition: RubyTester.hh:142
gem5::RubyTester::SenderState::SenderState
SenderState(Addr addr, int size)
Definition: RubyTester.hh:93
gem5::RubyTester::SenderState::subBlock
ruby::SubBlock subBlock
Definition: RubyTester.hh:91
SubBlock.hh
gem5::Named::_name
const std::string _name
Definition: named.hh:41
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
gem5::RubyTester::m_num_writers
int m_num_writers
Definition: RubyTester.hh:147
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::RubyTester::~RubyTester
~RubyTester()
Definition: RubyTester.cc:109

Generated on Tue Sep 21 2021 12:25:09 for gem5 by doxygen 1.8.17