gem5  v22.1.0.0
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 
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__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
const char data[]
BaseCacheCompressorParams Params
Definition: base.hh:202
PatternMMMM(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:144
PatternMMMX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:172
PatternMMXX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:153
PatternXXXX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:135
PatternZZZX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:162
PatternZZZZ(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:125
~CPack()
Default destructor.
Definition: cpack.hh:119
PatternNumber
The patterns proposed in the paper.
Definition: cpack.hh:73
DictionaryCompressor< uint32_t >::DictionaryEntry DictionaryEntry
Definition: cpack.hh:56
CPackParams Params
Convenience typedef.
Definition: cpack.hh:109
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Definition: cpack.hh:97
Factory< PatternZZZZ, PatternMMMM, PatternZZZX, PatternMMMX, PatternMMXX, PatternXXXX > PatternFactory
Convenience factory declaration.
Definition: cpack.hh:82
void addToDictionary(DictionaryEntry data) override
Definition: cpack.cc:51
CPack(const Params &p)
Default constructor.
Definition: cpack.cc:45
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
Definition: cpack.hh:84
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition: cpack.hh:87
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition of a dictionary based cache compressor.
Bitfield< 54 > p
Definition: pagetable.hh:70
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)

Generated on Wed Dec 21 2022 10:22:36 for gem5 by doxygen 1.9.1