gem5  v20.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 class RubyTester : public ClockedObject
58 {
59  public:
60  class CpuPort : public RequestPort
61  {
62  private:
64  // index for m_last_progress_vector and hitCallback
66 
67  public:
68  //
69  // Currently, each instatiation of the RubyTester::CpuPort supports
70  // only instruction or data requests, not both. However, for those
71  // RubyPorts that support both types of requests, separate InstOnly
72  // and DataOnly CpuPorts will map to that RubyPort
73 
74  CpuPort(const std::string &_name, RubyTester *_tester, PortID _id,
75  PortID _index)
76  : RequestPort(_name, _tester, _id), tester(_tester),
77  globalIdx(_index)
78  {}
79 
80  protected:
81  virtual bool recvTimingResp(PacketPtr pkt);
82  virtual void recvReqRetry()
83  { panic("%s does not expect a retry\n", name()); }
84  };
85 
87  {
89 
90  SenderState(Addr addr, int size) : subBlock(addr, size) {}
91 
92  };
93 
94  typedef RubyTesterParams Params;
95  RubyTester(const Params *p);
96  ~RubyTester();
97 
98  Port &getPort(const std::string &if_name,
99  PortID idx=InvalidPortID) override;
100 
101  bool isInstOnlyCpuPort(int idx);
102  bool isInstDataCpuPort(int idx);
103 
106 
107  void init() override;
108 
109  void wakeup();
110 
112 
113  void printStats(std::ostream& out) const {}
114  void clearStats() {}
115  void printConfig(std::ostream& out) const {}
116 
117  void print(std::ostream& out) const;
118  bool getCheckFlush() { return m_check_flush; }
119 
121  protected:
123 
125 
126  private:
127  void hitCallback(NodeID proc, SubBlock* data);
128 
129  void checkForDeadlock();
130 
131  // Private copy constructor and assignment operator
132  RubyTester(const RubyTester& obj);
133  RubyTester& operator=(const RubyTester& obj);
134 
137 
150 };
151 
152 inline std::ostream&
153 operator<<(std::ostream& out, const RubyTester& obj)
154 {
155  obj.print(out);
156  out << std::flush;
157  return out;
158 }
159 
160 #endif // __CPU_RUBYTEST_RUBYTESTER_HH__
RubyTester::CpuPort
Definition: RubyTester.hh:60
RubyTester::hitCallback
void hitCallback(NodeID proc, SubBlock *data)
Definition: RubyTester.cc:223
RubyTester::CpuPort::CpuPort
CpuPort(const std::string &_name, RubyTester *_tester, PortID _id, PortID _index)
Definition: RubyTester.hh:74
CheckTable
Definition: CheckTable.hh:42
data
const char data[]
Definition: circlebuf.test.cc:42
operator<<
std::ostream & operator<<(std::ostream &out, const RubyTester &obj)
Definition: RubyTester.hh:153
RubyTester::RubyTester
RubyTester(const Params *p)
Definition: RubyTester.cc:52
RubyTester::requestorId
RequestorID requestorId()
Definition: RubyTester.hh:120
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
RubyTester::incrementCheckCompletions
void incrementCheckCompletions()
Definition: RubyTester.hh:111
RubyTester::m_num_inst_only_ports
int m_num_inst_only_ports
Definition: RubyTester.hh:148
RubyTester::CpuPort::globalIdx
PortID globalIdx
Definition: RubyTester.hh:65
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
std::vector< Cycles >
RubyTester::checkStartEvent
EventFunctionWrapper checkStartEvent
Definition: RubyTester.hh:122
RubyTester::getWritableCpuPort
RequestPort * getWritableCpuPort(int idx)
Definition: RubyTester.cc:215
CheckTable.hh
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
RubyTester::m_checks_completed
uint64_t m_checks_completed
Definition: RubyTester.hh:139
packet.hh
EventFunctionWrapper
Definition: eventq.hh:1101
RubyTester::isInstDataCpuPort
bool isInstDataCpuPort(int idx)
Definition: RubyTester.cc:200
RubyTester::~RubyTester
~RubyTester()
Definition: RubyTester.cc:106
RubyTester::checkForDeadlock
void checkForDeadlock()
Definition: RubyTester.cc:261
RequestorID
uint16_t RequestorID
Definition: request.hh:85
RubyTester::m_checkTable_ptr
CheckTable * m_checkTable_ptr
Definition: RubyTester.hh:135
RubyTester::clearStats
void clearStats()
Definition: RubyTester.hh:114
RubyTester::printConfig
void printConfig(std::ostream &out) const
Definition: RubyTester.hh:115
Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:431
RubyTester::getReadableCpuPort
RequestPort * getReadableCpuPort(int idx)
Definition: RubyTester.cc:207
RubyTester::m_num_inst_data_ports
int m_num_inst_data_ports
Definition: RubyTester.hh:149
RubyTester::m_num_cpus
int m_num_cpus
Definition: RubyTester.hh:138
RubyTester::m_deadlock_threshold
int m_deadlock_threshold
Definition: RubyTester.hh:143
RubyTester::printStats
void printStats(std::ostream &out) const
Definition: RubyTester.hh:113
RubyTester::CpuPort::tester
RubyTester * tester
Definition: RubyTester.hh:63
TypeDefines.hh
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:132
RubyTester::m_num_readers
int m_num_readers
Definition: RubyTester.hh:145
RubyTester::CpuPort::recvTimingResp
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyTester.cc:177
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
RubyTester::SenderState
Definition: RubyTester.hh:86
port.hh
RubyTester::writePorts
std::vector< RequestPort * > writePorts
Definition: RubyTester.hh:140
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
RubyTester::isInstOnlyCpuPort
bool isInstOnlyCpuPort(int idx)
Definition: RubyTester.cc:194
RubyTester::m_wakeup_frequency
int m_wakeup_frequency
Definition: RubyTester.hh:146
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
RubyTester::print
void print(std::ostream &out) const
Definition: RubyTester.cc:277
Port::name
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:106
RubyTester::Params
RubyTesterParams Params
Definition: RubyTester.hh:94
SubBlock
Definition: SubBlock.hh:38
RubyTester::SenderState::subBlock
SubBlock subBlock
Definition: RubyTester.hh:88
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
RubyTester::m_checks_to_complete
uint64_t m_checks_to_complete
Definition: RubyTester.hh:142
RubyTester::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyTester.cc:115
addr
ip6_addr_t addr
Definition: inet.hh:423
RubyTester::readPorts
std::vector< RequestPort * > readPorts
Definition: RubyTester.hh:141
RubyTester::getCheckFlush
bool getCheckFlush()
Definition: RubyTester.hh:118
RubyTester::operator=
RubyTester & operator=(const RubyTester &obj)
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:82
RubyTester::m_check_flush
bool m_check_flush
Definition: RubyTester.hh:147
NodeID
unsigned int NodeID
Definition: TypeDefines.hh:34
RubyTester
Definition: RubyTester.hh:57
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
RubyTester::m_num_writers
int m_num_writers
Definition: RubyTester.hh:144
RubyTester::_requestorId
RequestorID _requestorId
Definition: RubyTester.hh:124
RubyTester::wakeup
void wakeup()
Definition: RubyTester.cc:244
RubyTester::SenderState::SenderState
SenderState(Addr addr, int size)
Definition: RubyTester.hh:90
SubBlock.hh
RubyTester::m_last_progress_vector
std::vector< Cycles > m_last_progress_vector
Definition: RubyTester.hh:136
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171

Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17