gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
zero.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2020 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_COMPRESSORS_ZERO_HH__
35 #define __MEM_CACHE_COMPRESSORS_ZERO_HH__
36 
37 #include <array>
38 #include <cstdint>
39 #include <map>
40 #include <memory>
41 
43 
44 namespace gem5
45 {
46 
47 struct ZeroCompressorParams;
48 
49 namespace compression
50 {
51 
52 class Zero : public DictionaryCompressor<uint64_t>
53 {
54  protected:
56 
57  // Forward declaration of all possible patterns
58  class PatternX;
59  class PatternZ;
60 
68  {
70  };
71 
76  using PatternFactory = Factory<PatternZ, PatternX>;
77 
78  uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
79 
80  std::string
81  getName(int number) const override
82  {
83  static std::map<int, std::string> pattern_names = {
84  {X, "X"}, {Z, "Z"}
85  };
86 
87  return pattern_names[number];
88  };
89 
90  std::unique_ptr<Pattern>
91  getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
92  const int match_location) const override
93  {
94  return PatternFactory::getPattern(bytes, dict_bytes, match_location);
95  }
96 
97  void addToDictionary(DictionaryEntry data) override;
98 
99  std::unique_ptr<Base::CompressionData> compress(
100  const std::vector<Base::Chunk>& chunks,
101  Cycles& comp_lat, Cycles& decomp_lat) override;
102 
103  public:
104  typedef ZeroCompressorParams Params;
105  Zero(const Params &p);
106  ~Zero() = default;
107 };
108 
111 {
112  public:
113  PatternX(const DictionaryEntry bytes, const int match_location)
114  : DictionaryCompressor::UncompressedPattern(X, 0, 0, match_location,
115  bytes)
116  {
117  }
118 };
119 
121  : public DictionaryCompressor::MaskedValuePattern<0, 0xFFFFFFFFFFFFFFFF>
122 {
123  public:
124  PatternZ(const DictionaryEntry bytes, const int match_location)
125  : DictionaryCompressor::MaskedValuePattern<0, 0xFFFFFFFFFFFFFFFF>(
126  Z, 1, 0, match_location, bytes)
127  {
128  }
129 };
130 
131 } // namespace compression
132 } // namespace gem5
133 
134 #endif //__MEM_CACHE_COMPRESSORS_ZERO_HH__
gem5::compression::Zero::PatternX::PatternX
PatternX(const DictionaryEntry bytes, const int match_location)
Definition: zero.hh:113
gem5::compression::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:117
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::compression::DictionaryCompressor::MaskedValuePattern
A pattern that compares masked values to a masked portion of a fixed value.
Definition: dictionary_compressor.hh:135
gem5::compression::Zero::addToDictionary
void addToDictionary(DictionaryEntry data) override
Definition: zero.cc:53
gem5::compression::Zero::~Zero
~Zero()=default
gem5::compression::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:201
gem5::compression::DictionaryCompressor::UncompressedPattern
A pattern containing the original uncompressed data.
Definition: dictionary_compressor.hh:415
std::vector
STL vector class.
Definition: stl.hh:37
gem5::compression::Zero::compress
std::unique_ptr< Base::CompressionData > compress(const std::vector< Base::Chunk > &chunks, Cycles &comp_lat, Cycles &decomp_lat) override
Apply the compression process to the cache line.
Definition: zero.cc:60
gem5::compression::Zero::PatternX
Definition: zero.hh:109
gem5::compression::Zero::NUM_PATTERNS
@ NUM_PATTERNS
Definition: zero.hh:69
gem5::compression::Zero::PatternFactory
Factory< PatternZ, PatternX > PatternFactory
Convenience factory declaration.
Definition: zero.hh:76
gem5::compression::Zero::getNumPatterns
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
Definition: zero.hh:78
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::compression::Zero::PatternZ::PatternZ
PatternZ(const DictionaryEntry bytes, const int match_location)
Definition: zero.hh:124
dictionary_compressor.hh
gem5::compression::Zero::Z
@ Z
Definition: zero.hh:69
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::compression::DictionaryCompressor::MaskedValuePattern< 0, 0xFFFFFFFFFFFFFFFF >::MaskedValuePattern
MaskedValuePattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes, const bool allocate=false)
Definition: dictionary_compressor.hh:532
gem5::compression::Zero::getName
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition: zero.hh:81
gem5::compression::Zero::PatternZ
Definition: zero.hh:120
gem5::compression::Zero::Params
ZeroCompressorParams Params
Definition: zero.hh:104
gem5::compression::Zero::PatternNumber
PatternNumber
The patterns proposed in the paper.
Definition: zero.hh:67
gem5::compression::Zero::Zero
Zero(const Params &p)
Definition: zero.cc:47
gem5::compression::Zero::getPattern
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Definition: zero.hh:91
gem5::compression::Zero::X
@ X
Definition: zero.hh:69
gem5::compression::Zero
Definition: zero.hh:52
gem5::compression::Zero::DictionaryEntry
DictionaryCompressor< uint64_t >::DictionaryEntry DictionaryEntry
Definition: zero.hh:55
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::compression::DictionaryCompressor::UncompressedPattern::UncompressedPattern
UncompressedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes)
Definition: dictionary_compressor.hh:423

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