gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
repeated_qwords.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 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 
44 struct RepeatedQwordsCompressorParams;
45 
47 {
48  protected:
50 
51  // Forward declaration of all possible patterns
52  class PatternX;
53  class PatternM;
54 
61  typedef enum {
63  } PatternNumber;
64 
69  using PatternFactory = Factory<PatternM, PatternX>;
70 
71  uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
72 
73  std::string
74  getName(int number) const override
75  {
76  static std::map<int, std::string> pattern_names = {
77  {X, "X"}, {M, "M"}
78  };
79 
80  return pattern_names[number];
81  };
82 
83  std::unique_ptr<Pattern>
84  getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
85  const int match_location) const override
86  {
87  return PatternFactory::getPattern(bytes, dict_bytes, match_location);
88  }
89 
90  void addToDictionary(DictionaryEntry data) override;
91 
92  std::unique_ptr<BaseCacheCompressor::CompressionData> compress(
93  const uint64_t* data, Cycles& comp_lat, Cycles& decomp_lat) override;
94 
95  public:
96  typedef RepeatedQwordsCompressorParams Params;
97  RepeatedQwordsCompressor(const Params *p);
98  ~RepeatedQwordsCompressor() = default;
99 };
100 
103 {
104  public:
105  PatternX(const DictionaryEntry bytes, const int match_location)
106  : UncompressedPattern(X, 0, 0, match_location, bytes)
107  {
108  }
109 };
110 
112  : public DictionaryCompressor::LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>
113 {
114  public:
115  PatternM(const DictionaryEntry bytes, const int match_location)
116  : LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>(M, 1, 0, match_location,
117  bytes)
118  {
119  }
120 };
121 
122 #endif //__MEM_CACHE_COMPRESSORS_REPEATED_QWORDS_HH__
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
std::unique_ptr< BaseCacheCompressor::CompressionData > compress(const uint64_t *data, Cycles &comp_lat, Cycles &decomp_lat) override
Apply the compression process to the cache line.
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:81
DictionaryCompressor< uint64_t >::DictionaryEntry DictionaryEntry
PatternX(const DictionaryEntry bytes, const int match_location)
Factory< PatternM, PatternX > PatternFactory
Convenience factory declaration.
void addToDictionary(DictionaryEntry data) override
PatternM(const DictionaryEntry bytes, const int match_location)
RepeatedQwordsCompressor(const Params *p)
~RepeatedQwordsCompressor()=default
A pattern that narrows the MaskedPattern by allowing a only single possible dictionary entry to be ma...
UncompressedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes)
Definition of a dictionary based cache compressor.
A pattern containing the original uncompressed data.
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
PatternNumber
The patterns proposed in the paper.
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Bitfield< 0 > p
const char data[]
A template version of the dictionary compressor that allows to choose the dictionary size...
RepeatedQwordsCompressorParams Params

Generated on Mon Jun 8 2020 15:45:11 for gem5 by doxygen 1.8.13