xiiregexbuilder

FPGA-Accelerated Regular Expression Matching Engine
commit 887ac8bc533aee3cda032754c0f8222599f2ef6a
parent 4dec5d9a87d7091515b0a75301dd83e04977e9b5
Author: RahulSannapureddy <rahul.sannapureddy@gmail.com>
Date:   Sat,  4 Apr 2026 06:52:10 +0530

Week 3: Implement Top Testbench and start simulation logging (Part 3: Finalizing)

Diffstat:
Mdump.vcd | 69+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Moutput-eg/tb_top.v | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 132 insertions(+), 0 deletions(-)

diff --git a/dump.vcd b/dump.vcd @@ -229,3 +229,72 @@ b101 ' 1( 1. b0 / +b0 2 +14 +b100 8 +b0 9 +b0 ; + +#60000 +0! +0% +0( +0, + +#65000 +1! +b0 ' +1( +0. +04 +b0 8 + +#70000 +0! +1$ +0( +1+ + +#75000 +1! +1( +b1 / +b10 0 +b1 2 +b10 3 +b1 5 +b1 8 +b10 9 +b1 ; +b10 < +b1 > + +#80000 +0! +0$ +b1100010 & +0( +0+ +b1100010 - +b100 0 +b0 3 +b100 6 +b0 9 +b0 < +b100 ? + +#85000 +1! +1( +b100 / +b0 0 +b0 2 +b100 5 +b0 8 +b0 ; +b100 > + +#90000 +0! +1% +0( diff --git a/output-eg/tb_top.v b/output-eg/tb_top.v @@ -211,3 +211,66 @@ module tb_top; end_of_str = 0; #10; // Test case 14: "(a|b)" + start = 1; #10 start = 0; + char_in = 8'h28; #10; + char_in = 8'h61; #10; + char_in = 8'h7c; #10; + char_in = 8'h62; #10; + char_in = 8'h29; #10; + end_of_str = 1; #10; + // Match output is valid on the cycle immediately following end_of_str assertion + if (match_bus === 6'b000000) begin + $display("PASS: Test case 14 ('(a|b)') matches expected mask 000000"); + end else begin + $display("FAIL: Test case 14 ('(a|b)') expected 000000, got %b", match_bus); + end + end_of_str = 0; #10; + + // Test case 15: "abc" + start = 1; #10 start = 0; + char_in = 8'h61; #10; + char_in = 8'h62; #10; + char_in = 8'h63; #10; + end_of_str = 1; #10; + // Match output is valid on the cycle immediately following end_of_str assertion + if (match_bus === 6'b010110) begin + $display("PASS: Test case 15 ('abc') matches expected mask 010110"); + end else begin + $display("FAIL: Test case 15 ('abc') expected 010110, got %b", match_bus); + end + end_of_str = 0; #10; + + // Test case 16: "abcd" + start = 1; #10 start = 0; + char_in = 8'h61; #10; + char_in = 8'h62; #10; + char_in = 8'h63; #10; + char_in = 8'h64; #10; + end_of_str = 1; #10; + // Match output is valid on the cycle immediately following end_of_str assertion + if (match_bus === 6'b100000) begin + $display("PASS: Test case 16 ('abcd') matches expected mask 100000"); + end else begin + $display("FAIL: Test case 16 ('abcd') expected 100000, got %b", match_bus); + end + end_of_str = 0; #10; + + // Test case 17: "abce" + start = 1; #10 start = 0; + char_in = 8'h61; #10; + char_in = 8'h62; #10; + char_in = 8'h63; #10; + char_in = 8'h65; #10; + end_of_str = 1; #10; + // Match output is valid on the cycle immediately following end_of_str assertion + if (match_bus === 6'b100000) begin + $display("PASS: Test case 17 ('abce') matches expected mask 100000"); + end else begin + $display("FAIL: Test case 17 ('abce') expected 100000, got %b", match_bus); + end + end_of_str = 0; #10; + + $display("All tests completed."); + #100; $finish; + end +endmodule