cloudFPGA (cF) API  1.0
The documentation of the source code of cloudFPGA (cF)
Cam8< K, V > Struct Template Reference

#include <cam8.hpp>

Public Member Functions

 Cam8 ()
 
bool lookup (K key, V &value)
 Search the CAM array for a key. More...
 
bool reverse_lookup (V value, K &key)
 Reverse-search the CAM array for a key to a value. More...
 
bool insert (KeyValuePair< K, V > kVP)
 Insert a new key-value pair in the CAM array. More...
 
bool insert (K key, V value)
 
bool update (K key, V value)
 Search the CAM array for a key and updates the corresponding value. More...
 
bool update (KeyValuePair< K, V > kVP)
 
bool deleteEntry (K key)
 Remove a key-value pair from the CAM array. More...
 
void reset ()
 Invalidate all entries of the CAM array. More...
 

Protected Attributes

KeyValuePair< K, V > CamArray0
 
KeyValuePair< K, V > CamArray1
 
KeyValuePair< K, V > CamArray2
 
KeyValuePair< K, V > CamArray3
 
KeyValuePair< K, V > CamArray4
 
KeyValuePair< K, V > CamArray5
 
KeyValuePair< K, V > CamArray6
 
KeyValuePair< K, V > CamArray7
 

Detailed Description

template<typename K, typename V>
struct Cam8< K, V >

Definition at line 59 of file cam8.hpp.

Constructor & Destructor Documentation

◆ Cam8()

template<typename K , typename V >
Cam8< K, V >::Cam8 ( )
inline

Definition at line 70 of file cam8.hpp.

70  {
71 #pragma HLS pipeline II=1
72  CamArray0.valid = false;
73  CamArray1.valid = false;
74  CamArray2.valid = false;
75  CamArray3.valid = false;
76  CamArray4.valid = false;
77  CamArray5.valid = false;
78  CamArray6.valid = false;
79  CamArray7.valid = false;
80  }
KeyValuePair< K, V > CamArray0
Definition: cam8.hpp:61
KeyValuePair< K, V > CamArray1
Definition: cam8.hpp:62
KeyValuePair< K, V > CamArray4
Definition: cam8.hpp:65
KeyValuePair< K, V > CamArray7
Definition: cam8.hpp:68
KeyValuePair< K, V > CamArray5
Definition: cam8.hpp:66
KeyValuePair< K, V > CamArray6
Definition: cam8.hpp:67
KeyValuePair< K, V > CamArray2
Definition: cam8.hpp:63
KeyValuePair< K, V > CamArray3
Definition: cam8.hpp:64

Member Function Documentation

◆ deleteEntry()

template<typename K , typename V >
bool Cam8< K, V >::deleteEntry ( key)
inline

Remove a key-value pair from the CAM array.

Parameters
[in]keyThe key of the entry to be removed.
Returns
true if the the key was deleted.

Definition at line 297 of file cam8.hpp.

298  {
299 #pragma HLS pipeline II=1
300 #pragma HLS INLINE
301 
302  if ((CamArray0.key == key) && (CamArray0.valid == true)) {
303  CamArray0.valid = false;
304  return true;
305  }
306  else if ((CamArray1.key == key) && (CamArray1.valid == true)) {
307  CamArray1.valid = false;
308  return true;
309  }
310  else if ((CamArray2.key == key) && (CamArray2.valid == true)) {
311  CamArray2.valid = false;
312  return true;
313  }
314  else if ((CamArray3.key == key) && (CamArray3.valid == true)) {
315  CamArray3.valid = false;
316  return true;
317  }
318  else if ((CamArray4.key == key) && (CamArray4.valid == true)) {
319  CamArray4.valid = false;
320  return true;
321  }
322  else if ((CamArray5.key == key) && (CamArray5.valid == true)) {
323  CamArray5.valid = false;
324  return true;
325  }
326  else if ((CamArray6.key == key) && (CamArray6.valid == true)) {
327  CamArray6.valid = false;
328  return true;
329  }
330  else if ((CamArray7.key == key) && (CamArray7.valid == true)) {
331  CamArray7.valid = false;
332  return true;
333  }
334  else {
335  return false;
336  }
337  }
Here is the caller graph for this function:

◆ insert() [1/2]

template<typename K , typename V >
bool Cam8< K, V >::insert ( key,
value 
)
inline

Definition at line 229 of file cam8.hpp.

230  {
231 #pragma HLS INLINE
232  return insert(KeyValuePair<K,V>(key,value,true));
233  }
bool insert(KeyValuePair< K, V > kVP)
Insert a new key-value pair in the CAM array.
Definition: cam8.hpp:187
Here is the call graph for this function:

◆ insert() [2/2]

template<typename K , typename V >
bool Cam8< K, V >::insert ( KeyValuePair< K, V >  kVP)
inline

Insert a new key-value pair in the CAM array.

Parameters
[in]KeyValuePairThe key-value pair to insert.
Returns
true if the the key was inserted.

Definition at line 187 of file cam8.hpp.

188  {
189 #pragma HLS pipeline II=1
190 #pragma HLS INLINE
191 
192  if (CamArray0.valid == false) {
193  CamArray0 = kVP;
194  return true;
195  }
196  else if (CamArray1.valid == false) {
197  CamArray1 = kVP;
198  return true;
199  }
200  else if (CamArray2.valid == false) {
201  CamArray2 = kVP;
202  return true;
203  }
204  else if (CamArray3.valid == false) {
205  CamArray3 = kVP;
206  return true;
207  }
208  else if (CamArray4.valid == false) {
209  CamArray4 = kVP;
210  return true;
211  }
212  else if (CamArray5.valid == false) {
213  CamArray5 = kVP;
214  return true;
215  }
216  else if (CamArray6.valid == false) {
217  CamArray6 = kVP;
218  return true;
219  }
220  else if (CamArray7.valid == false) {
221  CamArray7 = kVP;
222  return true;
223  }
224  else {
225  return false;
226  }
227  }
Here is the caller graph for this function:

◆ lookup()

template<typename K , typename V >
bool Cam8< K, V >::lookup ( key,
V &  value 
)
inline

Search the CAM array for a key.

Parameters
[in]keyThe key to lookup.
[out]valueThe value corresponding to that key.
Returns
true if the the key was found.

Definition at line 89 of file cam8.hpp.

90  {
91 #pragma HLS pipeline II=1
92 #pragma HLS INLINE
93  if ((CamArray0.key == key) && (CamArray0.valid == true)) {
94  value = CamArray0.value;
95  return true;
96  }
97  else if ((CamArray1.key == key) && (CamArray1.valid == true)) {
98  value = CamArray1.value;
99  return true;
100  }
101  else if ((CamArray2.key == key) && (CamArray2.valid == true)) {
102  value = CamArray2.value;
103  return true;
104  }
105  else if ((CamArray3.key == key) && (CamArray3.valid == true)) {
106  value = CamArray3.value;
107  return true;
108  }
109  else if ((CamArray4.key == key) && (CamArray4.valid == true)) {
110  value = CamArray4.value;
111  return true;
112  }
113  else if ((CamArray5.key == key) && (CamArray5.valid == true)) {
114  value = CamArray5.value;
115  return true;
116  }
117  else if ((CamArray6.key == key) && (CamArray6.valid == true)) {
118  value = CamArray6.value;
119  return true;
120  }
121  else if ((CamArray7.key == key) && (CamArray7.valid == true)) {
122  value = CamArray7.value;
123  return true;
124  }
125  else {
126  return false;
127  }
128  }
Here is the caller graph for this function:

◆ reset()

template<typename K , typename V >
void Cam8< K, V >::reset ( )
inline

Invalidate all entries of the CAM array.

Definition at line 343 of file cam8.hpp.

344  {
345 #pragma HLS pipeline II=1
346 #pragma HLS INLINE
347 
348  CamArray0.valid = false;
349  CamArray1.valid = false;
350  CamArray2.valid = false;
351  CamArray3.valid = false;
352  CamArray4.valid = false;
353  CamArray5.valid = false;
354  CamArray6.valid = false;
355  CamArray7.valid = false;
356  }
Here is the caller graph for this function:

◆ reverse_lookup()

template<typename K , typename V >
bool Cam8< K, V >::reverse_lookup ( value,
K &  key 
)
inline

Reverse-search the CAM array for a key to a value.

Parameters
[in]valueThe value to lookup.
[out]keyThe key corresponding to that value (or the first match).
Returns
true if the the key was found.

Definition at line 138 of file cam8.hpp.

139  {
140 #pragma HLS pipeline II=1
141 #pragma HLS INLINE
142  if ((CamArray0.value == value) && (CamArray0.valid == true)) {
143  key = CamArray0.key;
144  return true;
145  }
146  else if ((CamArray1.value == value) && (CamArray1.valid == true)) {
147  key = CamArray1.key;
148  return true;
149  }
150  else if ((CamArray2.value == value) && (CamArray2.valid == true)) {
151  key = CamArray2.key;
152  return true;
153  }
154  else if ((CamArray3.value == value) && (CamArray3.valid == true)) {
155  key = CamArray3.key;
156  return true;
157  }
158  else if ((CamArray4.value == value) && (CamArray4.valid == true)) {
159  key = CamArray4.key;
160  return true;
161  }
162  else if ((CamArray5.value == value) && (CamArray5.valid == true)) {
163  key = CamArray5.key;
164  return true;
165  }
166  else if ((CamArray6.value == value) && (CamArray6.valid == true)) {
167  key = CamArray6.key;
168  return true;
169  }
170  else if ((CamArray7.value == value) && (CamArray7.valid == true)) {
171  key = CamArray7.key;
172  return true;
173  }
174  else {
175  return false;
176  }
177  }

◆ update() [1/2]

template<typename K , typename V >
bool Cam8< K, V >::update ( key,
value 
)
inline

Search the CAM array for a key and updates the corresponding value.

Parameters
[in]keyThe key to lookup.
[out]valueThe new value for that key
Returns
true if the the key was found and updated

Definition at line 243 of file cam8.hpp.

244  {
245 #pragma HLS pipeline II=1
246 #pragma HLS INLINE
247  if ((CamArray0.key == key) && (CamArray0.valid == true)) {
248  CamArray0.value = value;
249  return true;
250  }
251  else if ((CamArray1.key == key) && (CamArray1.valid == true)) {
252  CamArray1.value = value;
253  return true;
254  }
255  else if ((CamArray2.key == key) && (CamArray2.valid == true)) {
256  CamArray2.value = value;
257  return true;
258  }
259  else if ((CamArray3.key == key) && (CamArray3.valid == true)) {
260  CamArray3.value = value;
261  return true;
262  }
263  else if ((CamArray4.key == key) && (CamArray4.valid == true)) {
264  CamArray4.value = value;
265  return true;
266  }
267  else if ((CamArray5.key == key) && (CamArray5.valid == true)) {
268  CamArray5.value = value;
269  return true;
270  }
271  else if ((CamArray6.key == key) && (CamArray6.valid == true)) {
272  CamArray6.value = value;
273  return true;
274  }
275  else if ((CamArray7.key == key) && (CamArray7.valid == true)) {
276  CamArray7.value = value;
277  return true;
278  }
279  else {
280  return false;
281  }
282  }
Here is the caller graph for this function:

◆ update() [2/2]

template<typename K , typename V >
bool Cam8< K, V >::update ( KeyValuePair< K, V >  kVP)
inline

Definition at line 284 of file cam8.hpp.

285  {
286 #pragma HLS INLINE
287  return update(kVP.key, kVP.value);
288  }
bool update(K key, V value)
Search the CAM array for a key and updates the corresponding value.
Definition: cam8.hpp:243
Here is the call graph for this function:

Member Data Documentation

◆ CamArray0

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray0
protected

Definition at line 61 of file cam8.hpp.

◆ CamArray1

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray1
protected

Definition at line 62 of file cam8.hpp.

◆ CamArray2

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray2
protected

Definition at line 63 of file cam8.hpp.

◆ CamArray3

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray3
protected

Definition at line 64 of file cam8.hpp.

◆ CamArray4

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray4
protected

Definition at line 65 of file cam8.hpp.

◆ CamArray5

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray5
protected

Definition at line 66 of file cam8.hpp.

◆ CamArray6

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray6
protected

Definition at line 67 of file cam8.hpp.

◆ CamArray7

template<typename K , typename V >
KeyValuePair<K,V> Cam8< K, V >::CamArray7
protected

Definition at line 68 of file cam8.hpp.


The documentation for this struct was generated from the following file: