gem5  v20.1.0.0
memtest.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 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) 2002-2005 The Regents of The University of Michigan
15  * All rights reserved.
16  *
17  * Redistribution and use in source and binary forms, with or without
18  * modification, are permitted provided that the following conditions are
19  * met: redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer;
21  * redistributions in binary form must reproduce the above copyright
22  * notice, this list of conditions and the following disclaimer in the
23  * documentation and/or other materials provided with the distribution;
24  * neither the name of the copyright holders nor the names of its
25  * contributors may be used to endorse or promote products derived from
26  * this software without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  */
40 
41 #ifndef __CPU_MEMTEST_MEMTEST_HH__
42 #define __CPU_MEMTEST_MEMTEST_HH__
43 
44 #include <set>
45 #include <unordered_map>
46 
47 #include "base/statistics.hh"
48 #include "mem/port.hh"
49 #include "params/MemTest.hh"
50 #include "sim/clocked_object.hh"
51 #include "sim/eventq.hh"
52 #include "sim/stats.hh"
53 
67 class MemTest : public ClockedObject
68 {
69 
70  public:
71 
72  typedef MemTestParams Params;
73  MemTest(const Params *p);
74 
75 
76  Port &getPort(const std::string &if_name,
77  PortID idx=InvalidPortID) override;
78 
79  protected:
80 
81  void tick();
82 
84 
85  void noRequest();
86 
88 
89  void noResponse();
90 
92 
93  class CpuPort : public RequestPort
94  {
96 
97  public:
98 
99  CpuPort(const std::string &_name, MemTest &_memtest)
100  : RequestPort(_name, &_memtest), memtest(_memtest)
101  { }
102 
103  protected:
104 
105  bool recvTimingResp(PacketPtr pkt);
106 
108 
110 
111  Tick recvAtomicSnoop(PacketPtr pkt) { return 0; }
112 
113  void recvReqRetry();
114  };
115 
117 
119 
120  const unsigned size;
121 
123 
124  const unsigned percentReads;
125  const unsigned percentFunctional;
126  const unsigned percentUncacheable;
127 
130 
131  unsigned int id;
132 
133  std::set<Addr> outstandingAddrs;
134 
135  // store the expected value for the addresses we have touched
136  std::unordered_map<Addr, uint8_t> referenceData;
137 
138  const unsigned blockSize;
139 
141 
149  {
150  return (addr & ~blockAddrMask);
151  }
152 
156 
157  const unsigned progressInterval; // frequency of progress reports
159  Tick nextProgressMessage; // access # for next progress report
160 
161  uint64_t numReads;
162  uint64_t numWrites;
163  const uint64_t maxLoads;
164 
165  const bool atomic;
166 
167  const bool suppressFuncErrors;
168  protected:
169  struct MemTestStats : public Stats::Group
170  {
171  MemTestStats(Stats::Group *parent);
174  } stats;
175 
182  void completeRequest(PacketPtr pkt, bool functional = false);
183 
184  bool sendPkt(PacketPtr pkt);
185 
186  void recvRetry();
187 
188 };
189 
190 #endif // __CPU_MEMTEST_MEMTEST_HH__
MemTest::atomic
const bool atomic
Definition: memtest.hh:165
MemTest::CpuPort::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition: memtest.hh:107
MemTest::noResponseEvent
EventFunctionWrapper noResponseEvent
Definition: memtest.hh:91
MemTest::MemTestStats
Definition: memtest.hh:169
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
MemTest::CpuPort::CpuPort
CpuPort(const std::string &_name, MemTest &_memtest)
Definition: memtest.hh:99
MemTest::tick
void tick()
Definition: memtest.cc:202
MemTest::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: memtest.cc:122
MemTest::nextProgressMessage
Tick nextProgressMessage
Definition: memtest.hh:159
MemTest::suppressFuncErrors
const bool suppressFuncErrors
Definition: memtest.hh:167
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
MemTest::progressCheck
const Cycles progressCheck
Definition: memtest.hh:158
MemTest::CpuPort::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition: memtest.hh:109
MemTest::MemTestStats::MemTestStats
MemTestStats(Stats::Group *parent)
Definition: memtest.cc:193
MemTest::percentUncacheable
const unsigned percentUncacheable
Definition: memtest.hh:126
MemTest::port
CpuPort port
Definition: memtest.hh:116
MemTest::progressInterval
const unsigned progressInterval
Definition: memtest.hh:157
MemTest::MemTestStats::numWrites
Stats::Scalar numWrites
Definition: memtest.hh:173
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
MemTest::tickEvent
EventFunctionWrapper tickEvent
Definition: memtest.hh:83
EventFunctionWrapper
Definition: eventq.hh:1101
MemTest::percentReads
const unsigned percentReads
Definition: memtest.hh:124
MemTest::referenceData
std::unordered_map< Addr, uint8_t > referenceData
Definition: memtest.hh:136
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
stats.hh
RequestorID
uint16_t RequestorID
Definition: request.hh:85
MemTest::blockAlign
Addr blockAlign(Addr addr) const
Get the block aligned address.
Definition: memtest.hh:148
MemTest::sendPkt
bool sendPkt(PacketPtr pkt)
Definition: memtest.cc:69
statistics.hh
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
port.hh
MemTest::outstandingAddrs
std::set< Addr > outstandingAddrs
Definition: memtest.hh:133
MemTest::size
const unsigned size
Definition: memtest.hh:120
MemTest::blockSize
const unsigned blockSize
Definition: memtest.hh:138
MemTest::CpuPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: memtest.cc:56
MemTest::id
unsigned int id
Definition: memtest.hh:131
MemTest
The MemTest class tests a cache coherent memory system by generating false sharing and verifying the ...
Definition: memtest.hh:67
MemTest::percentFunctional
const unsigned percentFunctional
Definition: memtest.hh:125
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
MemTest::stats
MemTest::MemTestStats stats
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
MemTest::baseAddr1
Addr baseAddr1
Definition: memtest.hh:153
MemTest::MemTest
MemTest(const Params *p)
Definition: memtest.cc:82
MemTest::blockAddrMask
const Addr blockAddrMask
Definition: memtest.hh:140
MemTest::noRequest
void noRequest()
Definition: memtest.cc:300
MemTest::retryPkt
PacketPtr retryPkt
Definition: memtest.hh:118
MemTest::numReads
uint64_t numReads
Definition: memtest.hh:161
MemTest::interval
const Cycles interval
Definition: memtest.hh:122
MemTest::baseAddr2
Addr baseAddr2
Definition: memtest.hh:154
MemTest::maxLoads
const uint64_t maxLoads
Definition: memtest.hh:163
MemTest::CpuPort
Definition: memtest.hh:93
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Stats::Group
Statistics container.
Definition: group.hh:83
MemTest::requestorId
RequestorID requestorId
Request id for all generated traffic.
Definition: memtest.hh:129
addr
ip6_addr_t addr
Definition: inet.hh:423
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
MemTest::noRequestEvent
EventFunctionWrapper noRequestEvent
Definition: memtest.hh:87
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
MemTest::MemTestStats::numReads
Stats::Scalar numReads
Definition: memtest.hh:172
MemTest::CpuPort::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition: memtest.hh:111
MemTest::recvRetry
void recvRetry()
Definition: memtest.cc:312
MemTest::CpuPort::recvReqRetry
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: memtest.cc:63
MemTest::numWrites
uint64_t numWrites
Definition: memtest.hh:162
MemTest::completeRequest
void completeRequest(PacketPtr pkt, bool functional=false)
Complete a request by checking the response.
Definition: memtest.cc:131
MemTest::noResponse
void noResponse()
Definition: memtest.cc:306
MemTest::CpuPort::memtest
MemTest & memtest
Definition: memtest.hh:95
MemTest::uncacheAddr
Addr uncacheAddr
Definition: memtest.hh:155
MemTest::Params
MemTestParams Params
Definition: memtest.hh:72
eventq.hh

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