gem5  v21.1.0.2
memtest.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, 2021 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 <unordered_map>
45 #include <unordered_set>
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 
54 namespace gem5
55 {
56 
70 class MemTest : public ClockedObject
71 {
72 
73  public:
74 
75  typedef MemTestParams Params;
76  MemTest(const Params &p);
77 
78 
79  Port &getPort(const std::string &if_name,
80  PortID idx=InvalidPortID) override;
81 
82  protected:
83 
84  void tick();
85 
87 
88  void noRequest();
89 
91 
92  void noResponse();
93 
95 
96  class CpuPort : public RequestPort
97  {
99 
100  public:
101 
102  CpuPort(const std::string &_name, MemTest &_memtest)
103  : RequestPort(_name, &_memtest), memtest(_memtest)
104  { }
105 
106  protected:
107 
108  bool recvTimingResp(PacketPtr pkt);
109 
111 
113 
114  Tick recvAtomicSnoop(PacketPtr pkt) { return 0; }
115 
116  void recvReqRetry();
117  };
118 
120 
122 
123  const unsigned size;
124 
126 
127  const unsigned percentReads;
128  const unsigned percentFunctional;
129  const unsigned percentUncacheable;
130 
133 
134  unsigned int id;
135 
136  std::unordered_set<Addr> outstandingAddrs;
137 
138  // store the expected value for the addresses we have touched
139  std::unordered_map<Addr, uint8_t> referenceData;
140 
141  const unsigned blockSize;
142 
144 
152  {
153  return (addr & ~blockAddrMask);
154  }
155 
159 
160  const unsigned progressInterval; // frequency of progress reports
162  Tick nextProgressMessage; // access # for next progress report
163 
164  uint64_t numReads;
165  uint64_t numWrites;
166  const uint64_t maxLoads;
167 
168  const bool atomic;
169 
170  const bool suppressFuncErrors;
171  protected:
173  {
177  } stats;
178 
185  void completeRequest(PacketPtr pkt, bool functional = false);
186 
187  bool sendPkt(PacketPtr pkt);
188 
189  void recvRetry();
190 
191 };
192 
193 } // namespace gem5
194 
195 #endif // __CPU_MEMTEST_MEMTEST_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::MemTest::numReads
uint64_t numReads
Definition: memtest.hh:164
gem5::MemTest::MemTest
MemTest(const Params &p)
Definition: memtest.cc:84
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:252
gem5::MemTest::requestorId
RequestorID requestorId
Request id for all generated traffic.
Definition: memtest.hh:132
gem5::MemTest::noResponse
void noResponse()
Definition: memtest.cc:310
gem5::MemTest
The MemTest class tests a cache coherent memory system by generating false sharing and verifying the ...
Definition: memtest.hh:70
gem5::MemTest::percentFunctional
const unsigned percentFunctional
Definition: memtest.hh:128
gem5::MemTest::nextProgressMessage
Tick nextProgressMessage
Definition: memtest.hh:162
gem5::MemTest::sendPkt
bool sendPkt(PacketPtr pkt)
Definition: memtest.cc:71
gem5::MemTest::referenceData
std::unordered_map< Addr, uint8_t > referenceData
Definition: memtest.hh:139
gem5::MemTest::percentUncacheable
const unsigned percentUncacheable
Definition: memtest.hh:129
gem5::MemTest::retryPkt
PacketPtr retryPkt
Definition: memtest.hh:121
gem5::MemTest::tick
void tick()
Definition: memtest.cc:206
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:253
gem5::MemTest::numWrites
uint64_t numWrites
Definition: memtest.hh:165
gem5::MemTest::interval
const Cycles interval
Definition: memtest.hh:125
gem5::MemTest::noResponseEvent
EventFunctionWrapper noResponseEvent
Definition: memtest.hh:94
gem5::MemTest::uncacheAddr
const Addr uncacheAddr
Definition: memtest.hh:158
gem5::RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:77
gem5::MemTest::recvRetry
void recvRetry()
Definition: memtest.cc:316
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
stats.hh
gem5::MemTest::CpuPort::CpuPort
CpuPort(const std::string &_name, MemTest &_memtest)
Definition: memtest.hh:102
gem5::MemTest::blockAddrMask
const Addr blockAddrMask
Definition: memtest.hh:143
gem5::MemTest::stats
gem5::MemTest::MemTestStats stats
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:283
gem5::MemTest::CpuPort::recvFunctionalSnoop
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition: memtest.hh:112
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
statistics.hh
gem5::MemTest::noRequestEvent
EventFunctionWrapper noRequestEvent
Definition: memtest.hh:90
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::MemTest::port
CpuPort port
Definition: memtest.hh:119
gem5::MemTest::tickEvent
EventFunctionWrapper tickEvent
Definition: memtest.hh:86
gem5::MemTest::suppressFuncErrors
const bool suppressFuncErrors
Definition: memtest.hh:170
gem5::MemTest::CpuPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: memtest.cc:58
gem5::MemTest::MemTestStats::numWrites
statistics::Scalar numWrites
Definition: memtest.hh:176
gem5::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:123
port.hh
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::EventFunctionWrapper
Definition: eventq.hh:1115
gem5::MemTest::progressInterval
const unsigned progressInterval
Definition: memtest.hh:160
gem5::MemTest::maxLoads
const uint64_t maxLoads
Definition: memtest.hh:166
gem5::MemTest::atomic
const bool atomic
Definition: memtest.hh:168
gem5::MemTest::Params
MemTestParams Params
Definition: memtest.hh:75
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::MemTest::MemTestStats::numReads
statistics::Scalar numReads
Definition: memtest.hh:175
clocked_object.hh
gem5::MemTest::CpuPort::recvTimingSnoopReq
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition: memtest.hh:110
gem5::MemTest::baseAddr2
const Addr baseAddr2
Definition: memtest.hh:157
gem5::MemTest::size
const unsigned size
Definition: memtest.hh:123
gem5::MemTest::blockAlign
Addr blockAlign(Addr addr) const
Get the block aligned address.
Definition: memtest.hh:151
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::MemTest::progressCheck
const Cycles progressCheck
Definition: memtest.hh:161
gem5::MemTest::CpuPort::recvAtomicSnoop
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition: memtest.hh:114
gem5::RequestorID
uint16_t RequestorID
Definition: request.hh:95
gem5::MemTest::CpuPort::memtest
MemTest & memtest
Definition: memtest.hh:98
gem5::MemTest::percentReads
const unsigned percentReads
Definition: memtest.hh:127
gem5::MemTest::outstandingAddrs
std::unordered_set< Addr > outstandingAddrs
Definition: memtest.hh:136
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::MemTest::blockSize
const unsigned blockSize
Definition: memtest.hh:141
gem5::MemTest::CpuPort
Definition: memtest.hh:96
gem5::MemTest::baseAddr1
const Addr baseAddr1
Definition: memtest.hh:156
gem5::MemTest::MemTestStats
Definition: memtest.hh:172
gem5::MemTest::completeRequest
void completeRequest(PacketPtr pkt, bool functional=false)
Complete a request by checking the response.
Definition: memtest.cc:132
gem5::MemTest::MemTestStats::MemTestStats
MemTestStats(statistics::Group *parent)
Definition: memtest.cc:195
gem5::Named::_name
const std::string _name
Definition: named.hh:41
gem5::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:65
gem5::MemTest::id
unsigned int id
Definition: memtest.hh:134
gem5::MemTest::noRequest
void noRequest()
Definition: memtest.cc:304
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
eventq.hh

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