This repo contains a BloomFilter chisel module, a scala-implemented reference model, several hash functions and test code.
This implementation is a 2-staged bloom filter, which means lookup result will be given in next cycle (limited by SyncReadMem).
sbt test
A new hash function class should inherite HashFunc
, implement hash_scala
to return the hash value for scala model, and hash_chisel
to return the hardware implementation. Hash functions should consider input_width
as width of data to be hashed, and use hash_width
as width of hash value. HashFunc_Modulo
is a good example.
BloomFilter
and BloomFilterModel
requires BloomFilterParams
as parameter. The BloomFilterParameter
requires following input when instantiates:
val hash_funcs: Seq[HashFunc] // a sequence of HashFunc object
val data_width: Int // input data width
val array_size: Int // BloomFilter array size
-
Test clear memory
-
Test insert data and readback
-
Test pipelined lookup/insert
-
Test Chisel implementation against Scala model
Following hash functions are implemented:
-
Currently the
BloomFilter
chisel module will instantiatesn_hash_funcs + 1
number of memory write ports (extra 1 port is for clearing chisel SyncReadMem). However even in worst case onlyn_hash_funcs
write ports will be used at same time (write and clear won't happen at same time). The extra port can be merged. -
Futher more, clearing speed can be increased by using existing hash function write ports.