stride.hh (13423:a414d6fccc4e) stride.hh (13424:1744211c9a65)
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 36 unchanged lines hidden (view full) ---

45 * Describes a strided prefetcher.
46 */
47
48#ifndef __MEM_CACHE_PREFETCH_STRIDE_HH__
49#define __MEM_CACHE_PREFETCH_STRIDE_HH__
50
51#include <string>
52#include <unordered_map>
1/*
2 * Copyright (c) 2012-2013, 2015 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 36 unchanged lines hidden (view full) ---

45 * Describes a strided prefetcher.
46 */
47
48#ifndef __MEM_CACHE_PREFETCH_STRIDE_HH__
49#define __MEM_CACHE_PREFETCH_STRIDE_HH__
50
51#include <string>
52#include <unordered_map>
53#include <vector>
53
54#include "base/types.hh"
55#include "mem/cache/prefetch/queued.hh"
56#include "mem/packet.hh"
57
58struct StridePrefetcherParams;
59
60class StridePrefetcher : public QueuedPrefetcher

--- 24 unchanged lines hidden (view full) ---

85 int confidence;
86 };
87
88 class PCTable
89 {
90 public:
91 PCTable(int assoc, int sets, const std::string name) :
92 pcTableAssoc(assoc), pcTableSets(sets), _name(name) {}
54
55#include "base/types.hh"
56#include "mem/cache/prefetch/queued.hh"
57#include "mem/packet.hh"
58
59struct StridePrefetcherParams;
60
61class StridePrefetcher : public QueuedPrefetcher

--- 24 unchanged lines hidden (view full) ---

86 int confidence;
87 };
88
89 class PCTable
90 {
91 public:
92 PCTable(int assoc, int sets, const std::string name) :
93 pcTableAssoc(assoc), pcTableSets(sets), _name(name) {}
93 StrideEntry** operator[] (int context) {
94
95 std::vector<std::vector<StrideEntry>>& operator[] (int context) {
94 auto it = entries.find(context);
95 if (it != entries.end())
96 return it->second;
97
98 return allocateNewContext(context);
99 }
100
101 ~PCTable();
102 private:
103 const std::string name() {return _name; }
104 const int pcTableAssoc;
105 const int pcTableSets;
106 const std::string _name;
96 auto it = entries.find(context);
97 if (it != entries.end())
98 return it->second;
99
100 return allocateNewContext(context);
101 }
102
103 ~PCTable();
104 private:
105 const std::string name() {return _name; }
106 const int pcTableAssoc;
107 const int pcTableSets;
108 const std::string _name;
107 std::unordered_map<int, StrideEntry**> entries;
109 std::unordered_map<int, std::vector<std::vector<StrideEntry>>> entries;
108
110
109 StrideEntry** allocateNewContext(int context);
111 std::vector<std::vector<StrideEntry>>& allocateNewContext(int context);
110 };
111 PCTable pcTable;
112
113 /**
114 * Search for an entry in the pc table.
115 *
116 * @param pc The PC to look for.
117 * @param is_secure True if the target memory space is secure.

--- 17 unchanged lines hidden ---
112 };
113 PCTable pcTable;
114
115 /**
116 * Search for an entry in the pc table.
117 *
118 * @param pc The PC to look for.
119 * @param is_secure True if the target memory space is secure.

--- 17 unchanged lines hidden ---