gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Sequencer.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
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
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __MEM_RUBY_SYSTEM_SEQUENCER_HH__
30 #define __MEM_RUBY_SYSTEM_SEQUENCER_HH__
31 
32 #include <iostream>
33 #include <list>
34 #include <unordered_map>
35 
37 #include "mem/ruby/protocol/MachineType.hh"
38 #include "mem/ruby/protocol/RubyRequestType.hh"
39 #include "mem/ruby/protocol/SequencerRequestType.hh"
42 #include "params/RubySequencer.hh"
43 
45 {
47  RubyRequestType m_type;
48  RubyRequestType m_second_type;
50  SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type,
51  RubyRequestType _m_second_type, Cycles _issue_time)
52  : pkt(_pkt), m_type(_m_type), m_second_type(_m_second_type),
53  issue_time(_issue_time)
54  {}
55 };
56 
57 std::ostream& operator<<(std::ostream& out, const SequencerRequest& obj);
58 
59 class Sequencer : public RubyPort
60 {
61  public:
62  typedef RubySequencerParams Params;
63  Sequencer(const Params *);
64  ~Sequencer();
65 
66  // Public Methods
67  void wakeup(); // Used only for deadlock detection
68  void resetStats();
69  void collateStats();
70  void regStats();
71 
72  void writeCallback(Addr address,
73  DataBlock& data,
74  const bool externalHit = false,
75  const MachineType mach = MachineType_NUM,
76  const Cycles initialRequestTime = Cycles(0),
77  const Cycles forwardRequestTime = Cycles(0),
78  const Cycles firstResponseTime = Cycles(0));
79 
80  void readCallback(Addr address,
81  DataBlock& data,
82  const bool externalHit = false,
83  const MachineType mach = MachineType_NUM,
84  const Cycles initialRequestTime = Cycles(0),
85  const Cycles forwardRequestTime = Cycles(0),
86  const Cycles firstResponseTime = Cycles(0));
87 
88  RequestStatus makeRequest(PacketPtr pkt);
89  bool empty() const;
90  int outstandingCount() const { return m_outstanding_count; }
91 
93  { return deadlockCheckEvent.scheduled(); }
94 
96  { deschedule(deadlockCheckEvent); }
97 
98  void print(std::ostream& out) const;
99  void checkCoherence(Addr address);
100 
101  void markRemoved();
102  void evictionCallback(Addr address);
103  void invalidateSC(Addr address);
104  int coreId() const { return m_coreId; }
105 
106  void recordRequestType(SequencerRequestType requestType);
107  Stats::Histogram& getOutstandReqHist() { return m_outstandReqHist; }
108 
109  Stats::Histogram& getLatencyHist() { return m_latencyHist; }
111  { return *m_typeLatencyHist[t]; }
112 
113  Stats::Histogram& getHitLatencyHist() { return m_hitLatencyHist; }
115  { return *m_hitTypeLatencyHist[t]; }
116 
118  { return *m_hitMachLatencyHist[t]; }
119 
121  { return *m_hitTypeMachLatencyHist[r][t]; }
122 
124  { return m_missLatencyHist; }
126  { return *m_missTypeLatencyHist[t]; }
127 
129  { return *m_missMachLatencyHist[t]; }
130 
132  getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
133  { return *m_missTypeMachLatencyHist[r][t]; }
134 
136  { return *m_IssueToInitialDelayHist[t]; }
137 
139  getInitialToForwardDelayHist(const MachineType t) const
140  { return *m_InitialToForwardDelayHist[t]; }
141 
143  getForwardRequestToFirstResponseHist(const MachineType t) const
144  { return *m_ForwardToFirstResponseDelayHist[t]; }
145 
147  getFirstResponseToCompletionDelayHist(const MachineType t) const
148  { return *m_FirstResponseToCompletionDelayHist[t]; }
149 
150  Stats::Counter getIncompleteTimes(const MachineType t) const
151  { return m_IncompleteTimes[t]; }
152 
153  private:
154  void issueRequest(PacketPtr pkt, RubyRequestType type);
155 
156  void hitCallback(SequencerRequest* srequest, DataBlock& data,
157  bool llscSuccess,
158  const MachineType mach, const bool externalHit,
159  const Cycles initialRequestTime,
160  const Cycles forwardRequestTime,
161  const Cycles firstResponseTime);
162 
163  void recordMissLatency(SequencerRequest* srequest, bool llscSuccess,
164  const MachineType respondingMach,
165  bool isExternalHit, Cycles initialRequestTime,
166  Cycles forwardRequestTime,
167  Cycles firstResponseTime);
168 
169  RequestStatus insertRequest(PacketPtr pkt, RubyRequestType primary_type,
170  RubyRequestType secondary_type);
171  bool handleLlsc(Addr address, SequencerRequest* request);
172 
173  // Private copy constructor and assignment operator
174  Sequencer(const Sequencer& obj);
175  Sequencer& operator=(const Sequencer& obj);
176 
177  private:
180 
183 
184  // The cache access latency for top-level caches (L0/L1). These are
185  // currently assessed at the beginning of each memory access through the
186  // sequencer.
187  // TODO: Migrate these latencies into top-level cache controllers.
190 
191  // RequestTable contains both read and write requests, handles aliasing
192  std::unordered_map<Addr, std::list<SequencerRequest>> m_RequestTable;
193 
194  // Global outstanding request count, across all request tables
197 
198  int m_coreId;
199 
201 
204 
208 
213 
218 
223 
228 
235 
237 };
238 
239 inline std::ostream&
240 operator<<(std::ostream& out, const Sequencer& obj)
241 {
242  obj.print(out);
243  out << std::flush;
244  return out;
245 }
246 
247 #endif // __MEM_RUBY_SYSTEM_SEQUENCER_HH__
Stats::Histogram & getMissLatencyHist()
Definition: Sequencer.hh:123
Stats::Histogram & getHitTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:114
int m_max_outstanding_requests
Definition: Sequencer.hh:178
std::unordered_map< Addr, std::list< SequencerRequest > > m_RequestTable
Definition: Sequencer.hh:192
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
Cycles issue_time
Definition: Sequencer.hh:49
std::vector< Stats::Histogram * > m_missTypeLatencyHist
Definition: Sequencer.hh:222
SequencerRequest(PacketPtr _pkt, RubyRequestType _m_type, RubyRequestType _m_second_type, Cycles _issue_time)
Definition: Sequencer.hh:50
Stats::Histogram & getTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:110
void print(std::ostream &out) const
Definition: Sequencer.cc:673
Stats::Histogram & getMissMachLatencyHist(uint32_t t) const
Definition: Sequencer.hh:128
Stats::Histogram & getMissTypeMachLatencyHist(uint32_t r, uint32_t t) const
Definition: Sequencer.hh:132
EventFunctionWrapper deadlockCheckEvent
Definition: Sequencer.hh:236
int coreId() const
Definition: Sequencer.hh:104
PacketPtr pkt
Definition: Sequencer.hh:46
std::vector< Stats::Histogram * > m_FirstResponseToCompletionDelayHist
Definition: Sequencer.hh:233
Stats::Histogram m_missLatencyHist
Histogram for holding latency profile of all requests that miss in the controller connected to this s...
Definition: Sequencer.hh:221
Stats::Histogram m_latencyHist
Histogram for holding latency profile of all requests.
Definition: Sequencer.hh:206
Stats::Histogram & getHitTypeMachLatencyHist(uint32_t r, uint32_t t)
Definition: Sequencer.hh:120
CacheMemory * m_dataCache_ptr
Definition: Sequencer.hh:181
Cycles m_inst_cache_hit_latency
Definition: Sequencer.hh:189
std::vector< Stats::Histogram * > m_typeLatencyHist
Definition: Sequencer.hh:207
STL vector class.
Definition: stl.hh:40
Stats::Histogram m_outstandReqHist
Histogram for number of outstanding requests per cycle.
Definition: Sequencer.hh:203
std::vector< Stats::Histogram * > m_ForwardToFirstResponseDelayHist
Definition: Sequencer.hh:232
CacheMemory * m_instCache_ptr
Definition: Sequencer.hh:182
double Counter
All counters are of 64-bit values.
Definition: types.hh:43
Stats::Histogram & getInitialToForwardDelayHist(const MachineType t) const
Definition: Sequencer.hh:139
RubyRequestType m_type
Definition: Sequencer.hh:47
std::vector< Stats::Histogram * > m_InitialToForwardDelayHist
Definition: Sequencer.hh:231
uint8_t type
Definition: inet.hh:333
bool m_deadlock_check_scheduled
Definition: Sequencer.hh:196
std::vector< Stats::Histogram * > m_hitTypeLatencyHist
Definition: Sequencer.hh:212
Stats::Histogram & getForwardRequestToFirstResponseHist(const MachineType t) const
Definition: Sequencer.hh:143
std::vector< Stats::Histogram * > m_IssueToInitialDelayHist
Histograms for recording the breakdown of miss latency.
Definition: Sequencer.hh:230
Stats::Histogram & getOutstandReqHist()
Definition: Sequencer.hh:107
Stats::Histogram & getHitLatencyHist()
Definition: Sequencer.hh:113
Stats::Histogram & getLatencyHist()
Definition: Sequencer.hh:109
int outstandingCount() const
Definition: Sequencer.hh:90
A simple histogram stat.
Definition: statistics.hh:2629
Stats::Histogram & getHitMachLatencyHist(uint32_t t)
Definition: Sequencer.hh:117
RubyRequestType m_second_type
Definition: Sequencer.hh:48
std::vector< Stats::Histogram * > m_missMachLatencyHist
Histograms for profiling the latencies for requests that required external messages.
Definition: Sequencer.hh:226
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
int m_coreId
Definition: Sequencer.hh:198
Stats::Histogram & getFirstResponseToCompletionDelayHist(const MachineType t) const
Definition: Sequencer.hh:147
Stats::Counter getIncompleteTimes(const MachineType t) const
Definition: Sequencer.hh:150
std::vector< std::vector< Stats::Histogram * > > m_missTypeMachLatencyHist
Definition: Sequencer.hh:227
std::vector< Stats::Counter > m_IncompleteTimes
Definition: Sequencer.hh:234
bool isDeadlockEventScheduled() const
Definition: Sequencer.hh:92
Cycles m_data_cache_hit_latency
Definition: Sequencer.hh:188
void descheduleDeadlockEvent()
Definition: Sequencer.hh:95
bool m_runningGarnetStandalone
Definition: Sequencer.hh:200
std::ostream & operator<<(std::ostream &out, const SequencerRequest &obj)
std::vector< Stats::Histogram * > m_hitMachLatencyHist
Histograms for profiling the latencies for requests that did not required external messages...
Definition: Sequencer.hh:216
Stats::Histogram & getMissTypeLatencyHist(uint32_t t)
Definition: Sequencer.hh:125
Cycles m_deadlock_threshold
Definition: Sequencer.hh:179
Bitfield< 5 > t
RubySequencerParams Params
Definition: Sequencer.hh:62
const char data[]
int m_outstanding_count
Definition: Sequencer.hh:195
Stats::Histogram m_hitLatencyHist
Histogram for holding latency profile of all requests that hit in the controller connected to this se...
Definition: Sequencer.hh:211
std::vector< std::vector< Stats::Histogram * > > m_hitTypeMachLatencyHist
Definition: Sequencer.hh:217
Stats::Histogram & getIssueToInitialDelayHist(uint32_t t) const
Definition: Sequencer.hh:135

Generated on Fri Feb 28 2020 16:27:02 for gem5 by doxygen 1.8.13