gem5  v21.2.0.0
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 
44 namespace gem5
45 {
46 
47 struct RepeatedQwordsCompressorParams;
48 
49 GEM5_DEPRECATED_NAMESPACE(Compressor, compression);
50 namespace compression
51 {
52 
53 class RepeatedQwords : public DictionaryCompressor<uint64_t>
54 {
55  protected:
57 
58  // Forward declaration of all possible patterns
59  class PatternX;
60  class PatternM;
61 
69  {
71  };
72 
77  using PatternFactory = Factory<PatternM, PatternX>;
78 
79  uint64_t getNumPatterns() const override { return NUM_PATTERNS; }
80 
81  std::string
82  getName(int number) const override
83  {
84  static std::map<int, std::string> pattern_names = {
85  {X, "X"}, {M, "M"}
86  };
87 
88  return pattern_names[number];
89  };
90 
91  std::unique_ptr<Pattern>
92  getPattern(const DictionaryEntry& bytes, const DictionaryEntry& dict_bytes,
93  const int match_location) const override
94  {
95  return PatternFactory::getPattern(bytes, dict_bytes, match_location);
96  }
97 
98  void addToDictionary(DictionaryEntry data) override;
99 
100  std::unique_ptr<Base::CompressionData> compress(
101  const std::vector<Base::Chunk>& chunks,
102  Cycles& comp_lat, Cycles& decomp_lat) override;
103 
104  public:
105  typedef RepeatedQwordsCompressorParams Params;
106  RepeatedQwords(const Params &p);
107  ~RepeatedQwords() = default;
108 };
109 
112 {
113  public:
114  PatternX(const DictionaryEntry bytes, const int match_location)
115  : UncompressedPattern(X, 0, 0, match_location, bytes)
116  {
117  }
118 };
119 
121  : public DictionaryCompressor::LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>
122 {
123  public:
124  PatternM(const DictionaryEntry bytes, const int match_location)
125  : LocatedMaskedPattern<0xFFFFFFFFFFFFFFFF, 0>(M, 1, 0, match_location,
126  bytes, false)
127  {
128  }
129 };
130 
131 } // namespace compression
132 } // namespace gem5
133 
134 #endif //__MEM_CACHE_COMPRESSORS_REPEATED_QWORDS_HH__
gem5::compression::RepeatedQwords::getPattern
std::unique_ptr< Pattern > getPattern(const DictionaryEntry &bytes, const DictionaryEntry &dict_bytes, const int match_location) const override
Definition: repeated_qwords.hh:92
gem5::compression::DictionaryCompressor
A template version of the dictionary compressor that allows to choose the dictionary size.
Definition: dictionary_compressor.hh:118
data
const char data[]
Definition: circlebuf.test.cc:48
gem5::compression::RepeatedQwords::PatternX::PatternX
PatternX(const DictionaryEntry bytes, const int match_location)
Definition: repeated_qwords.hh:114
gem5::compression::RepeatedQwords::NUM_PATTERNS
@ NUM_PATTERNS
Definition: repeated_qwords.hh:70
gem5::compression::Base::Params
BaseCacheCompressorParams Params
Definition: base.hh:202
gem5::compression::DictionaryCompressor::UncompressedPattern
A pattern containing the original uncompressed data.
Definition: dictionary_compressor.hh:416
std::vector
STL vector class.
Definition: stl.hh:37
gem5::compression::RepeatedQwords::addToDictionary
void addToDictionary(DictionaryEntry data) override
Definition: repeated_qwords.cc:54
gem5::compression::RepeatedQwords::PatternM
Definition: repeated_qwords.hh:120
gem5::compression::RepeatedQwords::PatternM::PatternM
PatternM(const DictionaryEntry bytes, const int match_location)
Definition: repeated_qwords.hh:124
gem5::compression::RepeatedQwords::M
@ M
Definition: repeated_qwords.hh:70
gem5::compression::RepeatedQwords::Params
RepeatedQwordsCompressorParams Params
Definition: repeated_qwords.hh:105
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::compression::RepeatedQwords::PatternNumber
PatternNumber
The patterns proposed in the paper.
Definition: repeated_qwords.hh:68
dictionary_compressor.hh
gem5::compression::RepeatedQwords::DictionaryEntry
DictionaryCompressor< uint64_t >::DictionaryEntry DictionaryEntry
Definition: repeated_qwords.hh:56
gem5::compression::RepeatedQwords::RepeatedQwords
RepeatedQwords(const Params &p)
Definition: repeated_qwords.cc:48
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::compression::RepeatedQwords
Definition: repeated_qwords.hh:53
gem5::compression::RepeatedQwords::PatternFactory
Factory< PatternM, PatternX > PatternFactory
Convenience factory declaration.
Definition: repeated_qwords.hh:77
gem5::compression::DictionaryCompressor::LocatedMaskedPattern
A pattern that narrows the MaskedPattern by allowing a only single possible dictionary entry to be ma...
Definition: dictionary_compressor.hh:138
gem5::compression::DictionaryCompressor::LocatedMaskedPattern< 0xFFFFFFFFFFFFFFFF, 0 >::LocatedMaskedPattern
LocatedMaskedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes, const bool allocate=true)
Definition: dictionary_compressor.hh:577
gem5::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(GuestABI, guest_abi)
gem5::compression::RepeatedQwords::compress
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.
Definition: repeated_qwords.cc:61
gem5::compression::RepeatedQwords::getNumPatterns
uint64_t getNumPatterns() const override
Trick function to get the number of patterns.
Definition: repeated_qwords.hh:79
gem5::compression::RepeatedQwords::X
@ X
Definition: repeated_qwords.hh:70
gem5::compression::RepeatedQwords::~RepeatedQwords
~RepeatedQwords()=default
gem5::compression::RepeatedQwords::getName
std::string getName(int number) const override
Get meta-name assigned to the given pattern.
Definition: repeated_qwords.hh:82
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: tlb.cc:60
gem5::compression::DictionaryCompressor::UncompressedPattern::UncompressedPattern
UncompressedPattern(const int number, const uint64_t code, const uint64_t metadata_length, const int match_location, const DictionaryEntry bytes)
Definition: dictionary_compressor.hh:424
gem5::compression::RepeatedQwords::PatternX
Definition: repeated_qwords.hh:110

Generated on Tue Dec 21 2021 11:34:31 for gem5 by doxygen 1.8.17