gem5 v24.0.0.0
Loading...
Searching...
No Matches
sector_tags.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 ARM Limited
3 *
4 * The license below extends only to copyright in the software and shall
5 * not be construed as granting a license to any other intellectual
6 * property including but not limited to intellectual property relating
7 * to a hardware implementation of the functionality of the software
8 * licensed hereunder. You may use the software subject to the license
9 * terms below provided that you ensure that this notice is replicated
10 * unmodified and in its entirety in all distributions of the software,
11 * modified or unmodified, in source code or in binary form.
12 *
13 * Copyright (c) 2018 Inria
14 * All rights reserved.
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions are
18 * met: redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer;
20 * redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution;
23 * neither the name of the copyright holders nor the names of its
24 * contributors may be used to endorse or promote products derived from
25 * this software without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 */
39
45#ifndef __MEM_CACHE_TAGS_SECTOR_TAGS_HH__
46#define __MEM_CACHE_TAGS_SECTOR_TAGS_HH__
47
48#include <cstdint>
49#include <string>
50#include <vector>
51
52#include "base/statistics.hh"
55#include "mem/packet.hh"
56#include "params/SectorTags.hh"
57
58namespace gem5
59{
60
61namespace replacement_policy
62{
63 class Base;
64}
65class ReplaceableEntry;
66
75class SectorTags : public BaseTags
76{
77 private:
82
83 protected:
85 unsigned allocAssoc;
86
88 const bool sequentialAccess;
89
92
94 const unsigned numBlocksPerSector;
95
97 const unsigned numSectors;
98
99 // Organization of an address:
100 // Tag | Placement Location | Sector Offset # | Offset #
102 const int sectorShift;
103
105 const unsigned sectorMask;
106
108 {
110
111 SectorTagsStats(BaseTagStats &base_group, SectorTags& _tags);
112
113 void regStats() override;
114
118
119 public:
121 typedef SectorTagsParams Params;
122
126 SectorTags(const Params &p);
127
131 virtual ~SectorTags() {};
132
136 void tagsInit() override;
137
144 void invalidate(CacheBlk *blk) override;
145
156 CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override;
157
164 void insertBlock(const PacketPtr pkt, CacheBlk *blk) override;
165
166 void moveBlock(CacheBlk *src_blk, CacheBlk *dest_blk) override;
167
176 CacheBlk* findBlock(Addr addr, bool is_secure) const override;
177
188 CacheBlk* findVictim(Addr addr, const bool is_secure,
189 const std::size_t size,
190 std::vector<CacheBlk*>& evict_blks,
191 const uint64_t partition_id) override;
192
199 int extractSectorOffset(Addr addr) const;
200
207 Addr regenerateBlkAddr(const CacheBlk* blk) const override;
208
218 bool anyBlk(std::function<bool(CacheBlk &)> visitor) override;
219};
220
221} // namespace gem5
222
223#endif //__MEM_CACHE_TAGS_SECTOR_TAGS_HH__
A common base class of Cache tagstore objects.
Definition base.hh:74
const unsigned size
The size of the cache.
Definition base.hh:81
A Basic Cache block.
Definition cache_blk.hh:72
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
A SectorTags cache tag store.
Addr regenerateBlkAddr(const CacheBlk *blk) const override
Regenerate the block address from the tag and location.
const unsigned sectorMask
Mask out all bits that aren't part of the sector tag.
CacheBlk * findVictim(Addr addr, const bool is_secure, const std::size_t size, std::vector< CacheBlk * > &evict_blks, const uint64_t partition_id) override
Find replacement victim based on address.
std::vector< SectorSubBlk > blks
The cache blocks.
replacement_policy::Base * replacementPolicy
Replacement policy.
SectorTagsParams Params
Convenience typedef.
gem5::SectorTags::SectorTagsStats sectorStats
int extractSectorOffset(Addr addr) const
Calculate a block's offset in a sector from the address.
CacheBlk * findBlock(Addr addr, bool is_secure) const override
Finds the given address in the cache, do not update replacement data.
SectorTags(const Params &p)
Construct and initialize this tag store.
std::vector< SectorBlk > secBlks
The cache sector blocks.
const bool sequentialAccess
Whether tags and data are accessed sequentially.
bool anyBlk(std::function< bool(CacheBlk &)> visitor) override
Find if any of the sub-blocks satisfies a condition.
virtual ~SectorTags()
Destructor.
void tagsInit() override
Initialize blocks as SectorBlk and SectorSubBlk instances.
void insertBlock(const PacketPtr pkt, CacheBlk *blk) override
Insert the new block into the cache and update replacement data.
const unsigned numSectors
The number of sectors in the cache.
const unsigned numBlocksPerSector
Number of data blocks per sector.
const int sectorShift
The amount to shift the address to get the sector tag.
unsigned allocAssoc
The allocatable associativity of the cache (alloc mask).
void invalidate(CacheBlk *blk) override
This function updates the tags when a block is invalidated but does not invalidate the block itself.
CacheBlk * accessBlock(const PacketPtr pkt, Cycles &lat) override
Access block and update replacement data.
void moveBlock(CacheBlk *src_blk, CacheBlk *dest_blk) override
Move a block's metadata to another location decided by the replacement policy.
A common base class of cache replacement policy objects.
Definition base.hh:55
Statistics container.
Definition group.hh:93
A vector of scalar stats.
STL vector class.
Definition stl.hh:37
Declaration of a common base class for cache tagstore objects.
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Declaration of the Packet class.
Copyright (c) 2018, 2020 Inria All rights reserved.
Declaration of Statistics objects.
TODO: It would be good if these stats were acquired after warmup.
Definition base.hh:112
void regStats() override
Callback to set stat parameters.
statistics::Vector evictionsReplacement
Number of sub-blocks evicted due to a replacement.
SectorTagsStats(BaseTagStats &base_group, SectorTags &_tags)

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0