gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
stride.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Inria
3  * Copyright (c) 2012-2013, 2015 ARM Limited
4  * All rights reserved
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2005 The Regents of The University of Michigan
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Authors: Ron Dreslinski
42  * Daniel Carvalho
43  */
44 
50 #ifndef __MEM_CACHE_PREFETCH_STRIDE_HH__
51 #define __MEM_CACHE_PREFETCH_STRIDE_HH__
52 
53 #include <string>
54 #include <unordered_map>
55 #include <vector>
56 
57 #include "base/types.hh"
60 #include "mem/packet.hh"
61 
63 struct StridePrefetcherParams;
64 
66 {
67  protected:
68  const int maxConf;
69  const int threshConf;
70  const int minConf;
71  const int startConf;
72 
73  const int pcTableAssoc;
74  const int pcTableSets;
75 
76  const bool useMasterId;
77 
78  const int degree;
79 
82 
83  struct StrideEntry : public ReplaceableEntry
84  {
86  StrideEntry();
87 
89  void invalidate();
90 
93  bool isSecure;
94  int stride;
96  };
97 
98  class PCTable
99  {
100  public:
109  PCTable(int assoc, int sets, const std::string name,
110  BaseReplacementPolicy* replacementPolicy);
111 
115  ~PCTable();
116 
124  StrideEntry* findEntry(Addr pc, bool is_secure);
125 
132  StrideEntry* findVictim(Addr pc);
133 
134  private:
135  const std::string name() {return _name; }
136  const int pcTableSets;
137  const std::string _name;
139 
144 
151  Addr pcHash(Addr pc) const;
152  };
153  std::unordered_map<int, PCTable> pcTables;
154 
162  PCTable* findTable(int context);
163 
170  PCTable* allocateNewContext(int context);
171 
172  public:
173  StridePrefetcher(const StridePrefetcherParams *p);
174 
175  void calculatePrefetch(const PrefetchInfo &pfi,
176  std::vector<AddrPriority> &addresses) override;
177 };
178 
179 #endif // __MEM_CACHE_PREFETCH_STRIDE_HH__
const int degree
Definition: stride.hh:78
PCTable * allocateNewContext(int context)
Create a PC table for the given context.
Definition: stride.cc:106
void invalidate()
Invalidate the entry.
Definition: stride.cc:69
StridePrefetcher(const StridePrefetcherParams *p)
Definition: stride.cc:78
const std::string name()
Definition: stride.hh:135
const int startConf
Definition: stride.hh:71
BaseReplacementPolicy * replacementPolicy
Replacement policy used in the PC tables.
Definition: stride.hh:81
A common base class of cache replacement policy objects.
Definition: base.hh:48
STL vector class.
Definition: stl.hh:40
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
Definition: stride.cc:141
Bitfield< 4 > pc
Class containing the information needed by the prefetch to train and generate new prefetch requests...
Definition: base.hh:92
const bool useMasterId
Definition: stride.hh:76
const int pcTableSets
Definition: stride.hh:74
std::vector< std::vector< StrideEntry > > entries
Definition: stride.hh:138
const int minConf
Definition: stride.hh:70
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
virtual const std::string name() const
Definition: sim_object.hh:120
PCTable * findTable(int context)
Try to find a table of entries for the given context.
Definition: stride.cc:94
StrideEntry()
Default constructor.
Definition: stride.cc:63
Declaration of the Packet class.
std::unordered_map< int, PCTable > pcTables
Definition: stride.hh:153
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
const int threshConf
Definition: stride.hh:69
Bitfield< 0 > p
BaseReplacementPolicy * replacementPolicy
Replacement policy used by StridePrefetcher.
Definition: stride.hh:143
const int pcTableAssoc
Definition: stride.hh:73
const std::string _name
Definition: stride.hh:137
const int maxConf
Definition: stride.hh:68

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