gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RubyDirectedTester.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3  * Copyright (c) 2009-2010 Advanced Micro Devices, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met: redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer;
10  * redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution;
13  * neither the name of the copyright holders nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef __CPU_DIRECTEDTEST_RUBYDIRECTEDTESTER_HH__
31 #define __CPU_DIRECTEDTEST_RUBYDIRECTEDTESTER_HH__
32 
33 #include <iostream>
34 #include <string>
35 #include <vector>
36 
40 #include "mem/mem_object.hh"
41 #include "mem/packet.hh"
42 #include "params/RubyDirectedTester.hh"
43 
44 class DirectedGenerator;
45 
47 {
48  public:
49  class CpuPort : public MasterPort
50  {
51  private:
53 
54  public:
55  CpuPort(const std::string &_name, RubyDirectedTester *_tester,
56  PortID _id)
57  : MasterPort(_name, _tester, _id), tester(_tester)
58  {}
59 
60  protected:
61  virtual bool recvTimingResp(PacketPtr pkt);
62  virtual void recvReqRetry()
63  { panic("%s does not expect a retry\n", name()); }
64  };
65 
66  typedef RubyDirectedTesterParams Params;
67  RubyDirectedTester(const Params *p);
69 
70  virtual BaseMasterPort &getMasterPort(const std::string &if_name,
71  PortID idx = InvalidPortID);
72 
73  MasterPort* getCpuPort(int idx);
74 
75  virtual void init();
76 
77  void wakeup();
78 
80 
81  void printStats(std::ostream& out) const {}
82  void clearStats() {}
83  void printConfig(std::ostream& out) const {}
84 
85  void print(std::ostream& out) const;
86 
87  protected:
88  class DirectedStartEvent : public Event
89  {
90  private:
92 
93  public:
95  : Event(CPU_Tick_Pri), tester(_tester)
96  {}
97  void process() { tester->wakeup(); }
98  virtual const char *description() const { return "Directed tick"; }
99  };
100 
102 
103  private:
104  void hitCallback(NodeID proc, Addr addr);
105 
106  void checkForDeadlock();
107 
108  // Private copy constructor and assignment operator
111 
116 };
117 
118 #endif // __CPU_DIRECTEDTEST_RUBYDIRECTEDTESTER_HH__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Definition: port.hh:167
virtual void recvReqRetry()
Called by the slave port if sendTimingReq was called on this master port (causing recvTimingReq to be...
const PortID InvalidPortID
Definition: types.hh:182
MasterPort * getCpuPort(int idx)
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
#define panic(...)
Definition: misc.hh:153
static const Priority CPU_Tick_Pri
CPU ticks must come after other associated CPU events (such as writebacks).
Definition: eventq.hh:161
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:99
void printConfig(std::ostream &out) const
CpuPort(const std::string &_name, RubyDirectedTester *_tester, PortID _id)
ip6_addr_t addr
Definition: inet.hh:335
MemObject declaration.
unsigned int NodeID
Definition: TypeDefines.hh:34
virtual const char * description() const
Return a C string describing the event.
void printStats(std::ostream &out) const
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
std::vector< MasterPort * > ports
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
RubyDirectedTesterParams Params
Declaration of the Packet class.
Definition: eventq.hh:185
DirectedStartEvent directedStartEvent
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
Definition: mem_object.hh:60
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.
RubyDirectedTester & operator=(const RubyDirectedTester &obj)
void print(std::ostream &out) const
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:181
DirectedGenerator * generator
RubyDirectedTester(const Params *p)
Bitfield< 0 > p
DirectedStartEvent(RubyDirectedTester *_tester)
void hitCallback(NodeID proc, Addr addr)

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