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

#include <cam16.hpp>

Public Member Functions

 Cam16 ()
 
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
 
KeyValuePair< K, V > CamArray8
 
KeyValuePair< K, V > CamArray9
 
KeyValuePair< K, V > CamArray10
 
KeyValuePair< K, V > CamArray11
 
KeyValuePair< K, V > CamArray12
 
KeyValuePair< K, V > CamArray13
 
KeyValuePair< K, V > CamArray14
 
KeyValuePair< K, V > CamArray15
 

Detailed Description

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

Definition at line 61 of file cam16.hpp.

Constructor & Destructor Documentation

◆ Cam16()

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

Definition at line 80 of file cam16.hpp.

80  {
81 #pragma HLS pipeline II=1
82  CamArray0.valid = false;
83  CamArray1.valid = false;
84  CamArray2.valid = false;
85  CamArray3.valid = false;
86  CamArray4.valid = false;
87  CamArray5.valid = false;
88  CamArray6.valid = false;
89  CamArray7.valid = false;
90  CamArray8.valid = false;
91  CamArray9.valid = false;
92  CamArray10.valid = false;
93  CamArray11.valid = false;
94  CamArray12.valid = false;
95  CamArray13.valid = false;
96  CamArray14.valid = false;
97  CamArray15.valid = false;
98  }
KeyValuePair< K, V > CamArray2
Definition: cam16.hpp:65
KeyValuePair< K, V > CamArray3
Definition: cam16.hpp:66
KeyValuePair< K, V > CamArray8
Definition: cam16.hpp:71
KeyValuePair< K, V > CamArray15
Definition: cam16.hpp:78
KeyValuePair< K, V > CamArray7
Definition: cam16.hpp:70
KeyValuePair< K, V > CamArray12
Definition: cam16.hpp:75
KeyValuePair< K, V > CamArray1
Definition: cam16.hpp:64
KeyValuePair< K, V > CamArray4
Definition: cam16.hpp:67
KeyValuePair< K, V > CamArray0
Definition: cam16.hpp:63
KeyValuePair< K, V > CamArray11
Definition: cam16.hpp:74
KeyValuePair< K, V > CamArray6
Definition: cam16.hpp:69
KeyValuePair< K, V > CamArray5
Definition: cam16.hpp:68
KeyValuePair< K, V > CamArray10
Definition: cam16.hpp:73
KeyValuePair< K, V > CamArray9
Definition: cam16.hpp:72
KeyValuePair< K, V > CamArray14
Definition: cam16.hpp:77
KeyValuePair< K, V > CamArray13
Definition: cam16.hpp:76

Member Function Documentation

◆ deleteEntry()

template<typename K , typename V >
bool Cam16< 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 442 of file cam16.hpp.

443  {
444 #pragma HLS pipeline II=1
445 #pragma HLS INLINE
446 
447  if ((CamArray0.key == key) && (CamArray0.valid == true)) {
448  CamArray0.valid = false;
449  return true;
450  }
451  else if ((CamArray1.key == key) && (CamArray1.valid == true)) {
452  CamArray1.valid = false;
453  return true;
454  }
455  else if ((CamArray2.key == key) && (CamArray2.valid == true)) {
456  CamArray2.valid = false;
457  return true;
458  }
459  else if ((CamArray3.key == key) && (CamArray3.valid == true)) {
460  CamArray3.valid = false;
461  return true;
462  }
463  else if ((CamArray4.key == key) && (CamArray4.valid == true)) {
464  CamArray4.valid = false;
465  return true;
466  }
467  else if ((CamArray5.key == key) && (CamArray5.valid == true)) {
468  CamArray5.valid = false;
469  return true;
470  }
471  else if ((CamArray6.key == key) && (CamArray6.valid == true)) {
472  CamArray6.valid = false;
473  return true;
474  }
475  else if ((CamArray7.key == key) && (CamArray7.valid == true)) {
476  CamArray7.valid = false;
477  return true;
478  }
479  else if ((CamArray8.key == key) && (CamArray8.valid == true)) {
480  CamArray8.valid = false;
481  return true;
482  }
483  else if ((CamArray9.key == key) && (CamArray9.valid == true)) {
484  CamArray9.valid = false;
485  return true;
486  }
487  else if ((CamArray10.key == key) && (CamArray10.valid == true)) {
488  CamArray10.valid = false;
489  return true;
490  }
491  else if ((CamArray11.key == key) && (CamArray11.valid == true)) {
492  CamArray11.valid = false;
493  return true;
494  }
495  else if ((CamArray12.key == key) && (CamArray12.valid == true)) {
496  CamArray12.valid = false;
497  return true;
498  }
499  else if ((CamArray13.key == key) && (CamArray13.valid == true)) {
500  CamArray13.valid = false;
501  return true;
502  }
503  else if ((CamArray14.key == key) && (CamArray14.valid == true)) {
504  CamArray14.valid = false;
505  return true;
506  }
507  else if ((CamArray15.key == key) && (CamArray15.valid == true)) {
508  CamArray15.valid = false;
509  return true;
510  }
511  else {
512  return false;
513  }
514  }

◆ insert() [1/2]

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

Definition at line 342 of file cam16.hpp.

343  {
344 #pragma HLS INLINE
345  return insert(KeyValuePair<K,V>(key,value,true));
346  }
bool insert(KeyValuePair< K, V > kVP)
Insert a new key-value pair in the CAM array.
Definition: cam16.hpp:268
Here is the call graph for this function:

◆ insert() [2/2]

template<typename K , typename V >
bool Cam16< 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 268 of file cam16.hpp.

269  {
270 #pragma HLS pipeline II=1
271 #pragma HLS INLINE
272 
273  if (CamArray0.valid == false) {
274  CamArray0 = kVP;
275  return true;
276  }
277  else if (CamArray1.valid == false) {
278  CamArray1 = kVP;
279  return true;
280  }
281  else if (CamArray2.valid == false) {
282  CamArray2 = kVP;
283  return true;
284  }
285  else if (CamArray3.valid == false) {
286  CamArray3 = kVP;
287  return true;
288  }
289  else if (CamArray4.valid == false) {
290  CamArray4 = kVP;
291  return true;
292  }
293  else if (CamArray5.valid == false) {
294  CamArray5 = kVP;
295  return true;
296  }
297  else if (CamArray6.valid == false) {
298  CamArray6 = kVP;
299  return true;
300  }
301  else if (CamArray7.valid == false) {
302  CamArray7 = kVP;
303  return true;
304  }
305  else if (CamArray8.valid == false) {
306  CamArray8 = kVP;
307  return true;
308  }
309  else if (CamArray9.valid == false) {
310  CamArray9 = kVP;
311  return true;
312  }
313  else if (CamArray10.valid == false) {
314  CamArray10 = kVP;
315  return true;
316  }
317  else if (CamArray11.valid == false) {
318  CamArray11 = kVP;
319  return true;
320  }
321  else if (CamArray12.valid == false) {
322  CamArray12 = kVP;
323  return true;
324  }
325  else if (CamArray13.valid == false) {
326  CamArray13 = kVP;
327  return true;
328  }
329  else if (CamArray14.valid == false) {
330  CamArray14 = kVP;
331  return true;
332  }
333  else if (CamArray15.valid == false) {
334  CamArray15 = kVP;
335  return true;
336  }
337  else {
338  return false;
339  }
340  }
Here is the caller graph for this function:

◆ lookup()

template<typename K , typename V >
bool Cam16< 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 107 of file cam16.hpp.

108  {
109 #pragma HLS pipeline II=1
110 #pragma HLS INLINE
111  if ((CamArray0.key == key) && (CamArray0.valid == true)) {
112  value = CamArray0.value;
113  return true;
114  }
115  else if ((CamArray1.key == key) && (CamArray1.valid == true)) {
116  value = CamArray1.value;
117  return true;
118  }
119  else if ((CamArray2.key == key) && (CamArray2.valid == true)) {
120  value = CamArray2.value;
121  return true;
122  }
123  else if ((CamArray3.key == key) && (CamArray3.valid == true)) {
124  value = CamArray3.value;
125  return true;
126  }
127  else if ((CamArray4.key == key) && (CamArray4.valid == true)) {
128  value = CamArray4.value;
129  return true;
130  }
131  else if ((CamArray5.key == key) && (CamArray5.valid == true)) {
132  value = CamArray5.value;
133  return true;
134  }
135  else if ((CamArray6.key == key) && (CamArray6.valid == true)) {
136  value = CamArray6.value;
137  return true;
138  }
139  else if ((CamArray7.key == key) && (CamArray7.valid == true)) {
140  value = CamArray7.value;
141  return true;
142  }
143  else if ((CamArray8.key == key) && (CamArray8.valid == true)) {
144  value = CamArray8.value;
145  return true;
146  }
147  else if ((CamArray9.key == key) && (CamArray9.valid == true)) {
148  value = CamArray9.value;
149  return true;
150  }
151  else if ((CamArray10.key == key) && (CamArray10.valid == true)) {
152  value = CamArray10.value;
153  return true;
154  }
155  else if ((CamArray11.key == key) && (CamArray11.valid == true)) {
156  value = CamArray11.value;
157  return true;
158  }
159  else if ((CamArray12.key == key) && (CamArray12.valid == true)) {
160  value = CamArray12.value;
161  return true;
162  }
163  else if ((CamArray13.key == key) && (CamArray13.valid == true)) {
164  value = CamArray13.value;
165  return true;
166  }
167  else if ((CamArray14.key == key) && (CamArray14.valid == true)) {
168  value = CamArray14.value;
169  return true;
170  }
171  else if ((CamArray15.key == key) && (CamArray15.valid == true)) {
172  value = CamArray15.value;
173  return true;
174  }
175  else {
176  return false;
177  }
178  }

◆ reset()

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

Invalidate all entries of the CAM array.

Definition at line 520 of file cam16.hpp.

521  {
522 #pragma HLS pipeline II=1
523 #pragma HLS INLINE
524 
525  CamArray0.valid = false;
526  CamArray1.valid = false;
527  CamArray2.valid = false;
528  CamArray3.valid = false;
529  CamArray4.valid = false;
530  CamArray5.valid = false;
531  CamArray6.valid = false;
532  CamArray7.valid = false;
533  CamArray8.valid = false;
534  CamArray9.valid = false;
535  CamArray10.valid = false;
536  CamArray11.valid = false;
537  CamArray12.valid = false;
538  CamArray13.valid = false;
539  CamArray14.valid = false;
540  CamArray15.valid = false;
541  }

◆ reverse_lookup()

template<typename K , typename V >
bool Cam16< 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 188 of file cam16.hpp.

189  {
190 #pragma HLS pipeline II=1
191 #pragma HLS INLINE
192  if ((CamArray0.value == value) && (CamArray0.valid == true)) {
193  key = CamArray0.key;
194  return true;
195  }
196  else if ((CamArray1.value == value) && (CamArray1.valid == true)) {
197  key = CamArray1.key;
198  return true;
199  }
200  else if ((CamArray2.value == value) && (CamArray2.valid == true)) {
201  key = CamArray2.key;
202  return true;
203  }
204  else if ((CamArray3.value == value) && (CamArray3.valid == true)) {
205  key = CamArray3.key;
206  return true;
207  }
208  else if ((CamArray4.value == value) && (CamArray4.valid == true)) {
209  key = CamArray4.key;
210  return true;
211  }
212  else if ((CamArray5.value == value) && (CamArray5.valid == true)) {
213  key = CamArray5.key;
214  return true;
215  }
216  else if ((CamArray6.value == value) && (CamArray6.valid == true)) {
217  key = CamArray6.key;
218  return true;
219  }
220  else if ((CamArray7.value == value) && (CamArray7.valid == true)) {
221  key = CamArray7.key;
222  return true;
223  }
224  else if ((CamArray8.value == value) && (CamArray8.valid == true)) {
225  key = CamArray8.key;
226  return true;
227  }
228  else if ((CamArray9.value == value) && (CamArray9.valid == true)) {
229  key = CamArray9.key;
230  return true;
231  }
232  else if ((CamArray10.value == value) && (CamArray10.valid == true)) {
233  key = CamArray10.key;
234  return true;
235  }
236  else if ((CamArray11.value == value) && (CamArray11.valid == true)) {
237  key = CamArray11.key;
238  return true;
239  }
240  else if ((CamArray12.value == value) && (CamArray12.valid == true)) {
241  key = CamArray12.key;
242  return true;
243  }
244  else if ((CamArray13.value == value) && (CamArray13.valid == true)) {
245  key = CamArray13.key;
246  return true;
247  }
248  else if ((CamArray14.value == value) && (CamArray14.valid == true)) {
249  key = CamArray14.key;
250  return true;
251  }
252  else if ((CamArray15.value == value) && (CamArray15.valid == true)) {
253  key = CamArray15.key;
254  return true;
255  }
256  else {
257  return false;
258  }
259  }

◆ update() [1/2]

template<typename K , typename V >
bool Cam16< 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 356 of file cam16.hpp.

357  {
358 #pragma HLS pipeline II=1
359 #pragma HLS INLINE
360  if ((CamArray0.key == key) && (CamArray0.valid == true)) {
361  CamArray0.value = value;
362  return true;
363  }
364  else if ((CamArray1.key == key) && (CamArray1.valid == true)) {
365  CamArray1.value = value;
366  return true;
367  }
368  else if ((CamArray2.key == key) && (CamArray2.valid == true)) {
369  CamArray2.value = value;
370  return true;
371  }
372  else if ((CamArray3.key == key) && (CamArray3.valid == true)) {
373  CamArray3.value = value;
374  return true;
375  }
376  else if ((CamArray4.key == key) && (CamArray4.valid == true)) {
377  CamArray4.value = value;
378  return true;
379  }
380  else if ((CamArray5.key == key) && (CamArray5.valid == true)) {
381  CamArray5.value = value;
382  return true;
383  }
384  else if ((CamArray6.key == key) && (CamArray6.valid == true)) {
385  CamArray6.value = value;
386  return true;
387  }
388  else if ((CamArray7.key == key) && (CamArray7.valid == true)) {
389  CamArray7.value = value;
390  return true;
391  }
392  else if ((CamArray8.key == key) && (CamArray8.valid == true)) {
393  CamArray8.value = value;
394  return true;
395  }
396  else if ((CamArray9.key == key) && (CamArray9.valid == true)) {
397  CamArray9.value = value;
398  return true;
399  }
400  else if ((CamArray10.key == key) && (CamArray10.valid == true)) {
401  CamArray10.value = value;
402  return true;
403  }
404  else if ((CamArray11.key == key) && (CamArray11.valid == true)) {
405  CamArray11.value = value;
406  return true;
407  }
408  else if ((CamArray12.key == key) && (CamArray12.valid == true)) {
409  CamArray12.value = value;
410  return true;
411  }
412  else if ((CamArray13.key == key) && (CamArray13.valid == true)) {
413  CamArray13.value = value;
414  return true;
415  }
416  else if ((CamArray14.key == key) && (CamArray14.valid == true)) {
417  CamArray14.value = value;
418  return true;
419  }
420  else if ((CamArray15.key == key) && (CamArray15.valid == true)) {
421  CamArray15.value = value;
422  return true;
423  }
424  else {
425  return false;
426  }
427  }
Here is the caller graph for this function:

◆ update() [2/2]

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

Definition at line 429 of file cam16.hpp.

430  {
431 #pragma HLS INLINE
432  return update(kVP.key, kVP.value);
433  }
bool update(K key, V value)
Search the CAM array for a key and updates the corresponding value.
Definition: cam16.hpp:356
Here is the call graph for this function:

Member Data Documentation

◆ CamArray0

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

Definition at line 63 of file cam16.hpp.

◆ CamArray1

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

Definition at line 64 of file cam16.hpp.

◆ CamArray10

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray10
protected

Definition at line 73 of file cam16.hpp.

◆ CamArray11

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray11
protected

Definition at line 74 of file cam16.hpp.

◆ CamArray12

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray12
protected

Definition at line 75 of file cam16.hpp.

◆ CamArray13

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray13
protected

Definition at line 76 of file cam16.hpp.

◆ CamArray14

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray14
protected

Definition at line 77 of file cam16.hpp.

◆ CamArray15

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray15
protected

Definition at line 78 of file cam16.hpp.

◆ CamArray2

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

Definition at line 65 of file cam16.hpp.

◆ CamArray3

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

Definition at line 66 of file cam16.hpp.

◆ CamArray4

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

Definition at line 67 of file cam16.hpp.

◆ CamArray5

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

Definition at line 68 of file cam16.hpp.

◆ CamArray6

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

Definition at line 69 of file cam16.hpp.

◆ CamArray7

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

Definition at line 70 of file cam16.hpp.

◆ CamArray8

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray8
protected

Definition at line 71 of file cam16.hpp.

◆ CamArray9

template<typename K , typename V >
KeyValuePair<K,V> Cam16< K, V >::CamArray9
protected

Definition at line 72 of file cam16.hpp.


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