gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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/mem_object.hh"
51 #include "mem/packet.hh"
54 #include "params/RubyTester.hh"
55 
56 class RubyTester : public MemObject
57 {
58  public:
59  class CpuPort : public MasterPort
60  {
61  private:
63  // index for m_last_progress_vector and hitCallback
65 
66  public:
67  //
68  // Currently, each instatiation of the RubyTester::CpuPort supports
69  // only instruction or data requests, not both. However, for those
70  // RubyPorts that support both types of requests, separate InstOnly
71  // and DataOnly CpuPorts will map to that RubyPort
72 
73  CpuPort(const std::string &_name, RubyTester *_tester, PortID _id,
74  PortID _index)
75  : MasterPort(_name, _tester, _id), tester(_tester),
76  globalIdx(_index)
77  {}
78 
79  protected:
80  virtual bool recvTimingResp(PacketPtr pkt);
81  virtual void recvReqRetry()
82  { panic("%s does not expect a retry\n", name()); }
83  };
84 
86  {
88 
89  SenderState(Addr addr, int size) : subBlock(addr, size) {}
90 
91  };
92 
93  typedef RubyTesterParams Params;
94  RubyTester(const Params *p);
95  ~RubyTester();
96 
97  virtual BaseMasterPort &getMasterPort(const std::string &if_name,
98  PortID idx = InvalidPortID);
99 
100  bool isInstOnlyCpuPort(int idx);
101  bool isInstDataCpuPort(int idx);
102 
103  MasterPort* getReadableCpuPort(int idx);
104  MasterPort* getWritableCpuPort(int idx);
105 
106  virtual void init();
107 
108  void wakeup();
109 
111 
112  void printStats(std::ostream& out) const {}
113  void clearStats() {}
114  void printConfig(std::ostream& out) const {}
115 
116  void print(std::ostream& out) const;
117  bool getCheckFlush() { return m_check_flush; }
118 
120  protected:
121  class CheckStartEvent : public Event
122  {
123  private:
125 
126  public:
128  : Event(CPU_Tick_Pri), tester(_tester)
129  {}
130  void process() { tester->wakeup(); }
131  virtual const char *description() const { return "RubyTester tick"; }
132  };
133 
135 
137 
138  private:
139  void hitCallback(NodeID proc, SubBlock* data);
140 
141  void checkForDeadlock();
142 
143  // Private copy constructor and assignment operator
144  RubyTester(const RubyTester& obj);
145  RubyTester& operator=(const RubyTester& obj);
146 
149 
162 };
163 
164 inline std::ostream&
165 operator<<(std::ostream& out, const RubyTester& obj)
166 {
167  obj.print(out);
168  out << std::flush;
169  return out;
170 }
171 
172 #endif // __CPU_RUBYTEST_RUBYTESTER_HH__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Definition: port.hh:167
RubyTester * tester
Definition: RubyTester.hh:62
void printConfig(std::ostream &out) const
Definition: RubyTester.hh:114
int m_num_inst_data_ports
Definition: RubyTester.hh:161
const PortID InvalidPortID
Definition: types.hh:182
#define panic(...)
Definition: misc.hh:153
void checkForDeadlock()
Definition: RubyTester.cc:260
int m_num_inst_only_ports
Definition: RubyTester.hh:160
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Definition: eventq.hh:161
MasterPort * getReadableCpuPort(int idx)
Definition: RubyTester.cc:206
int m_num_readers
Definition: RubyTester.hh:157
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:99
bool isInstOnlyCpuPort(int idx)
Definition: RubyTester.cc:193
ip6_addr_t addr
Definition: inet.hh:335
MemObject declaration.
std::vector< Cycles > m_last_progress_vector
Definition: RubyTester.hh:148
CheckStartEvent checkStartEvent
Definition: RubyTester.hh:134
RubyTester(const Params *p)
Definition: RubyTester.cc:52
void clearStats()
Definition: RubyTester.hh:113
MasterID _masterId
Definition: RubyTester.hh:136
void printStats(std::ostream &out) const
Definition: RubyTester.hh:112
MasterID masterId()
Definition: RubyTester.hh:119
SenderState(Addr addr, int size)
Definition: RubyTester.hh:89
const char data[]
Definition: circlebuf.cc:43
virtual void recvReqRetry()
Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be...
Definition: RubyTester.hh:81
uint64_t m_checks_completed
Definition: RubyTester.hh:151
unsigned int NodeID
Definition: TypeDefines.hh:34
bool isInstDataCpuPort(int idx)
Definition: RubyTester.cc:199
int m_num_cpus
Definition: RubyTester.hh:150
int m_deadlock_threshold
Definition: RubyTester.hh:155
bool getCheckFlush()
Definition: RubyTester.hh:117
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
Definition: RubyTester.cc:130
RubyTesterParams Params
Definition: RubyTester.hh:93
RubyTester & operator=(const RubyTester &obj)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
uint16_t MasterID
Definition: request.hh:85
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
CheckTable * m_checkTable_ptr
Definition: RubyTester.hh:147
MasterPort * getWritableCpuPort(int idx)
Definition: RubyTester.cc:214
CpuPort(const std::string &_name, RubyTester *_tester, PortID _id, PortID _index)
Definition: RubyTester.hh:73
std::vector< MasterPort * > writePorts
Definition: RubyTester.hh:152
void print(std::ostream &out) const
Definition: RubyTester.cc:276
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a MemObject that sees the packet.
Definition: packet.hh:377
bool m_check_flush
Definition: RubyTester.hh:159
void hitCallback(NodeID proc, SubBlock *data)
Definition: RubyTester.cc:222
int size()
Definition: pagetable.hh:146
Declaration of the Packet class.
Definition: eventq.hh:185
std::ostream & operator<<(std::ostream &out, const RubyTester &obj)
Definition: RubyTester.hh:165
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
Definition: mem_object.hh:60
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyTester.cc:113
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
Definition: port.hh:115
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the slave port.
Definition: RubyTester.cc:175
CheckStartEvent(RubyTester *_tester)
Definition: RubyTester.hh:127
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:181
std::vector< MasterPort * > readPorts
Definition: RubyTester.hh:153
uint64_t m_checks_to_complete
Definition: RubyTester.hh:154
Bitfield< 0 > p
int m_num_writers
Definition: RubyTester.hh:156
int m_wakeup_frequency
Definition: RubyTester.hh:158
void wakeup()
Definition: RubyTester.cc:243
void incrementCheckCompletions()
Definition: RubyTester.hh:110
virtual const char * description() const
Return a C string describing the event.
Definition: RubyTester.hh:131

Generated on Fri Jun 9 2017 13:03:44 for gem5 by doxygen 1.8.6