Clark_Nfa Documentation

This page contains the Clark_Nfa Package documentation.

The clark_nfa Module

class netbench.pattern_match.algorithms.clark_nfa.clark_nfa.clark_nfa(canonical=True, stride=1)

Bases: netbench.pattern_match.nfa_reductions.nfa_reductions

Class implementing Clark NFA. Supports also sharing of char classes if b_Sym_char_class symbols are used and parameter canonical is set to False.

Based on:
    1. Clark and D. E. Schimmel, “Efficient Reconfigurable Logic Circuits for Matching Complex Network Intrusion Detection Patterns, ” In Proceedings of International Conference on Field Programmable Logic and Applications (FPL), pp. 956-959, 2003.
    1. Clark and D. E. Schimmel, “Scalable Pattern Matching for High-Speed Networks,” In Proceedings of IEEE Symposium on Field-Programmable Custom Computing Machines (FCCM), pp. 249-257, 2004.

Generated VHDL code depends on those modules: value_decoder.vhd, state.vhd and final_bitmap.vhd. Those modules are located in directory vhdl.

Supported symbols for this algorithm are sym_char and sym_char_class (If canonical constructor parameter is set to False) and sym_kchar if stride parameter is bigger than 1. When strided automaton is used the parameter canonical does not effect the construction process.

Parameters:
  • canonical (boolean) – If True all char classes generated by parser are removed. If False char classes generated by parser are preserved and method create_char_classes() is called to cretate every possible char class. When strided automaton is used the parameter canonical does not effect the construction process.
  • stride (int) – Number of characters accepted in one clock cycle. Defaults to 1 char per CLK. Only powers of 2 supported.
compute()
Compute Clark automata mapping into FPGA.
get_HDL(useBram=False)

Return VHDL description of NFA unit implemented in Clark’s approach.

Parameter:useBram (boolean) –

Defines if BRAM implementation of character decoder will be used. (True = BRAM, False = LUT)

NOTE: Only False is currently supported.

Returns:VHDL description of NFA unit implemented in Clark’s approach.
Return type:string
report_logic()

Reports amount of logic consumed by the algorithm.

Returns:Amount of logic consumed by the algorithm (LUTs, FlipFlops, BRAMs).
Return type:tuple(int, int, int)

The test_clark_nfa Module

netbench.pattern_match.algorithms.clark_nfa.test_clark_nfa.create_simulation(alg)

Creates simulation files from templates for object specified by alg parameter.

Parameter:alg (b_ptrn_match) – Object representing pattern matching algorithm.
netbench.pattern_match.algorithms.clark_nfa.test_clark_nfa.load_file(name)

Open file specified by name and split content acording to “%$%”.

Parameter:name (string) – Name of the file.
Returns:Loaded and splited content of the file.
Return type:list(string)
netbench.pattern_match.algorithms.clark_nfa.test_clark_nfa.run_simulation(test)

Runs the simulation and compare the results.

Parameter:test – Object representing the test.
Returns:True when simulation is OK, False otherwise.
Return type:boolean
netbench.pattern_match.algorithms.clark_nfa.test_clark_nfa.save_file(name, content)

Save the content stored in parameter content into file named by parameter name.

Parameters:
  • name (string) – Name of the file.
  • content (string) – Content to write.
class netbench.pattern_match.algorithms.clark_nfa.test_clark_nfa.test_clark_nfa(methodName='runTest')

Bases: unittest.TestCase

A base test class for Clark NFA.

test_strided()
Tests the algorithm with stride = 2.
test_wchc()
Tests the algorithm when character classes are used.
test_wochc()
Tests the algorithm without character classes.

Table Of Contents

Previous topic

Phf_Dfa Documentation

Next topic

History_Fa Documentation

This Page