gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
44namespace gem5
45{
46
47struct CPackParams;
48
49namespace compression
50{
51
52class 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
75
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
121class 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
131class 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
140class 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
149class 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
158class 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
168class 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__
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
const char data[]
PatternMMMM(const DictionaryEntry bytes, const int match_location)
Definition cpack.hh:143
PatternMMMX(const DictionaryEntry bytes, const int match_location)
Definition cpack.hh:171
PatternMMXX(const DictionaryEntry bytes, const int match_location)
Definition cpack.hh:152
PatternXXXX(const DictionaryEntry bytes, const int match_location)
Definition cpack.hh:134
PatternZZZX(const DictionaryEntry bytes, const int match_location)
Definition cpack.hh:161
PatternZZZZ(const DictionaryEntry bytes, const int match_location)
Definition cpack.hh:124
~CPack()
Default destructor.
Definition cpack.hh:118
PatternNumber
The patterns proposed in the paper.
Definition cpack.hh:72
Factory< PatternZZZZ, PatternMMMM, PatternZZZX, PatternMMMX, PatternMMXX, PatternXXXX > PatternFactory
Convenience factory declaration.
Definition cpack.hh:80
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Definition cpack.hh:96
DictionaryCompressor< uint32_t >::DictionaryEntry DictionaryEntry
Definition cpack.hh:55
CPackParams Params
Convenience typedef.
Definition cpack.hh:108
void addToDictionary(DictionaryEntry data) override
Definition cpack.cc:50
CPack(const Params &p)
Default constructor.
Definition cpack.cc:44
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
Definition cpack.hh:83
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition cpack.hh:86
A template version of the dictionary compressor that allows to choose the dictionary size.
std::array< uint8_t, sizeof(T)> DictionaryEntry
Convenience typedef for a dictionary entry.
Definition of a dictionary based cache compressor.
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36

Generated on Tue Jun 18 2024 16:24:04 for gem5 by doxygen 1.11.0