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

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