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

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