gem5  v22.1.0.0
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 
38 
39 namespace gem5
40 {
41 
42 class ProtocolTester;
43 class TesterThread;
44 
45 class Episode
46 {
47  public:
50 
51  class Action
52  {
53  public:
54  enum class Type
55  {
56  ACQUIRE,
57  RELEASE,
58  ATOMIC,
59  LOAD,
60  STORE,
61  };
62 
63  Action(Type t, int num_lanes);
64  ~Action() {}
65 
66  Type getType() const { return type; }
67  void setLocation(int lane, Location loc);
68  Location getLocation(int lane) const;
69  bool isAtomicAction() const;
70  bool isMemFenceAction() const;
71  const std::string printType() const;
72 
73  private:
75  int numLanes;
78  };
79 
81  int num_stores);
82  ~Episode();
83 
84  // return episode id
85  int getEpisodeId() const { return episodeId; }
86  // return the action at the head of the action queue
87  const Action* peekCurAction() const;
88  // pop the action at the head of the action queue
89  void popAction();
90  // check if there is more action to be issued in this episode
91  bool hasMoreActions() const { return nextActionIdx < actions.size();}
92  // complete this episode by releasing all locations & updating st effects
93  void completeEpisode();
94  // check if this episode is executing
95  bool isEpsActive() const { return isActive; }
96  // check if the input episode and this one have any data race
97  bool checkDRF(Location atomic_loc, Location loc, bool isStore,
98  int max_lane) const;
99 
100  private:
101  // pointers to tester, thread and address amanger structures
105 
106  // a unique episode id
108  // list of actions in this episode
111  // list of atomic locations picked for this episode
114 
115  // is a thread running this episode?
116  bool isActive;
117  // episode length = num_loads + num_stores
118  int numLoads;
120  // index of the next action in actions
122  // number of lanes in this thread
123  int numLanes;
124 
125  // randomly generate actions in this episode
126  void initActions();
127 };
128 
129 } // namespace gem5
130 
131 #endif /* CPU_TESTERS_PROTOCOL_TESTER_EPISODE_HH_ */
Action(Type t, int num_lanes)
Definition: episode.cc:272
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:76
Type getType() const
Definition: episode.hh:66
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:77
ActionList actions
Definition: episode.hh:110
int getEpisodeId() const
Definition: episode.hh:85
void completeEpisode()
Definition: episode.cc:200
Episode(ProtocolTester *tester, TesterThread *thread, int num_loads, int num_stores)
Definition: episode.cc:43
TesterThread * thread
Definition: episode.hh:103
AddressManager::Location Location
Definition: episode.hh:48
bool checkDRF(Location atomic_loc, Location loc, bool isStore, int max_lane) const
Definition: episode.cc:240
bool hasMoreActions() const
Definition: episode.hh:91
AddressManager::Value Value
Definition: episode.hh:49
bool isActive
Definition: episode.hh:116
bool isEpsActive() const
Definition: episode.hh:95
std::vector< Location > AtomicLocationList
Definition: episode.hh:112
void popAction()
Definition: episode.cc:86
int nextActionIdx
Definition: episode.hh:121
AddressManager * addrManager
Definition: episode.hh:104
const Action * peekCurAction() const
Definition: episode.cc:77
AtomicLocationList atomicLocs
Definition: episode.hh:113
std::vector< Action * > ActionList
Definition: episode.hh:109
void initActions()
Definition: episode.cc:93
ProtocolTester * tester
Definition: episode.hh:102
Bitfield< 51 > t
Definition: pagetable.hh:56
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....

Generated on Wed Dec 21 2022 10:22:31 for gem5 by doxygen 1.9.1