gem5 v24.0.0.0
Loading...
Searching...
No Matches
repeated_qwords.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
34#ifndef __MEM_CACHE_COMPRESSORS_REPEATED_QWORDS_HH__
35#define __MEM_CACHE_COMPRESSORS_REPEATED_QWORDS_HH__
36
37#include <array>
38#include <cstdint>
39#include <map>
40#include <memory>
41
43
44namespace gem5
45{
46
47struct RepeatedQwordsCompressorParams;
48
49namespace compression
50{
51
52class RepeatedQwords : public DictionaryCompressor<uint64_t>
53{
54 protected:
56
57 // Forward declaration of all possible patterns
58 class PatternX;
59 class PatternM;
60
71
76 using PatternFactory = Factory<PatternM, PatternX>;
77
78 uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
79
80 std::string
81 getName(int number) const override
82 {
83 static std::map<int, std::string> pattern_names = {
84 {X, "X"}, {M, "M"}
85 };
86
87 return pattern_names[number];
88 };
89
90 std::unique_ptr<Pattern>
91 getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
92 const int match_location) const override
93 {
94 return PatternFactory::getPattern(bytes, dict_bytes, match_location);
95 }
96
98
99 std::unique_ptr<Base::CompressionData> compress(
100 const std::vector<Base::Chunk>& chunks,
101 Cycles& comp_lat, Cycles& decomp_lat) override;
102
103 public:
104 typedef RepeatedQwordsCompressorParams Params;
105 RepeatedQwords(const Params &p);
106 ~RepeatedQwords() = default;
107};
108
111{
112 public:
113 PatternX(const DictionaryEntry bytes, const int match_location)
114 : UncompressedPattern(X, 0, 0, match_location, bytes)
115 {
116 }
117};
118
120 : public DictionaryCompressor::LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>
121{
122 public:
123 PatternM(const DictionaryEntry bytes, const int match_location)
124 : LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>(M, 1, 0, match_location,
125 bytes, false)
126 {
127 }
128};
129
130} // namespace compression
131} // namespace gem5
132
133#endif //__MEM_CACHE_COMPRESSORS_REPEATED_QWORDS_HH__
const char data[]
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
A pattern that narrows the MaskedPattern by allowing a only single possible dictionary entry to be ma...
A pattern containing the original uncompressed data.
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.
PatternM(const DictionaryEntry bytes, const int match_location)
PatternX(const DictionaryEntry bytes, const int match_location)
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
std::unique_ptr< Base::CompressionData > compress(const std::vector< Base::Chunk > &chunks, Cycles &comp_lat, Cycles &decomp_lat) override
Apply the compression process to the cache line.
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
RepeatedQwordsCompressorParams Params
PatternNumber
The patterns proposed in the paper.
void addToDictionary(DictionaryEntry data) override
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Factory< PatternM, PatternX > PatternFactory
Convenience factory declaration.
DictionaryCompressor< uint64_t >::DictionaryEntry DictionaryEntry
STL vector class.
Definition stl.hh:37
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