Deleted Added
sdiff udiff text old ( 13218:5e7df60c6cab ) new ( 13219:454ecc63338d )
full compact
1/*
2 * Copyright (c) 2013,2016,2018 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

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

47 */
48
49#include "mem/cache/tags/base.hh"
50
51#include <cassert>
52
53#include "base/types.hh"
54#include "mem/cache/base.hh"
55#include "mem/request.hh"
56#include "sim/core.hh"
57#include "sim/sim_exit.hh"
58#include "sim/system.hh"
59
60BaseTags::BaseTags(const Params *p)
61 : ClockedObject(p), blkSize(p->block_size), blkMask(blkSize - 1),
62 size(p->size),
63 lookupLatency(p->tag_latency),
64 accessLatency(p->sequential_access ?
65 p->tag_latency + p->data_latency :
66 std::max(p->tag_latency, p->data_latency)),
67 cache(nullptr),
68 warmupBound((p->warmup_percentage/100.0) * (p->size / p->block_size)),
69 warmedUp(false), numBlocks(p->size / p->block_size),
70 dataBlks(new uint8_t[p->size]) // Allocate data storage in one big chunk
71{
72}
73
74void
75BaseTags::setCache(BaseCache *_cache)
76{
77 assert(!cache);
78 cache = _cache;
79}
80
81std::vector<ReplaceableEntry*>
82BaseTags::getPossibleLocations(const Addr addr) const
83{
84 panic("Unimplemented getPossibleLocations for tags subclass");
85}
86
87CacheBlk*
88BaseTags::findBlock(Addr addr, bool is_secure) const
89{
90 // Extract block tag
91 Addr tag = extractTag(addr);
92
93 // Find possible locations for the given address
94 const std::vector<ReplaceableEntry*> locations =
95 getPossibleLocations(addr);
96
97 // Search for block
98 for (const auto& location : locations) {
99 CacheBlk* blk = static_cast<CacheBlk*>(location);
100 if ((blk->tag == tag) && blk->isValid() &&
101 (blk->isSecure() == is_secure)) {
102 return blk;
103 }
104 }
105
106 // Did not find block

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

129 warmupCycle = curTick();
130 }
131
132 // We only need to write into one tag and one data block.
133 tagAccesses += 1;
134 dataAccesses += 1;
135}
136
137void
138BaseTags::cleanupRefsVisitor(CacheBlk &blk)
139{
140 if (blk.isValid()) {
141 totalRefs += blk.refCount;
142 ++sampledRefs;
143 }
144}

--- 153 unchanged lines hidden ---