gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 namespace compression
50 {
51 
52 class CPack : public DictionaryCompressor<uint32_t>
53 {
54  private:
56 
57  // Forward declaration of all possible patterns
58  class PatternZZZZ;
59  class PatternXXXX;
60  class PatternMMMM;
61  class PatternMMXX;
62  class PatternZZZX;
63  class PatternMMMX;
64 
72  {
74  };
75 
80  using PatternFactory = Factory<PatternZZZZ, PatternMMMM, PatternZZZX,
82 
83  uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
84 
85  std::string
86  getName(int number) const override
87  {
88  static std::map<int, std::string> patternNames = {
89  {ZZZZ, "ZZZZ"}, {XXXX, "XXXX"}, {MMMM, "MMMM"},
90  {MMXX, "MMXX"}, {ZZZX, "ZZZX"}, {MMMX, "MMMX"}
91  };
92 
93  return patternNames[number];
94  };
95 
96  std::unique_ptr<Pattern> getPattern(
97  const DictionaryEntry& bytes,
98  const DictionaryEntry& dict_bytes,
99  const int match_location) const override
100  {
101  return PatternFactory::getPattern(bytes, dict_bytes, match_location);
102  }
103 
104  void addToDictionary(DictionaryEntry data) override;
105 
106  public:
108  typedef CPackParams Params;
109 
113  CPack(const Params &p);
114 
118  ~CPack() {};
119 };
120 
121 class CPack::PatternZZZZ : public MaskedValuePattern<0, 0xFFFFFFFF>
122 {
123  public:
124  PatternZZZZ(const DictionaryEntry bytes, const int match_location)
125  : MaskedValuePattern<0, 0xFFFFFFFF>(ZZZZ, 0x0, 2, match_location,
126  bytes)
127  {
128  }
129 };
130 
131 class CPack::PatternXXXX : public UncompressedPattern
132 {
133  public:
134  PatternXXXX(const DictionaryEntry bytes, const int match_location)
135  : UncompressedPattern(XXXX, 0x1, 2, match_location, bytes)
136  {
137  }
138 };
139 
140 class CPack::PatternMMMM : public MaskedPattern<0xFFFFFFFF>
141 {
142  public:
143  PatternMMMM(const DictionaryEntry bytes, const int match_location)
144  : MaskedPattern<0xFFFFFFFF>(MMMM, 0x2, 6, match_location, bytes, true)
145  {
146  }
147 };
148 
149 class CPack::PatternMMXX : public MaskedPattern<0xFFFF0000>
150 {
151  public:
152  PatternMMXX(const DictionaryEntry bytes, const int match_location)
153  : MaskedPattern<0xFFFF0000>(MMXX, 0xC, 8, match_location, bytes, true)
154  {
155  }
156 };
157 
158 class CPack::PatternZZZX : public MaskedValuePattern<0, 0xFFFFFF00>
159 {
160  public:
161  PatternZZZX(const DictionaryEntry bytes, const int match_location)
162  : MaskedValuePattern<0, 0xFFFFFF00>(ZZZX, 0xD, 4, match_location,
163  bytes)
164  {
165  }
166 };
167 
168 class CPack::PatternMMMX : public MaskedPattern<0xFFFFFF00>
169 {
170  public:
171  PatternMMMX(const DictionaryEntry bytes, const int match_location)
172  : MaskedPattern<0xFFFFFF00>(MMMX, 0xE, 8, match_location, bytes, true)
173  {
174  }
175 };
176 
177 } // namespace compression
178 } // namespace gem5
179 
180 #endif //__MEM_CACHE_COMPRESSORS_CPACK_HH__
gem5::compression::CPack::~CPack
~CPack()
Default destructor.
Definition: cpack.hh:118
gem5::compression::CPack::NUM_PATTERNS
@ NUM_PATTERNS
Definition: cpack.hh:73
gem5::compression::CPack::ZZZZ
@ ZZZZ
Definition: cpack.hh:73
gem5::compression::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:117
gem5::compression::CPack::getName
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition: cpack.hh:86
gem5::compression::CPack::PatternMMMM
Definition: cpack.hh:140
gem5::compression::CPack::PatternMMXX::PatternMMXX
PatternMMXX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:152
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:83
gem5::compression::CPack::PatternNumber
PatternNumber
The patterns proposed in the paper.
Definition: cpack.hh:71
gem5::compression::CPack::MMMX
@ MMMX
Definition: cpack.hh:73
gem5::compression::CPack::PatternMMMX::PatternMMMX
PatternMMMX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:171
gem5::compression::CPack::PatternZZZZ::PatternZZZZ
PatternZZZZ(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:124
gem5::compression::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:201
gem5::compression::CPack::PatternZZZX
Definition: cpack.hh:158
gem5::compression::CPack::MMMM
@ MMMM
Definition: cpack.hh:73
gem5::compression::CPack
Definition: cpack.hh:52
gem5::compression::CPack::CPack
CPack(const Params &p)
Default constructor.
Definition: cpack.cc:44
dictionary_compressor.hh
gem5::compression::CPack::PatternXXXX
Definition: cpack.hh:131
gem5::compression::CPack::XXXX
@ XXXX
Definition: cpack.hh:73
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:81
gem5::compression::CPack::PatternMMMM::PatternMMMM
PatternMMMM(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:143
gem5::compression::CPack::ZZZX
@ ZZZX
Definition: cpack.hh:73
gem5::compression::CPack::PatternMMMX
Definition: cpack.hh:168
gem5::compression::CPack::PatternXXXX::PatternXXXX
PatternXXXX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:134
types.hh
gem5::compression::CPack::PatternZZZZ
Definition: cpack.hh:121
gem5::compression::CPack::addToDictionary
void addToDictionary(DictionaryEntry data) override
Definition: cpack.cc:50
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:96
gem5::compression::CPack::DictionaryEntry
DictionaryCompressor< uint32_t >::DictionaryEntry DictionaryEntry
Definition: cpack.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::CPack::PatternMMXX
Definition: cpack.hh:149
gem5::compression::CPack::MMXX
@ MMXX
Definition: cpack.hh:73
gem5::compression::CPack::PatternZZZX::PatternZZZX
PatternZZZX(const DictionaryEntry bytes, const int match_location)
Definition: cpack.hh:161
gem5::compression::CPack::Params
CPackParams Params
Convenience typedef.
Definition: cpack.hh:108

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