gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
fpcd.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 
39 #ifndef __MEM_CACHE_COMPRESSORS_FPCD_HH__
40 #define __MEM_CACHE_COMPRESSORS_FPCD_HH__
41 
42 #include <cstdint>
43 #include <map>
44 #include <memory>
45 #include <string>
46 
47 #include "base/types.hh"
49 
50 namespace gem5
51 {
52 
53 struct FPCDParams;
54 
55 namespace compression
56 {
57 
58 class FPCD : public DictionaryCompressor<uint32_t>
59 {
60  private:
62 
64  static constexpr int prefixSize = 4;
65 
67  static constexpr int previousIndex = 1;
68 
70  static constexpr int penultimateIndex = 0;
71 
72  // Declaration of all possible patterns, from lowest to highest sizes.
73  // Penultimate is prioritized over previous to reduce the ripple effect
74  // of propagating values during decompression
75  class PatternZZZZ;
76  class PatternFFFF;
78  class PatternMMMMPrevious;
79  class PatternZZZX;
80  class PatternXZZZ;
81  class PatternRRRR;
83  class PatternMMMXPrevious;
84  class PatternZZXX;
85  class PatternZXZX;
86  class PatternFFXX;
87  class PatternXXZZ;
89  class PatternMMXXPrevious;
90  class PatternXXXX;
91 
100  {
104  };
105 
110  using PatternFactory =
111  Factory<PatternZZZZ, PatternFFFF, PatternMMMMPrevious,
112  PatternMMMMPenultimate, PatternZZZX, PatternXZZZ,
113  PatternRRRR, PatternMMMXPrevious, PatternMMMXPenultimate,
114  PatternZZXX, PatternZXZX, PatternFFXX, PatternXXZZ,
116 
117  uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
118 
119  std::string
120  getName(int number) const override
121  {
122  static std::map<PatternNumber, std::string> pattern_names = {
123  {ZZZZ, "ZZZZ"}, {FFFF, "FFFF"},
124  {MMMMPenultimate, "MMMMPenultimate"},
125  {MMMMPrevious, "MMMMPrevious"}, {ZZZX, "ZZZX"},
126  {XZZZ, "XZZZ"}, {RRRR, "RRRR"},
127  {MMMXPenultimate, "MMMXPenultimate"},
128  {MMMXPrevious, "MMMXPrevious"},
129  {ZZXX, "ZZXX"},
130  {ZXZX, "ZXZX"}, {FFXX, "FFXX"}, {XXZZ, "XXZZ"},
131  {MMXXPenultimate, "MMXXPenultimate"},
132  {MMXXPrevious, "MMXXPrevious"}, {XXXX, "XXXX"}
133  };
134 
135  return pattern_names[(PatternNumber)number];
136  };
137 
138  std::unique_ptr<Pattern>
139  getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
140  const int match_location) const override
141  {
142  return PatternFactory::getPattern(bytes, dict_bytes, match_location);
143  }
144 
145  void addToDictionary(DictionaryEntry data) override;
146 
147  public:
148  typedef FPCDParams Params;
149  FPCD(const Params &p);
150  ~FPCD() = default;
151 };
152 
153 class FPCD::PatternZZZZ : public MaskedValuePattern<0, 0xFFFFFFFF>
154 {
155  public:
156  PatternZZZZ(const DictionaryEntry bytes, const int match_location)
157  : MaskedValuePattern<0, 0xFFFFFFFF>(ZZZZ, 0x0, prefixSize,
158  match_location, bytes, true)
159  {
160  }
161 };
162 
163 class FPCD::PatternFFFF : public MaskedValuePattern<0xFFFFFFFF, 0xFFFFFFFF>
164 {
165  public:
166  PatternFFFF(const DictionaryEntry bytes, const int match_location)
167  : MaskedValuePattern<0xFFFFFFFF, 0xFFFFFFFF>(FFFF, 0x1,
168  prefixSize, match_location, bytes, true)
169  {
170  }
171 };
172 
174  : public LocatedMaskedPattern<0xFFFFFFFF, previousIndex>
175 {
176  public:
178  const int match_location)
179  : LocatedMaskedPattern<0xFFFFFFFF, previousIndex>(MMMMPrevious,
180  0x2, prefixSize, match_location, bytes)
181  {
182  }
183 };
184 
186  : public LocatedMaskedPattern<0xFFFFFFFF, penultimateIndex>
187 {
188  public:
190  const int match_location)
191  : LocatedMaskedPattern<0xFFFFFFFF, penultimateIndex>(
192  MMMMPenultimate, 0x3, prefixSize, match_location, bytes)
193  {
194  }
195 };
196 
197 class FPCD::PatternZZZX : public MaskedValuePattern<0, 0xFFFFFF00>
198 {
199  public:
200  PatternZZZX(const DictionaryEntry bytes, const int match_location)
201  : MaskedValuePattern<0, 0xFFFFFF00>(ZZZX, 0x4, prefixSize,
202  match_location, bytes, true)
203  {
204  }
205 };
206 
207 class FPCD::PatternXZZZ : public MaskedValuePattern<0, 0x00FFFFFF>
208 {
209  public:
210  PatternXZZZ(const DictionaryEntry bytes, const int match_location)
211  : MaskedValuePattern<0, 0x00FFFFFF>(XZZZ, 0x5, prefixSize,
212  match_location, bytes, true)
213  {
214  }
215 };
216 
217 class FPCD::PatternRRRR : public RepeatedValuePattern<uint8_t>
218 {
219  public:
220  PatternRRRR(const DictionaryEntry bytes, const int match_location)
221  : RepeatedValuePattern<uint8_t>(RRRR, 0x6, prefixSize,
222  match_location, bytes, true)
223  {
224  }
225 };
226 
228  : public LocatedMaskedPattern<0xFFFFFF00, previousIndex>
229 {
230  public:
232  const int match_location)
233  : LocatedMaskedPattern<0xFFFFFF00, previousIndex>(MMMXPrevious,
234  0x7, prefixSize, match_location, bytes)
235  {
236  }
237 };
238 
240  : public LocatedMaskedPattern<0xFFFFFF00, penultimateIndex>
241 {
242  public:
244  const int match_location)
245  : LocatedMaskedPattern<0xFFFFFF00, penultimateIndex>(
246  MMMXPenultimate, 0x8, prefixSize, match_location, bytes)
247  {
248  }
249 };
250 
251 class FPCD::PatternZZXX : public MaskedValuePattern<0, 0xFFFF0000>
252 {
253  public:
254  PatternZZXX(const DictionaryEntry bytes, const int match_location)
255  : MaskedValuePattern<0, 0xFFFF0000>(ZZXX, 0x9, prefixSize,
256  match_location, bytes, true)
257  {
258  }
259 };
260 
261 class FPCD::PatternZXZX : public MaskedValuePattern<0, 0xFF00FF00>
262 {
263  public:
264  PatternZXZX(const DictionaryEntry bytes, const int match_location)
265  : MaskedValuePattern<0, 0xFF00FF00>(ZXZX, 0xA, prefixSize,
266  match_location, bytes, true)
267  {
268  }
269 };
270 
271 class FPCD::PatternFFXX : public MaskedValuePattern<0xFFFFFFFF, 0xFFFF0000>
272 {
273  public:
274  PatternFFXX(const DictionaryEntry bytes, const int match_location)
275  : MaskedValuePattern<0xFFFFFFFF, 0xFFFF0000>(FFXX, 0xB,
276  prefixSize, match_location, bytes, true)
277  {
278  }
279 };
280 
281 class FPCD::PatternXXZZ : public MaskedValuePattern<0, 0x0000FFFF>
282 {
283  public:
284  PatternXXZZ(const DictionaryEntry bytes, const int match_location)
285  : MaskedValuePattern<0, 0x0000FFFF>(XXZZ, 0xC, prefixSize,
286  match_location, bytes, true)
287  {
288  }
289 };
290 
292  : public LocatedMaskedPattern<0xFFFF0000, previousIndex>
293 {
294  public:
296  const int match_location)
297  : LocatedMaskedPattern<0xFFFF0000, previousIndex>(MMXXPrevious,
298  0xD, prefixSize, match_location, bytes)
299  {
300  }
301 };
302 
304  : public LocatedMaskedPattern<0xFFFF0000, penultimateIndex>
305 {
306  public:
308  const int match_location)
309  : LocatedMaskedPattern<0xFFFF0000, penultimateIndex>(
310  MMXXPenultimate, 0xE, prefixSize, match_location, bytes)
311  {
312  }
313 };
314 
315 class FPCD::PatternXXXX : public UncompressedPattern
316 {
317  public:
318  PatternXXXX(const DictionaryEntry bytes, const int match_location)
319  : UncompressedPattern(XXXX, 0xF, prefixSize, match_location,
320  bytes)
321  {
322  }
323 };
324 
325 } // namespace compression
326 } // namespace gem5
327 
328 #endif //__MEM_CACHE_COMPRESSORS_FPCD_HH__
gem5::compression::FPCD::PatternMMXXPrevious::PatternMMXXPrevious
PatternMMXXPrevious(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:295
gem5::compression::FPCD::PatternZXZX::PatternZXZX
PatternZXZX(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:264
gem5::compression::FPCD::PatternFFXX::PatternFFXX
PatternFFXX(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:274
gem5::compression::FPCD::getName
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition: fpcd.hh:120
gem5::compression::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:117
gem5::compression::FPCD::PatternMMMMPrevious
Definition: fpcd.hh:173
gem5::compression::FPCD::PatternFFFF
Definition: fpcd.hh:163
gem5::compression::FPCD::PatternXZZZ::PatternXZZZ
PatternXZZZ(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:210
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::compression::FPCD::PatternMMXXPenultimate::PatternMMXXPenultimate
PatternMMXXPenultimate(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:307
gem5::compression::FPCD::ZZZZ
@ ZZZZ
Definition: fpcd.hh:101
gem5::compression::FPCD::Params
FPCDParams Params
Definition: fpcd.hh:148
gem5::compression::FPCD::PatternXXZZ::PatternXXZZ
PatternXXZZ(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:284
gem5::compression::FPCD::RRRR
@ RRRR
Definition: fpcd.hh:101
gem5::compression::FPCD::PatternFFXX
Definition: fpcd.hh:271
gem5::compression::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:201
gem5::compression::FPCD::PatternRRRR::PatternRRRR
PatternRRRR(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:220
gem5::compression::FPCD::penultimateIndex
static constexpr int penultimateIndex
Index of the penultimate dictionary entry.
Definition: fpcd.hh:70
gem5::compression::FPCD::getPattern
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Definition: fpcd.hh:139
gem5::compression::FPCD::~FPCD
~FPCD()=default
gem5::compression::FPCD::PatternZZZZ
Definition: fpcd.hh:153
gem5::compression::FPCD::PatternZZZX::PatternZZZX
PatternZZZX(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:200
dictionary_compressor.hh
gem5::compression::FPCD::PatternMMXXPrevious
Definition: fpcd.hh:291
gem5::compression::FPCD::PatternXZZZ
Definition: fpcd.hh:207
gem5::compression::FPCD::PatternXXZZ
Definition: fpcd.hh:281
gem5::compression::FPCD::XXXX
@ XXXX
Definition: fpcd.hh:103
gem5::compression::FPCD::NUM_PATTERNS
@ NUM_PATTERNS
Definition: fpcd.hh:103
gem5::compression::FPCD::MMMXPrevious
@ MMMXPrevious
Definition: fpcd.hh:102
gem5::compression::FPCD::PatternRRRR
Definition: fpcd.hh:217
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::compression::FPCD::FFFF
@ FFFF
Definition: fpcd.hh:101
gem5::compression::FPCD::ZZZX
@ ZZZX
Definition: fpcd.hh:101
gem5::compression::FPCD::FFXX
@ FFXX
Definition: fpcd.hh:102
gem5::compression::FPCD::MMMMPenultimate
@ MMMMPenultimate
Definition: fpcd.hh:101
gem5::compression::FPCD::DictionaryEntry
DictionaryCompressor< uint32_t >::DictionaryEntry DictionaryEntry
Definition: fpcd.hh:61
gem5::compression::FPCD
Definition: fpcd.hh:58
gem5::compression::FPCD::PatternMMXXPenultimate
Definition: fpcd.hh:303
gem5::compression::FPCD::PatternNumber
PatternNumber
The patterns proposed in the paper.
Definition: fpcd.hh:99
gem5::compression::FPCD::getNumPatterns
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
Definition: fpcd.hh:117
gem5::compression::FPCD::ZZXX
@ ZZXX
Definition: fpcd.hh:102
gem5::compression::FPCD::PatternXXXX::PatternXXXX
PatternXXXX(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:318
gem5::compression::FPCD::PatternZZZZ::PatternZZZZ
PatternZZZZ(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:156
gem5::compression::FPCD::PatternMMMMPenultimate::PatternMMMMPenultimate
PatternMMMMPenultimate(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:189
gem5::compression::FPCD::previousIndex
static constexpr int previousIndex
Index of the previous dictionary entry.
Definition: fpcd.hh:67
gem5::compression::FPCD::MMMMPrevious
@ MMMMPrevious
Definition: fpcd.hh:101
gem5::compression::FPCD::PatternMMMMPrevious::PatternMMMMPrevious
PatternMMMMPrevious(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:177
gem5::compression::FPCD::PatternMMMXPrevious::PatternMMMXPrevious
PatternMMMXPrevious(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:231
gem5::compression::FPCD::MMXXPrevious
@ MMXXPrevious
Definition: fpcd.hh:103
types.hh
gem5::compression::FPCD::PatternMMMXPrevious
Definition: fpcd.hh:227
gem5::compression::FPCD::addToDictionary
void addToDictionary(DictionaryEntry data) override
Definition: fpcd.cc:50
gem5::compression::FPCD::prefixSize
static constexpr int prefixSize
Number of bits in a FPCD pattern prefix.
Definition: fpcd.hh:64
gem5::compression::FPCD::PatternZZZX
Definition: fpcd.hh:197
gem5::compression::FPCD::PatternZXZX
Definition: fpcd.hh:261
gem5::compression::FPCD::PatternMMMXPenultimate::PatternMMMXPenultimate
PatternMMMXPenultimate(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:243
gem5::compression::FPCD::XXZZ
@ XXZZ
Definition: fpcd.hh:102
gem5::compression::FPCD::PatternFactory
Factory< PatternZZZZ, PatternFFFF, PatternMMMMPrevious, PatternMMMMPenultimate, PatternZZZX, PatternXZZZ, PatternRRRR, PatternMMMXPrevious, PatternMMMXPenultimate, PatternZZXX, PatternZXZX, PatternFFXX, PatternXXZZ, PatternMMXXPrevious, PatternMMXXPenultimate, PatternXXXX > PatternFactory
Convenience factory declaration.
Definition: fpcd.hh:115
gem5::compression::FPCD::FPCD
FPCD(const Params &p)
Definition: fpcd.cc:44
gem5::compression::FPCD::PatternMMMMPenultimate
Definition: fpcd.hh:185
gem5::compression::FPCD::PatternMMMXPenultimate
Definition: fpcd.hh:239
gem5::compression::FPCD::ZXZX
@ ZXZX
Definition: fpcd.hh:102
gem5::compression::FPCD::MMMXPenultimate
@ MMMXPenultimate
Definition: fpcd.hh:102
gem5::compression::FPCD::PatternZZXX
Definition: fpcd.hh:251
gem5::compression::FPCD::MMXXPenultimate
@ MMXXPenultimate
Definition: fpcd.hh:103
gem5::compression::FPCD::PatternZZXX::PatternZZXX
PatternZZXX(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:254
gem5::compression::FPCD::XZZZ
@ XZZZ
Definition: fpcd.hh:101
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::compression::FPCD::PatternFFFF::PatternFFFF
PatternFFFF(const DictionaryEntry bytes, const int match_location)
Definition: fpcd.hh:166
gem5::compression::FPCD::PatternXXXX
Definition: fpcd.hh:315

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