gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
sector_tags.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Inria
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 
34 #ifndef __MEM_CACHE_TAGS_SECTOR_TAGS_HH__
35 #define __MEM_CACHE_TAGS_SECTOR_TAGS_HH__
36 
37 #include <cstdint>
38 #include <string>
39 #include <vector>
40 
41 #include "base/statistics.hh"
42 #include "mem/cache/tags/base.hh"
44 #include "mem/packet.hh"
45 #include "params/SectorTags.hh"
46 
47 namespace gem5
48 {
49 
50 namespace replacement_policy
51 {
52  class Base;
53 }
54 class ReplaceableEntry;
55 
64 class SectorTags : public BaseTags
65 {
66  private:
71 
72  protected:
74  unsigned allocAssoc;
75 
77  const bool sequentialAccess;
78 
81 
83  const unsigned numBlocksPerSector;
84 
86  const unsigned numSectors;
87 
88  // Organization of an address:
89  // Tag | Placement Location | Sector Offset # | Offset #
91  const int sectorShift;
92 
94  const unsigned sectorMask;
95 
97  {
98  const SectorTags& tags;
99 
100  SectorTagsStats(BaseTagStats &base_group, SectorTags& _tags);
101 
102  void regStats() override;
103 
106  } sectorStats;
107 
108  public:
110  typedef SectorTagsParams Params;
111 
115  SectorTags(const Params &p);
116 
120  virtual ~SectorTags() {};
121 
125  void tagsInit() override;
126 
133  void invalidate(CacheBlk *blk) override;
134 
145  CacheBlk* accessBlock(const PacketPtr pkt, Cycles &lat) override;
146 
153  void insertBlock(const PacketPtr pkt, CacheBlk *blk) override;
154 
155  void moveBlock(CacheBlk *src_blk, CacheBlk *dest_blk) override;
156 
165  CacheBlk* findBlock(Addr addr, bool is_secure) const override;
166 
176  CacheBlk* findVictim(Addr addr, const bool is_secure,
177  const std::size_t size,
178  std::vector<CacheBlk*>& evict_blks) override;
179 
186  int extractSectorOffset(Addr addr) const;
187 
194  Addr regenerateBlkAddr(const CacheBlk* blk) const override;
195 
205  bool anyBlk(std::function<bool(CacheBlk &)> visitor) override;
206 };
207 
208 } // namespace gem5
209 
210 #endif //__MEM_CACHE_TAGS_SECTOR_TAGS_HH__
gem5::SectorTags::invalidate
void invalidate(CacheBlk *blk) override
This function updates the tags when a block is invalidated but does not invalidate the block itself.
Definition: sector_tags.cc:119
gem5::SectorTags::sectorShift
const int sectorShift
The amount to shift the address to get the sector tag.
Definition: sector_tags.hh:91
gem5::SectorTags::insertBlock
void insertBlock(const PacketPtr pkt, CacheBlk *blk) override
Insert the new block into the cache and update replacement data.
Definition: sector_tags.cc:179
gem5::SectorTags::findBlock
CacheBlk * findBlock(Addr addr, bool is_secure) const override
Finds the given address in the cache, do not update replacement data.
Definition: sector_tags.cc:250
gem5::SectorTags::allocAssoc
unsigned allocAssoc
The allocatable associativity of the cache (alloc mask).
Definition: sector_tags.hh:74
gem5::SectorTags::blks
std::vector< SectorSubBlk > blks
The cache blocks.
Definition: sector_tags.hh:68
gem5::SectorTags::~SectorTags
virtual ~SectorTags()
Destructor.
Definition: sector_tags.hh:120
gem5::SectorTags::regenerateBlkAddr
Addr regenerateBlkAddr(const CacheBlk *blk) const override
Regenerate the block address from the tag and location.
Definition: sector_tags.cc:332
gem5::SectorTags::findVictim
CacheBlk * findVictim(Addr addr, const bool is_secure, const std::size_t size, std::vector< CacheBlk * > &evict_blks) override
Find replacement victim based on address.
Definition: sector_tags.cc:276
gem5::SectorTags::Params
SectorTagsParams Params
Convenience typedef.
Definition: sector_tags.hh:110
gem5::BaseTags::BaseTagStats
TODO: It would be good if these stats were acquired after warmup.
Definition: base.hh:108
gem5::SectorTags::tagsInit
void tagsInit() override
Initialize blocks as SectorBlk and SectorSubBlk instances.
Definition: sector_tags.cc:71
gem5::SectorTags::SectorTagsStats
Definition: sector_tags.hh:96
gem5::statistics::Vector
A vector of scalar stats.
Definition: statistics.hh:2005
std::vector
STL vector class.
Definition: stl.hh:37
gem5::SectorTags::numBlocksPerSector
const unsigned numBlocksPerSector
Number of data blocks per sector.
Definition: sector_tags.hh:83
gem5::CacheBlk
A Basic Cache block.
Definition: cache_blk.hh:70
packet.hh
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::BaseTags::Params
BaseTagsParams Params
Definition: base.hh:161
gem5::SectorTags::secBlks
std::vector< SectorBlk > secBlks
The cache sector blocks.
Definition: sector_tags.hh:70
gem5::auxv::Base
@ Base
Definition: aux_vector.hh:74
gem5::SectorTags::sectorStats
gem5::SectorTags::SectorTagsStats sectorStats
gem5::BaseTags::size
const unsigned size
The size of the cache.
Definition: base.hh:81
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
statistics.hh
gem5::SectorTags::replacementPolicy
replacement_policy::Base * replacementPolicy
Replacement policy.
Definition: sector_tags.hh:80
gem5::SectorTags::SectorTagsStats::regStats
void regStats() override
Callback to set stat parameters.
Definition: sector_tags.cc:350
base.hh
sector_blk.hh
Copyright (c) 2018, 2020 Inria All rights reserved.
gem5::SectorTags::accessBlock
CacheBlk * accessBlock(const PacketPtr pkt, Cycles &lat) override
Access block and update replacement data.
Definition: sector_tags.cc:142
gem5::SectorTags::anyBlk
bool anyBlk(std::function< bool(CacheBlk &)> visitor) override
Find if any of the sub-blocks satisfies a condition.
Definition: sector_tags.cc:363
gem5::replacement_policy::Base
A common base class of cache replacement policy objects.
Definition: base.hh:54
gem5::SectorTags::SectorTagsStats::evictionsReplacement
statistics::Vector evictionsReplacement
Number of sub-blocks evicted due to a replacement.
Definition: sector_tags.hh:105
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::SectorTags::SectorTagsStats::tags
const SectorTags & tags
Definition: sector_tags.hh:98
gem5::SectorTags::SectorTagsStats::SectorTagsStats
SectorTagsStats(BaseTagStats &base_group, SectorTags &_tags)
Definition: sector_tags.cc:341
gem5::SectorTags
A SectorTags cache tag store.
Definition: sector_tags.hh:64
gem5::SectorTags::sequentialAccess
const bool sequentialAccess
Whether tags and data are accessed sequentially.
Definition: sector_tags.hh:77
gem5::statistics::Group
Statistics container.
Definition: group.hh:92
gem5::SectorTags::SectorTags
SectorTags(const Params &p)
Construct and initialize this tag store.
Definition: sector_tags.cc:51
gem5::SectorTags::sectorMask
const unsigned sectorMask
Mask out all bits that aren't part of the sector tag.
Definition: sector_tags.hh:94
gem5::BaseTags
A common base class of Cache tagstore objects.
Definition: base.hh:73
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::SectorTags::numSectors
const unsigned numSectors
The number of sectors in the cache.
Definition: sector_tags.hh:86
gem5::SectorTags::extractSectorOffset
int extractSectorOffset(Addr addr) const
Calculate a block's offset in a sector from the address.
Definition: sector_tags.cc:326
gem5::SectorTags::moveBlock
void moveBlock(CacheBlk *src_blk, CacheBlk *dest_blk) override
Move a block's metadata to another location decided by the replacement policy.
Definition: sector_tags.cc:204
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84

Generated on Sun Jul 30 2023 01:56:57 for gem5 by doxygen 1.8.17