CS/COE 535 |
Acceleration of Algorithms in Reconfigurable Hardware |
Lockwood, Fall 2003 |
Assigned |
Monday, October 13th, 2003 |
Due Date |
Monday, October 27th, 2003 by 4pm |
Purpose: |
Bloom filters as string matchers |
Points |
(100 points) |
Bloom Filters
In Lecture 5 we learned about bloom filters and their uses for string/signature matching. In this machine problem, we are going to implement a bloom filter to be used to do signature matching. Bloom filters are very good at performing large membership queries very quickly. Some important things of note about bloom filters include:
Hash Function
In Lecture 6 and Lecture 6b we learned about hashing techniques that can be implemented in hardware. Since the bloom filter uses a hash function to set a bit vector, a simple hash function will also need to be implemented. In this assignment we will compute 10 different hash functions. By calculating 10 hash functions, the false positive probability becomes f = (1/2)^10 = 0.001. The ith hash function is defined as:
In this machine problem, the set of {di1, di2, di3, ...., dib} is a set of random 12-bit values. To put this equation in words, for each bit in a character string, if that bit is equal to '1', xor the random value associated with that bit with the current result. For example, suppose you have to calculate a 3-bit hash value and you are given the follow parameters:
d = {"011", "100", "001", "011", "110"} -- the random values
X = 01011 -- the input string
The resulting hash value will be 100 xor 011 xor 110 = 001
Note that the only difference between the 10 hash functions will be the set of random values, d.
Directions:
Part 0: Download the MP2 Distribution file here. The following files are new to this distribution:
options_processor.vhd - wrapper file around the bloom filter
input_controller_fsm.vhd - component to control input controller.
input_controller.vhd - component which takes 32-bit words and converts them to an in-order byte stream
fifo_512_by_36.vhd (and edn) - buffer for the input controller
large_bloom_filter.vhd - main bloom filter component top level
random_values.vhd - array of random values for the 10 different hash functions
alert_generator.vhd - component which creates an alert message for statistics counter reads, testing output, and bloom filter matches.
alert_generator_fsm.vhd - the FSM for the alert_generator. (Note that these two files have changed since MP1)
fifo_256_by_32.vhd (and edn) - buffer for the alert generator.
Part 1: Generating your bloom filter memory (bit vector)
Part 2: Creating a Partial Bloom Filter (PBF)
Figure 1: Partial Bloom Filter Interface.
Figure 2: High Level block diagram of a large bloom filter.
Figure 3: A table entry for 1 hash function (specifically hash function 9).
Part 4: Wiring up your LBF into the options processor file.
Figure 4: Options Processor Block Diagram
Part 5: Modifying the CPP to accept a new opcode to just test whether your module is working properly.
Part 6: Modifying the CPP to interface with your bloom filter
Modify the CPP to accept a new opcode. This opcode will be x74, and it has the format given in Figure 5.
The # Bits to Edit field is 8 bits. A 0 in this field means
there is one entry following. A 1 in this field means there are
two entries following. Etc. etc.. up to 255 which means there are
256 entries following.
Figure 5: Control Packet format for opcode x74.
Modify your state machine to count these 2 new opcodes
A suggested modification for the cpp is shown in Figure 6. Note that this requires storing the # of bits to edit field in a register.
Figure 6: Suggested Modification of CPP.
Part 7: Modifying Top Level to include your components.
The new top level has wired everything up already. CHECK that everything is mapped correctly for your implementation.
Part 8: Simulating Everything
Simulate your design in modelsim. You will be asked to submit a simulation.
A Java Program has been provided which creates control packets to set bits for a specific character string. (You will need to compile the source code).
To use this program type java BitSetter <location of random_values.vhd file> in a cygwin window.
The program will await input from you. You can either input:
Part 9: Synthesis and Build
Use Synplicity to make an edn file for your design. Follow the steps given in MP1.
Once you have completed synthesis, use the provided makefile in the backend directory. From a cygwin shell, type 'make build'.
If you want to change the target frequency, you can change all 4 values in the network_application_core.ncf file. Currently, the rad_clk period is set to 40 ns (25 MHz).
This will generate a bitfile if there are no errors. You will submit this bitfile to the online test server to test it in hardware.
Table 1: Symbol Key
Of Interest |
Modify |
Synthesizable |
Table 2: New files in MP2_distribution.tar
MP2_Distribution/sim/ Simulation Folder |
|
|
|||||
|
makefile |
Example make file used to automate compilation and simulation. |
|
|
|||
|
mp2_wave.do |
Wave list including top level of snort_app.vhd and cpp_rules_programmer.vhd |
|
|
|||
|
mp2_test.dat |
Test data packets. |
|
|
|||
|
|
||||||
MP2_Distribution/backend/ Backend Folder |
|||||||
|
fifo_256_by_32.edn |
Alert Generator specific fifo. |
|
|
|
||
|
fifo_512_by_36.edn |
Input Controller specific fifo. |
|
|
|
||
MP2_Distribution/java/ Java Folder |
|||||||
|
BitSetter.java |
Java Program to create Control Packets for setting bits in block ram. |
|
|
|
||
MP2_Distribution/syn/ Synthesis Source Folder |
|||||||
|
Nothing yet, but you will add a snort_app.prj file. |
||||||
MP2_Distribution/vhdl/ VHDL Source Folder |
|||||||
|
alert_generator.vhd |
UDP Alert message generator |
|
||||
|
alert_generator_fsm.vhd |
Packet generator control FSM |
|
|
|||
|
random_values.vhd |
VHDL file with constant for calculating hash functions. |
|
|
|||
|
large_bloom_filter.vhd |
Top level file for your bloom filter |
|
|
|
||
|
fifo_256_by_32.vhd |
Fifo Used by the alert generator |
|
|
|
||
|
fifo_512_by_36.vhd |
Fifo Used by the input controller |
|
|
|
||
|
input_controller_fsm.vhd |
FSM controlling input controller. |
|
|
|||
|
input_controller.vhd |
Converts 32-bit words to byte stream. |
|
|
|||
|
options_processor.vhd |
Wrapper around the Bloom Filter and Input Controller. |
|
||||
|
snort_app.vhd |
Top Level Design Unit (modified) |
|
Things to Turn In:
Bonus Opportunities:
Submission:
PAR Speed
Here is a checklist of the things you need to turn in:
Part 2: Partial Bloom Filter
VHDL code written. ( 5 pts)
Part 3: Large Bloom Filter
All VHDL code written/modified. ( 4 pts)
Simulation waveforms showing this working. ( 4 pts)
Part 4: Options Processor Modification
Parts 5 & 6: Control Packet Processor Modification
Part 7: Top Level Modifications (if any)
Part 8: Simulation
Part 9: Synthesis and Build
Also submit the network_application_core.par file generated after running the build scripts. ( 2 pts)
Submit the requested waveforms and vhdl to the Electronic Homework Server. ( 25 pts)
Submit synthesized .bit file to the test server where it will be tested in hardware. ( 75 pts)
Follow the instructions on the server, it will inform you if your design passed or not.