gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LSB_CountingBloomFilter.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
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 
30 
31 #include "base/intmath.hh"
33 
34 using namespace std;
35 
37 {
38  m_filter_size = head;
39  m_filter_size_bits = floorLog2(m_filter_size);
40 
41  m_count = tail;
42  m_count_bits = floorLog2(m_count);
43 
44  m_filter.resize(m_filter_size);
45  clear();
46 }
47 
49 {
50 }
51 
52 void
54 {
55  for (int i = 0; i < m_filter_size; i++) {
56  m_filter[i] = 0;
57  }
58 }
59 
60 void
62 {
63  int i = get_index(addr);
64  if (m_filter[i] < m_count)
65  m_filter[i] += 1;
66 }
67 
68 
69 void
71 {
72  int i = get_index(addr);
73  if (m_filter[i] > 0)
74  m_filter[i] -= 1;
75 }
76 
77 void
79 {
80  // TODO
81 }
82 
83 void
85 {
86  // TODO
87 }
88 
89 void
91 {
92  // TODO
93 }
94 
95 bool
97 {
98  // TODO
99  return false;
100 }
101 
102 int
104 {
105  return m_filter[get_index(addr)];
106 }
107 
108 int
110 {
111  int count = 0;
112 
113  for (int i = 0; i < m_filter_size; i++) {
114  count += m_filter[i];
115  }
116  return count;
117 }
118 
119 int
121 {
122  return get_index(addr);
123 }
124 
125 void
127 {
128 }
129 
130 int
132 {
133  return 0;
134  // TODO
135 }
136 
137 void
138 LSB_CountingBloomFilter::writeBit(const int index, const int value)
139 {
140  // TODO
141 }
142 
143 int
145 {
148  m_filter_size_bits - 1);
149 }
150 
151 
count
Definition: misc.hh:704
Bitfield< 30, 0 > index
Addr bitSelect(Addr addr, unsigned int small, unsigned int big)
Definition: Address.cc:34
void merge(AbstractBloomFilter *other_filter)
Bitfield< 7 > i
Definition: miscregs.hh:1378
ip6_addr_t addr
Definition: inet.hh:335
LSB_CountingBloomFilter(int head, int tail)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
int floorLog2(unsigned x)
Definition: intmath.hh:100
void writeBit(const int index, const int value)
void print(std::ostream &out) const
static uint32_t getBlockSizeBits()
Definition: RubySystem.hh:75

Generated on Fri Jun 9 2017 13:03:49 for gem5 by doxygen 1.8.6