gem5 v24.1.0.1
Loading...
Searching...
No Matches
episode.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017-2021 Advanced Micro Devices, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef CPU_TESTERS_PROTOCOL_TESTER_EPISODE_HH_
33#define CPU_TESTERS_PROTOCOL_TESTER_EPISODE_HH_
34
35#include <vector>
36
37#include "base/random.hh"
39
40namespace gem5
41{
42
43class ProtocolTester;
44class TesterThread;
45
47{
48 public:
51
52 class Action
53 {
54 public:
55 enum class Type
56 {
57 ACQUIRE,
58 RELEASE,
59 ATOMIC,
60 LOAD,
61 STORE,
62 };
63
64 Action(Type t, int num_lanes);
66
67 Type getType() const { return type; }
68 void setLocation(int lane, Location loc);
69 Location getLocation(int lane) const;
70 bool isAtomicAction() const;
71 bool isMemFenceAction() const;
72 const std::string printType() const;
73
74 private:
79 };
80
82 int num_stores);
83 ~Episode();
84
85 // return episode id
86 int getEpisodeId() const { return episodeId; }
87 // return the action at the head of the action queue
88 const Action* peekCurAction() const;
89 // pop the action at the head of the action queue
90 void popAction();
91 // check if there is more action to be issued in this episode
92 bool hasMoreActions() const { return nextActionIdx < actions.size();}
93 // complete this episode by releasing all locations & updating st effects
94 void completeEpisode();
95 // check if this episode is executing
96 bool isEpsActive() const { return isActive; }
97 // check if the input episode and this one have any data race
98 bool checkDRF(Location atomic_loc, Location loc, bool isStore,
99 int max_lane) const;
100
101 private:
102 // pointers to tester, thread and address amanger structures
106
107 // a unique episode id
109 // list of actions in this episode
112 // list of atomic locations picked for this episode
115
117
118 // is a thread running this episode?
120 // episode length = num_loads + num_stores
123 // index of the next action in actions
125 // number of lanes in this thread
127
128 // randomly generate actions in this episode
129 void initActions();
130};
131
132} // namespace gem5
133
134#endif /* CPU_TESTERS_PROTOCOL_TESTER_EPISODE_HH_ */
Location getLocation(int lane) const
Definition episode.cc:289
const std::string printType() const
Definition episode.cc:308
std::vector< Location > LocationList
Definition episode.hh:77
Type getType() const
Definition episode.hh:67
bool isMemFenceAction() const
Definition episode.cc:302
bool isAtomicAction() const
Definition episode.cc:296
void setLocation(int lane, Location loc)
Definition episode.cc:282
LocationList locations
Definition episode.hh:78
ActionList actions
Definition episode.hh:111
int getEpisodeId() const
Definition episode.hh:86
void completeEpisode()
Definition episode.cc:200
Random::RandomPtr rng
Definition episode.hh:116
TesterThread * thread
Definition episode.hh:104
AddressManager::Location Location
Definition episode.hh:49
bool checkDRF(Location atomic_loc, Location loc, bool isStore, int max_lane) const
Definition episode.cc:240
bool hasMoreActions() const
Definition episode.hh:92
AddressManager::Value Value
Definition episode.hh:50
bool isEpsActive() const
Definition episode.hh:96
std::vector< Location > AtomicLocationList
Definition episode.hh:113
void popAction()
Definition episode.cc:86
int nextActionIdx
Definition episode.hh:124
AddressManager * addrManager
Definition episode.hh:105
const Action * peekCurAction() const
Definition episode.cc:77
AtomicLocationList atomicLocs
Definition episode.hh:114
std::vector< Action * > ActionList
Definition episode.hh:110
void initActions()
Definition episode.cc:93
ProtocolTester * tester
Definition episode.hh:103
std::shared_ptr< Random > RandomPtr
Definition random.hh:65
static RandomPtr genRandom()
Definition random.hh:68
STL vector class.
Definition stl.hh:37
Bitfield< 5 > t
Definition misc_types.hh:71
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36

Generated on Mon Jan 13 2025 04:28:32 for gem5 by doxygen 1.9.8