gem5  v22.0.0.1
cpack.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-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_CPACK_HH__
35 #define __MEM_CACHE_COMPRESSORS_CPACK_HH__
36 
37 #include <cstdint>
38 #include <map>
39 #include <memory>
40 
41 #include "base/types.hh"
43 
44 namespace gem5
45 {
46 
47 struct CPackParams;
48 
49 GEM5_DEPRECATED_NAMESPACE(Compressor, compression);
50 namespace compression
51 {
52 
53 class CPack : public DictionaryCompressor<uint32_t>
54 {
55  private:
57 
58  // Forward declaration of all possible patterns
59  class PatternZZZZ;
60  class PatternXXXX;
61  class PatternMMMM;
62  class PatternMMXX;
63  class PatternZZZX;
64  class PatternMMMX;
65 
73  {
75  };
76 
81  using PatternFactory = Factory<PatternZZZZ, PatternMMMM, PatternZZZX,
83 
84  uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
85 
86  std::string
87  getName(int number) const override
88  {
89  static std::map<int, std::string> patternNames = {
90  {ZZZZ, "ZZZZ"}, {XXXX, "XXXX"}, {MMMM, "MMMM"},
91  {MMXX, "MMXX"}, {ZZZX, "ZZZX"}, {MMMX, "MMMX"}
92  };
93 
94  return patternNames[number];
95  };
96 
97  std::unique_ptr<Pattern> getPattern(
98  const DictionaryEntry& bytes,
99  const DictionaryEntry& dict_bytes,
100  const int match_location) const override
101  {
102  return PatternFactory::getPattern(bytes, dict_bytes, match_location);
103  }
104 
105  void addToDictionary(DictionaryEntry data) override;
106 
107  public:
109  typedef CPackParams Params;
110 
114  CPack(const Params &p);
115 
119  ~CPack() {};
120 };
121 
122 class CPack::PatternZZZZ : public MaskedValuePattern<0, 0xFFFFFFFF>
123 {
124  public:
125  PatternZZZZ(const DictionaryEntry bytes, const int match_location)
126  : MaskedValuePattern<0, 0xFFFFFFFF>(ZZZZ, 0x0, 2, match_location,
127  bytes)
128  {
129  }
130 };
131 
132 class CPack::PatternXXXX : public UncompressedPattern
133 {
134  public:
135  PatternXXXX(const DictionaryEntry bytes, const int match_location)
136  : UncompressedPattern(XXXX, 0x1, 2, match_location, bytes)
137  {
138  }
139 };
140 
141 class CPack::PatternMMMM : public MaskedPattern<0xFFFFFFFF>
142 {
143  public:
144  PatternMMMM(const DictionaryEntry bytes, const int match_location)
145  : MaskedPattern<0xFFFFFFFF>(MMMM, 0x2, 6, match_location, bytes, true)
146  {
147  }
148 };
149 
150 class CPack::PatternMMXX : public MaskedPattern<0xFFFF0000>
151 {
152  public:
153  PatternMMXX(const DictionaryEntry bytes, const int match_location)
154  : MaskedPattern<0xFFFF0000>(MMXX, 0xC, 8, match_location, bytes, true)
155  {
156  }
157 };
158 
159 class CPack::PatternZZZX : public MaskedValuePattern<0, 0xFFFFFF00>
160 {
161  public:
162  PatternZZZX(const DictionaryEntry bytes, const int match_location)
163  : MaskedValuePattern<0, 0xFFFFFF00>(ZZZX, 0xD, 4, match_location,
164  bytes)
165  {
166  }
167 };
168 
169 class CPack::PatternMMMX : public MaskedPattern<0xFFFFFF00>
170 {
171  public:
172  PatternMMMX(const DictionaryEntry bytes, const int match_location)
173  : MaskedPattern<0xFFFFFF00>(MMMX, 0xE, 8, match_location, bytes, true)
174  {
175  }
176 };
177 
178 } // namespace compression
179 } // namespace gem5
180 
181 #endif //__MEM_CACHE_COMPRESSORS_CPACK_HH__
gem5::compression::CPack::~CPack
~CPack()
Default destructor.
Definition: cpack.hh:119
gem5::compression::CPack::NUM_PATTERNS
@ NUM_PATTERNS
Definition: cpack.hh:74
gem5::compression::CPack::ZZZZ
@ ZZZZ
Definition: cpack.hh:74
gem5::compression::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:118
gem5::compression::CPack::getName
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition: cpack.hh:87
gem5::compression::CPack::PatternMMMM
Definition: cpack.hh:141
gem5::compression::CPack::PatternMMXX::PatternMMXX
PatternMMXX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:153
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::compression::CPack::getNumPatterns
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
Definition: cpack.hh:84
gem5::compression::CPack::PatternNumber
PatternNumber
The patterns proposed in the paper.
Definition: cpack.hh:72
gem5::compression::CPack::MMMX
@ MMMX
Definition: cpack.hh:74
gem5::compression::CPack::PatternMMMX::PatternMMMX
PatternMMMX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:172
gem5::compression::CPack::PatternZZZZ::PatternZZZZ
PatternZZZZ(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:125
gem5::compression::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:202
gem5::compression::CPack::PatternZZZX
Definition: cpack.hh:159
gem5::compression::CPack::MMMM
@ MMMM
Definition: cpack.hh:74
gem5::compression::CPack
Definition: cpack.hh:53
gem5::compression::CPack::CPack
CPack(const Params &p)
Default constructor.
Definition: cpack.cc:45
dictionary_compressor.hh
gem5::compression::CPack::PatternXXXX
Definition: cpack.hh:132
gem5::compression::CPack::XXXX
@ XXXX
Definition: cpack.hh:74
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::compression::CPack::PatternFactory
Factory< PatternZZZZ, PatternMMMM, PatternZZZX, PatternMMMX, PatternMMXX, PatternXXXX > PatternFactory
Convenience factory declaration.
Definition: cpack.hh:82
gem5::compression::CPack::PatternMMMM::PatternMMMM
PatternMMMM(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:144
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::compression::CPack::ZZZX
@ ZZZX
Definition: cpack.hh:74
gem5::compression::CPack::PatternMMMX
Definition: cpack.hh:169
gem5::compression::CPack::PatternXXXX::PatternXXXX
PatternXXXX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:135
types.hh
gem5::compression::CPack::PatternZZZZ
Definition: cpack.hh:122
gem5::compression::CPack::addToDictionary
void addToDictionary(DictionaryEntry data) override
Definition: cpack.cc:51
gem5::compression::CPack::getPattern
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Definition: cpack.hh:97
gem5::compression::CPack::DictionaryEntry
DictionaryCompressor< uint32_t >::DictionaryEntry DictionaryEntry
Definition: cpack.hh:56
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::compression::CPack::PatternMMXX
Definition: cpack.hh:150
gem5::compression::CPack::MMXX
@ MMXX
Definition: cpack.hh:74
gem5::compression::CPack::PatternZZZX::PatternZZZX
PatternZZZX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:162
gem5::compression::CPack::Params
CPackParams Params
Convenience typedef.
Definition: cpack.hh:109

Generated on Sat Jun 18 2022 08:12:27 for gem5 by doxygen 1.8.17