gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
54namespace gem5
55{
56
70class 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)
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 // Set if reached the maximum number of outstanding requests.
124 // Won't tick until a response is received.
126
127 const unsigned size;
128
130
131 const unsigned percentReads;
132 const unsigned percentFunctional;
133 const unsigned percentUncacheable;
134 const unsigned percentAtomic;
135
138
139 unsigned int id;
140
141 std::unordered_set<Addr> outstandingAddrs;
142 std::unordered_map<Addr, uint8_t> atomicPendingData;
143
144 // store the expected value for the addresses we have touched
145 std::unordered_map<Addr, uint8_t> referenceData;
146
148
150
151 const unsigned sizeBlocks;
152
160 {
161 return (addr & ~blockAddrMask);
162 }
163
167
168 const unsigned progressInterval; // frequency of progress reports
170 Tick nextProgressMessage; // access # for next progress report
171
172 uint64_t numReads;
173 uint64_t numWrites;
174 uint64_t numAtomics;
175 const uint64_t maxLoads;
176
177 const bool atomic;
178
180 protected:
188
195 void completeRequest(PacketPtr pkt, bool functional = false);
196
197 bool sendPkt(PacketPtr pkt);
198
199 void recvRetry();
200
201};
202
203} // namespace gem5
204
205#endif // __CPU_MEMTEST_MEMTEST_HH__
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Definition memtest.hh:112
Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Definition memtest.hh:114
void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
Definition memtest.hh:110
CpuPort(const std::string &_name, MemTest &_memtest)
Definition memtest.hh:102
void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition memtest.cc:65
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition memtest.cc:58
The MemTest class tests a cache coherent memory system by generating false sharing and verifying the ...
Definition memtest.hh:71
EventFunctionWrapper tickEvent
Definition memtest.hh:86
MemTest(const Params &p)
Definition memtest.cc:84
void noResponse()
Definition memtest.cc:374
const bool suppressFuncErrors
Definition memtest.hh:179
std::unordered_set< Addr > outstandingAddrs
Definition memtest.hh:141
const uint64_t maxLoads
Definition memtest.hh:175
void tick()
Definition memtest.cc:237
const Addr baseAddr1
Definition memtest.hh:164
gem5::MemTest::MemTestStats stats
const Cycles interval
Definition memtest.hh:129
std::unordered_map< Addr, uint8_t > atomicPendingData
Definition memtest.hh:142
const Cycles progressCheck
Definition memtest.hh:169
void recvRetry()
Definition memtest.cc:380
const Addr baseAddr2
Definition memtest.hh:165
const unsigned percentFunctional
Definition memtest.hh:132
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition memtest.cc:127
Addr blockAlign(Addr addr) const
Get the block aligned address.
Definition memtest.hh:159
const unsigned percentAtomic
Definition memtest.hh:134
uint64_t numWrites
Definition memtest.hh:173
const unsigned size
Definition memtest.hh:127
const unsigned percentReads
Definition memtest.hh:131
void completeRequest(PacketPtr pkt, bool functional=false)
Complete a request by checking the response.
Definition memtest.cc:136
const Addr uncacheAddr
Definition memtest.hh:166
const unsigned progressInterval
Definition memtest.hh:168
std::unordered_map< Addr, uint8_t > referenceData
Definition memtest.hh:145
MemTestParams Params
Definition memtest.hh:75
unsigned int id
Definition memtest.hh:139
PacketPtr retryPkt
Definition memtest.hh:121
uint64_t numReads
Definition memtest.hh:172
Tick nextProgressMessage
Definition memtest.hh:170
const Addr blockSize
Definition memtest.hh:147
const unsigned sizeBlocks
Definition memtest.hh:151
EventFunctionWrapper noRequestEvent
Definition memtest.hh:90
uint64_t numAtomics
Definition memtest.hh:174
const bool atomic
Definition memtest.hh:177
EventFunctionWrapper noResponseEvent
Definition memtest.hh:94
const Addr blockAddrMask
Definition memtest.hh:149
RequestorID requestorId
Request id for all generated traffic.
Definition memtest.hh:137
bool sendPkt(PacketPtr pkt)
Definition memtest.cc:71
bool waitResponse
Definition memtest.hh:125
const unsigned percentUncacheable
Definition memtest.hh:133
CpuPort port
Definition memtest.hh:119
void noRequest()
Definition memtest.cc:368
const std::string _name
Definition named.hh:41
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Ports are used to interface objects to each other.
Definition port.hh:62
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
ClockedObject declaration and implementation.
Port Object Declaration.
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
uint16_t RequestorID
Definition request.hh:95
Declaration of Statistics objects.
statistics::Scalar numWrites
Definition memtest.hh:185
statistics::Scalar numReads
Definition memtest.hh:184
statistics::Scalar numAtomics
Definition memtest.hh:186
MemTestStats(statistics::Group *parent)
Definition memtest.cc:224

Generated on Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0