xiiregexbuilder

FPGA-Accelerated Regular Expression Matching Engine

output-eg/tb_top.v (26644B)


  1`timescale 1ns / 1ps
  2
  3module tb_top;
  4    reg clk, en, rst, start, end_of_str;
  5    reg [7:0] char_in;
  6    wire [15:0] match_bus;
  7    wire [15:0] active_bus;
  8
  9    top uut (.clk(clk), .en(en), .rst(rst), .start(start), .end_of_str(end_of_str), .char_in(char_in), .match_bus(match_bus), .active_bus(active_bus));
 10
 11    always #5 clk = ~clk;
 12
 13    initial begin
 14        // synthesis translate_off
 15        `ifndef SYNTHESIS
 16        $dumpfile("dump.vcd");
 17        $dumpvars(0, tb_top);
 18        `endif
 19        // synthesis translate_on
 20
 21        clk = 0; en = 1; rst = 1; start = 0; end_of_str = 0; char_in = 0;
 22        #20 rst = 0; #10;
 23
 24        // Test case 0: "cat"
 25        start = 1; #10 start = 0;
 26        char_in = 8'h63; #10;
 27        char_in = 8'h61; #10;
 28        char_in = 8'h74; #10;
 29        end_of_str = 1; #10;
 30        // Match output is valid on the cycle immediately following end_of_str assertion
 31        if (match_bus === 16'b0000000000000011) begin
 32            $display("PASS: Test case 0 ('cat') matches expected mask 0000000000000011");
 33        end else begin
 34            $display("FAIL: Test case 0 ('cat') expected 0000000000000011, got %b", match_bus);
 35        end
 36        end_of_str = 0; #10;
 37
 38        // Test case 1: "dog"
 39        start = 1; #10 start = 0;
 40        char_in = 8'h64; #10;
 41        char_in = 8'h6f; #10;
 42        char_in = 8'h67; #10;
 43        end_of_str = 1; #10;
 44        // Match output is valid on the cycle immediately following end_of_str assertion
 45        if (match_bus === 16'b0000000000000100) begin
 46            $display("PASS: Test case 1 ('dog') matches expected mask 0000000000000100");
 47        end else begin
 48            $display("FAIL: Test case 1 ('dog') expected 0000000000000100, got %b", match_bus);
 49        end
 50        end_of_str = 0; #10;
 51
 52        // Test case 2: "tomcat"
 53        start = 1; #10 start = 0;
 54        char_in = 8'h74; #10;
 55        char_in = 8'h6f; #10;
 56        char_in = 8'h6d; #10;
 57        char_in = 8'h63; #10;
 58        char_in = 8'h61; #10;
 59        char_in = 8'h74; #10;
 60        end_of_str = 1; #10;
 61        // Match output is valid on the cycle immediately following end_of_str assertion
 62        if (match_bus === 16'b0000000000000000) begin
 63            $display("PASS: Test case 2 ('tomcat') matches expected mask 0000000000000000");
 64        end else begin
 65            $display("FAIL: Test case 2 ('tomcat') expected 0000000000000000, got %b", match_bus);
 66        end
 67        end_of_str = 0; #10;
 68
 69        // Test case 3: "cot"
 70        start = 1; #10 start = 0;
 71        char_in = 8'h63; #10;
 72        char_in = 8'h6f; #10;
 73        char_in = 8'h74; #10;
 74        end_of_str = 1; #10;
 75        // Match output is valid on the cycle immediately following end_of_str assertion
 76        if (match_bus === 16'b0000000000000010) begin
 77            $display("PASS: Test case 3 ('cot') matches expected mask 0000000000000010");
 78        end else begin
 79            $display("FAIL: Test case 3 ('cot') expected 0000000000000010, got %b", match_bus);
 80        end
 81        end_of_str = 0; #10;
 82
 83        // Test case 4: "cut"
 84        start = 1; #10 start = 0;
 85        char_in = 8'h63; #10;
 86        char_in = 8'h75; #10;
 87        char_in = 8'h74; #10;
 88        end_of_str = 1; #10;
 89        // Match output is valid on the cycle immediately following end_of_str assertion
 90        if (match_bus === 16'b0000000000000010) begin
 91            $display("PASS: Test case 4 ('cut') matches expected mask 0000000000000010");
 92        end else begin
 93            $display("FAIL: Test case 4 ('cut') expected 0000000000000010, got %b", match_bus);
 94        end
 95        end_of_str = 0; #10;
 96
 97        // Test case 5: "ct"
 98        start = 1; #10 start = 0;
 99        char_in = 8'h63; #10;
100        char_in = 8'h74; #10;
101        end_of_str = 1; #10;
102        // Match output is valid on the cycle immediately following end_of_str assertion
103        if (match_bus === 16'b0000000000000000) begin
104            $display("PASS: Test case 5 ('ct') matches expected mask 0000000000000000");
105        end else begin
106            $display("FAIL: Test case 5 ('ct') expected 0000000000000000, got %b", match_bus);
107        end
108        end_of_str = 0; #10;
109
110        // Test case 6: "doog"
111        start = 1; #10 start = 0;
112        char_in = 8'h64; #10;
113        char_in = 8'h6f; #10;
114        char_in = 8'h6f; #10;
115        char_in = 8'h67; #10;
116        end_of_str = 1; #10;
117        // Match output is valid on the cycle immediately following end_of_str assertion
118        if (match_bus === 16'b0000000000000100) begin
119            $display("PASS: Test case 6 ('doog') matches expected mask 0000000000000100");
120        end else begin
121            $display("FAIL: Test case 6 ('doog') expected 0000000000000100, got %b", match_bus);
122        end
123        end_of_str = 0; #10;
124
125        // Test case 7: "dg"
126        start = 1; #10 start = 0;
127        char_in = 8'h64; #10;
128        char_in = 8'h67; #10;
129        end_of_str = 1; #10;
130        // Match output is valid on the cycle immediately following end_of_str assertion
131        if (match_bus === 16'b0000000000000100) begin
132            $display("PASS: Test case 7 ('dg') matches expected mask 0000000000000100");
133        end else begin
134            $display("FAIL: Test case 7 ('dg') expected 0000000000000100, got %b", match_bus);
135        end
136        end_of_str = 0; #10;
137
138        // Test case 8: "beep"
139        start = 1; #10 start = 0;
140        char_in = 8'h62; #10;
141        char_in = 8'h65; #10;
142        char_in = 8'h65; #10;
143        char_in = 8'h70; #10;
144        end_of_str = 1; #10;
145        // Match output is valid on the cycle immediately following end_of_str assertion
146        if (match_bus === 16'b0000000000001000) begin
147            $display("PASS: Test case 8 ('beep') matches expected mask 0000000000001000");
148        end else begin
149            $display("FAIL: Test case 8 ('beep') expected 0000000000001000, got %b", match_bus);
150        end
151        end_of_str = 0; #10;
152
153        // Test case 9: "bep"
154        start = 1; #10 start = 0;
155        char_in = 8'h62; #10;
156        char_in = 8'h65; #10;
157        char_in = 8'h70; #10;
158        end_of_str = 1; #10;
159        // Match output is valid on the cycle immediately following end_of_str assertion
160        if (match_bus === 16'b0000000000001000) begin
161            $display("PASS: Test case 9 ('bep') matches expected mask 0000000000001000");
162        end else begin
163            $display("FAIL: Test case 9 ('bep') expected 0000000000001000, got %b", match_bus);
164        end
165        end_of_str = 0; #10;
166
167        // Test case 10: "bp"
168        start = 1; #10 start = 0;
169        char_in = 8'h62; #10;
170        char_in = 8'h70; #10;
171        end_of_str = 1; #10;
172        // Match output is valid on the cycle immediately following end_of_str assertion
173        if (match_bus === 16'b0000000000000000) begin
174            $display("PASS: Test case 10 ('bp') matches expected mask 0000000000000000");
175        end else begin
176            $display("FAIL: Test case 10 ('bp') expected 0000000000000000, got %b", match_bus);
177        end
178        end_of_str = 0; #10;
179
180        // Test case 11: "fly"
181        start = 1; #10 start = 0;
182        char_in = 8'h66; #10;
183        char_in = 8'h6c; #10;
184        char_in = 8'h79; #10;
185        end_of_str = 1; #10;
186        // Match output is valid on the cycle immediately following end_of_str assertion
187        if (match_bus === 16'b0000000000010000) begin
188            $display("PASS: Test case 11 ('fly') matches expected mask 0000000000010000");
189        end else begin
190            $display("FAIL: Test case 11 ('fly') expected 0000000000010000, got %b", match_bus);
191        end
192        end_of_str = 0; #10;
193
194        // Test case 12: "fy"
195        start = 1; #10 start = 0;
196        char_in = 8'h66; #10;
197        char_in = 8'h79; #10;
198        end_of_str = 1; #10;
199        // Match output is valid on the cycle immediately following end_of_str assertion
200        if (match_bus === 16'b0000000000010000) begin
201            $display("PASS: Test case 12 ('fy') matches expected mask 0000000000010000");
202        end else begin
203            $display("FAIL: Test case 12 ('fy') expected 0000000000010000, got %b", match_bus);
204        end
205        end_of_str = 0; #10;
206
207        // Test case 13: "apple"
208        start = 1; #10 start = 0;
209        char_in = 8'h61; #10;
210        char_in = 8'h70; #10;
211        char_in = 8'h70; #10;
212        char_in = 8'h6c; #10;
213        char_in = 8'h65; #10;
214        end_of_str = 1; #10;
215        // Match output is valid on the cycle immediately following end_of_str assertion
216        if (match_bus === 16'b0000000000100000) begin
217            $display("PASS: Test case 13 ('apple') matches expected mask 0000000000100000");
218        end else begin
219            $display("FAIL: Test case 13 ('apple') expected 0000000000100000, got %b", match_bus);
220        end
221        end_of_str = 0; #10;
222
223        // Test case 14: "orange"
224        start = 1; #10 start = 0;
225        char_in = 8'h6f; #10;
226        char_in = 8'h72; #10;
227        char_in = 8'h61; #10;
228        char_in = 8'h6e; #10;
229        char_in = 8'h67; #10;
230        char_in = 8'h65; #10;
231        end_of_str = 1; #10;
232        // Match output is valid on the cycle immediately following end_of_str assertion
233        if (match_bus === 16'b0000000000100000) begin
234            $display("PASS: Test case 14 ('orange') matches expected mask 0000000000100000");
235        end else begin
236            $display("FAIL: Test case 14 ('orange') expected 0000000000100000, got %b", match_bus);
237        end
238        end_of_str = 0; #10;
239
240        // Test case 15: "banana"
241        start = 1; #10 start = 0;
242        char_in = 8'h62; #10;
243        char_in = 8'h61; #10;
244        char_in = 8'h6e; #10;
245        char_in = 8'h61; #10;
246        char_in = 8'h6e; #10;
247        char_in = 8'h61; #10;
248        end_of_str = 1; #10;
249        // Match output is valid on the cycle immediately following end_of_str assertion
250        if (match_bus === 16'b0000000000000000) begin
251            $display("PASS: Test case 15 ('banana') matches expected mask 0000000000000000");
252        end else begin
253            $display("FAIL: Test case 15 ('banana') expected 0000000000000000, got %b", match_bus);
254        end
255        end_of_str = 0; #10;
256
257        // Test case 16: "redcar"
258        start = 1; #10 start = 0;
259        char_in = 8'h72; #10;
260        char_in = 8'h65; #10;
261        char_in = 8'h64; #10;
262        char_in = 8'h63; #10;
263        char_in = 8'h61; #10;
264        char_in = 8'h72; #10;
265        end_of_str = 1; #10;
266        // Match output is valid on the cycle immediately following end_of_str assertion
267        if (match_bus === 16'b0000000001000000) begin
268            $display("PASS: Test case 16 ('redcar') matches expected mask 0000000001000000");
269        end else begin
270            $display("FAIL: Test case 16 ('redcar') expected 0000000001000000, got %b", match_bus);
271        end
272        end_of_str = 0; #10;
273
274        // Test case 17: "bluecar"
275        start = 1; #10 start = 0;
276        char_in = 8'h62; #10;
277        char_in = 8'h6c; #10;
278        char_in = 8'h75; #10;
279        char_in = 8'h65; #10;
280        char_in = 8'h63; #10;
281        char_in = 8'h61; #10;
282        char_in = 8'h72; #10;
283        end_of_str = 1; #10;
284        // Match output is valid on the cycle immediately following end_of_str assertion
285        if (match_bus === 16'b0000000001000000) begin
286            $display("PASS: Test case 17 ('bluecar') matches expected mask 0000000001000000");
287        end else begin
288            $display("FAIL: Test case 17 ('bluecar') expected 0000000001000000, got %b", match_bus);
289        end
290        end_of_str = 0; #10;
291
292        // Test case 18: "greencar"
293        start = 1; #10 start = 0;
294        char_in = 8'h67; #10;
295        char_in = 8'h72; #10;
296        char_in = 8'h65; #10;
297        char_in = 8'h65; #10;
298        char_in = 8'h6e; #10;
299        char_in = 8'h63; #10;
300        char_in = 8'h61; #10;
301        char_in = 8'h72; #10;
302        end_of_str = 1; #10;
303        // Match output is valid on the cycle immediately following end_of_str assertion
304        if (match_bus === 16'b0000000000000000) begin
305            $display("PASS: Test case 18 ('greencar') matches expected mask 0000000000000000");
306        end else begin
307            $display("FAIL: Test case 18 ('greencar') expected 0000000000000000, got %b", match_bus);
308        end
309        end_of_str = 0; #10;
310
311        // Test case 19: "lolo"
312        start = 1; #10 start = 0;
313        char_in = 8'h6c; #10;
314        char_in = 8'h6f; #10;
315        char_in = 8'h6c; #10;
316        char_in = 8'h6f; #10;
317        end_of_str = 1; #10;
318        // Match output is valid on the cycle immediately following end_of_str assertion
319        if (match_bus === 16'b0000000010000000) begin
320            $display("PASS: Test case 19 ('lolo') matches expected mask 0000000010000000");
321        end else begin
322            $display("FAIL: Test case 19 ('lolo') expected 0000000010000000, got %b", match_bus);
323        end
324        end_of_str = 0; #10;
325
326        // Test case 20: "lololo"
327        start = 1; #10 start = 0;
328        char_in = 8'h6c; #10;
329        char_in = 8'h6f; #10;
330        char_in = 8'h6c; #10;
331        char_in = 8'h6f; #10;
332        char_in = 8'h6c; #10;
333        char_in = 8'h6f; #10;
334        end_of_str = 1; #10;
335        // Match output is valid on the cycle immediately following end_of_str assertion
336        if (match_bus === 16'b0000000010000000) begin
337            $display("PASS: Test case 20 ('lololo') matches expected mask 0000000010000000");
338        end else begin
339            $display("FAIL: Test case 20 ('lololo') expected 0000000010000000, got %b", match_bus);
340        end
341        end_of_str = 0; #10;
342
343        // Test case 21: "lo"
344        start = 1; #10 start = 0;
345        char_in = 8'h6c; #10;
346        char_in = 8'h6f; #10;
347        end_of_str = 1; #10;
348        // Match output is valid on the cycle immediately following end_of_str assertion
349        if (match_bus === 16'b0000000010000000) begin
350            $display("PASS: Test case 21 ('lo') matches expected mask 0000000010000000");
351        end else begin
352            $display("FAIL: Test case 21 ('lo') expected 0000000010000000, got %b", match_bus);
353        end
354        end_of_str = 0; #10;
355
356        // Test case 22: "good"
357        start = 1; #10 start = 0;
358        char_in = 8'h67; #10;
359        char_in = 8'h6f; #10;
360        char_in = 8'h6f; #10;
361        char_in = 8'h64; #10;
362        end_of_str = 1; #10;
363        // Match output is valid on the cycle immediately following end_of_str assertion
364        if (match_bus === 16'b0000000100000000) begin
365            $display("PASS: Test case 22 ('good') matches expected mask 0000000100000000");
366        end else begin
367            $display("FAIL: Test case 22 ('good') expected 0000000100000000, got %b", match_bus);
368        end
369        end_of_str = 0; #10;
370
371        // Test case 23: "goodod"
372        start = 1; #10 start = 0;
373        char_in = 8'h67; #10;
374        char_in = 8'h6f; #10;
375        char_in = 8'h6f; #10;
376        char_in = 8'h64; #10;
377        char_in = 8'h6f; #10;
378        char_in = 8'h64; #10;
379        end_of_str = 1; #10;
380        // Match output is valid on the cycle immediately following end_of_str assertion
381        if (match_bus === 16'b0000000100000000) begin
382            $display("PASS: Test case 23 ('goodod') matches expected mask 0000000100000000");
383        end else begin
384            $display("FAIL: Test case 23 ('goodod') expected 0000000100000000, got %b", match_bus);
385        end
386        end_of_str = 0; #10;
387
388        // Test case 24: "go"
389        start = 1; #10 start = 0;
390        char_in = 8'h67; #10;
391        char_in = 8'h6f; #10;
392        end_of_str = 1; #10;
393        // Match output is valid on the cycle immediately following end_of_str assertion
394        if (match_bus === 16'b0000000000000000) begin
395            $display("PASS: Test case 24 ('go') matches expected mask 0000000000000000");
396        end else begin
397            $display("FAIL: Test case 24 ('go') expected 0000000000000000, got %b", match_bus);
398        end
399        end_of_str = 0; #10;
400
401        // Test case 25: "hello"
402        start = 1; #10 start = 0;
403        char_in = 8'h68; #10;
404        char_in = 8'h65; #10;
405        char_in = 8'h6c; #10;
406        char_in = 8'h6c; #10;
407        char_in = 8'h6f; #10;
408        end_of_str = 1; #10;
409        // Match output is valid on the cycle immediately following end_of_str assertion
410        if (match_bus === 16'b0000001000000000) begin
411            $display("PASS: Test case 25 ('hello') matches expected mask 0000001000000000");
412        end else begin
413            $display("FAIL: Test case 25 ('hello') expected 0000001000000000, got %b", match_bus);
414        end
415        end_of_str = 0; #10;
416
417        // Test case 26: "llo"
418        start = 1; #10 start = 0;
419        char_in = 8'h6c; #10;
420        char_in = 8'h6c; #10;
421        char_in = 8'h6f; #10;
422        end_of_str = 1; #10;
423        // Match output is valid on the cycle immediately following end_of_str assertion
424        if (match_bus === 16'b0000001000000000) begin
425            $display("PASS: Test case 26 ('llo') matches expected mask 0000001000000000");
426        end else begin
427            $display("FAIL: Test case 26 ('llo') expected 0000001000000000, got %b", match_bus);
428        end
429        end_of_str = 0; #10;
430
431        // Test case 27: "he"
432        start = 1; #10 start = 0;
433        char_in = 8'h68; #10;
434        char_in = 8'h65; #10;
435        end_of_str = 1; #10;
436        // Match output is valid on the cycle immediately following end_of_str assertion
437        if (match_bus === 16'b0000000000000000) begin
438            $display("PASS: Test case 27 ('he') matches expected mask 0000000000000000");
439        end else begin
440            $display("FAIL: Test case 27 ('he') expected 0000000000000000, got %b", match_bus);
441        end
442        end_of_str = 0; #10;
443
444        // Test case 28: "ad"
445        start = 1; #10 start = 0;
446        char_in = 8'h61; #10;
447        char_in = 8'h64; #10;
448        end_of_str = 1; #10;
449        // Match output is valid on the cycle immediately following end_of_str assertion
450        if (match_bus === 16'b0100010000000000) begin
451            $display("PASS: Test case 28 ('ad') matches expected mask 0100010000000000");
452        end else begin
453            $display("FAIL: Test case 28 ('ad') expected 0100010000000000, got %b", match_bus);
454        end
455        end_of_str = 0; #10;
456
457        // Test case 29: "abd"
458        start = 1; #10 start = 0;
459        char_in = 8'h61; #10;
460        char_in = 8'h62; #10;
461        char_in = 8'h64; #10;
462        end_of_str = 1; #10;
463        // Match output is valid on the cycle immediately following end_of_str assertion
464        if (match_bus === 16'b0000010000000000) begin
465            $display("PASS: Test case 29 ('abd') matches expected mask 0000010000000000");
466        end else begin
467            $display("FAIL: Test case 29 ('abd') expected 0000010000000000, got %b", match_bus);
468        end
469        end_of_str = 0; #10;
470
471        // Test case 30: "acd"
472        start = 1; #10 start = 0;
473        char_in = 8'h61; #10;
474        char_in = 8'h63; #10;
475        char_in = 8'h64; #10;
476        end_of_str = 1; #10;
477        // Match output is valid on the cycle immediately following end_of_str assertion
478        if (match_bus === 16'b0000010000000000) begin
479            $display("PASS: Test case 30 ('acd') matches expected mask 0000010000000000");
480        end else begin
481            $display("FAIL: Test case 30 ('acd') expected 0000010000000000, got %b", match_bus);
482        end
483        end_of_str = 0; #10;
484
485        // Test case 31: "abcd"
486        start = 1; #10 start = 0;
487        char_in = 8'h61; #10;
488        char_in = 8'h62; #10;
489        char_in = 8'h63; #10;
490        char_in = 8'h64; #10;
491        end_of_str = 1; #10;
492        // Match output is valid on the cycle immediately following end_of_str assertion
493        if (match_bus === 16'b0000010000000000) begin
494            $display("PASS: Test case 31 ('abcd') matches expected mask 0000010000000000");
495        end else begin
496            $display("FAIL: Test case 31 ('abcd') expected 0000010000000000, got %b", match_bus);
497        end
498        end_of_str = 0; #10;
499
500        // Test case 32: "the end"
501        start = 1; #10 start = 0;
502        char_in = 8'h74; #10;
503        char_in = 8'h68; #10;
504        char_in = 8'h65; #10;
505        char_in = 8'h20; #10;
506        char_in = 8'h65; #10;
507        char_in = 8'h6e; #10;
508        char_in = 8'h64; #10;
509        end_of_str = 1; #10;
510        // Match output is valid on the cycle immediately following end_of_str assertion
511        if (match_bus === 16'b0001100000000000) begin
512            $display("PASS: Test case 32 ('the end') matches expected mask 0001100000000000");
513        end else begin
514            $display("FAIL: Test case 32 ('the end') expected 0001100000000000, got %b", match_bus);
515        end
516        end_of_str = 0; #10;
517
518        // Test case 33: "end"
519        start = 1; #10 start = 0;
520        char_in = 8'h65; #10;
521        char_in = 8'h6e; #10;
522        char_in = 8'h64; #10;
523        end_of_str = 1; #10;
524        // Match output is valid on the cycle immediately following end_of_str assertion
525        if (match_bus === 16'b0000100000000000) begin
526            $display("PASS: Test case 33 ('end') matches expected mask 0000100000000000");
527        end else begin
528            $display("FAIL: Test case 33 ('end') expected 0000100000000000, got %b", match_bus);
529        end
530        end_of_str = 0; #10;
531
532        // Test case 34: "xay"
533        start = 1; #10 start = 0;
534        char_in = 8'h78; #10;
535        char_in = 8'h61; #10;
536        char_in = 8'h79; #10;
537        end_of_str = 1; #10;
538        // Match output is valid on the cycle immediately following end_of_str assertion
539        if (match_bus === 16'b0010000000000000) begin
540            $display("PASS: Test case 34 ('xay') matches expected mask 0010000000000000");
541        end else begin
542            $display("FAIL: Test case 34 ('xay') expected 0010000000000000, got %b", match_bus);
543        end
544        end_of_str = 0; #10;
545
546        // Test case 35: "xayxby"
547        start = 1; #10 start = 0;
548        char_in = 8'h78; #10;
549        char_in = 8'h61; #10;
550        char_in = 8'h79; #10;
551        char_in = 8'h78; #10;
552        char_in = 8'h62; #10;
553        char_in = 8'h79; #10;
554        end_of_str = 1; #10;
555        // Match output is valid on the cycle immediately following end_of_str assertion
556        if (match_bus === 16'b0010000000000000) begin
557            $display("PASS: Test case 35 ('xayxby') matches expected mask 0010000000000000");
558        end else begin
559            $display("FAIL: Test case 35 ('xayxby') expected 0010000000000000, got %b", match_bus);
560        end
561        end_of_str = 0; #10;
562
563        // Test case 36: "xy"
564        start = 1; #10 start = 0;
565        char_in = 8'h78; #10;
566        char_in = 8'h79; #10;
567        end_of_str = 1; #10;
568        // Match output is valid on the cycle immediately following end_of_str assertion
569        if (match_bus === 16'b0000000000000000) begin
570            $display("PASS: Test case 36 ('xy') matches expected mask 0000000000000000");
571        end else begin
572            $display("FAIL: Test case 36 ('xy') expected 0000000000000000, got %b", match_bus);
573        end
574        end_of_str = 0; #10;
575
576        // Test case 37: "ac"
577        start = 1; #10 start = 0;
578        char_in = 8'h61; #10;
579        char_in = 8'h63; #10;
580        end_of_str = 1; #10;
581        // Match output is valid on the cycle immediately following end_of_str assertion
582        if (match_bus === 16'b0100000000000000) begin
583            $display("PASS: Test case 37 ('ac') matches expected mask 0100000000000000");
584        end else begin
585            $display("FAIL: Test case 37 ('ac') expected 0100000000000000, got %b", match_bus);
586        end
587        end_of_str = 0; #10;
588
589        // Test case 38: "bd"
590        start = 1; #10 start = 0;
591        char_in = 8'h62; #10;
592        char_in = 8'h64; #10;
593        end_of_str = 1; #10;
594        // Match output is valid on the cycle immediately following end_of_str assertion
595        if (match_bus === 16'b0100000000000000) begin
596            $display("PASS: Test case 38 ('bd') matches expected mask 0100000000000000");
597        end else begin
598            $display("FAIL: Test case 38 ('bd') expected 0100000000000000, got %b", match_bus);
599        end
600        end_of_str = 0; #10;
601
602        // Test case 39: "bc"
603        start = 1; #10 start = 0;
604        char_in = 8'h62; #10;
605        char_in = 8'h63; #10;
606        end_of_str = 1; #10;
607        // Match output is valid on the cycle immediately following end_of_str assertion
608        if (match_bus === 16'b0100000000000000) begin
609            $display("PASS: Test case 39 ('bc') matches expected mask 0100000000000000");
610        end else begin
611            $display("FAIL: Test case 39 ('bc') expected 0100000000000000, got %b", match_bus);
612        end
613        end_of_str = 0; #10;
614
615        // Test case 40: "1234"
616        start = 1; #10 start = 0;
617        char_in = 8'h31; #10;
618        char_in = 8'h32; #10;
619        char_in = 8'h33; #10;
620        char_in = 8'h34; #10;
621        end_of_str = 1; #10;
622        // Match output is valid on the cycle immediately following end_of_str assertion
623        if (match_bus === 16'b1000000000000000) begin
624            $display("PASS: Test case 40 ('1234') matches expected mask 1000000000000000");
625        end else begin
626            $display("FAIL: Test case 40 ('1234') expected 1000000000000000, got %b", match_bus);
627        end
628        end_of_str = 0; #10;
629
630        // Test case 41: "14"
631        start = 1; #10 start = 0;
632        char_in = 8'h31; #10;
633        char_in = 8'h34; #10;
634        end_of_str = 1; #10;
635        // Match output is valid on the cycle immediately following end_of_str assertion
636        if (match_bus === 16'b1000000000000000) begin
637            $display("PASS: Test case 41 ('14') matches expected mask 1000000000000000");
638        end else begin
639            $display("FAIL: Test case 41 ('14') expected 1000000000000000, got %b", match_bus);
640        end
641        end_of_str = 0; #10;
642
643        // Test case 42: "124"
644        start = 1; #10 start = 0;
645        char_in = 8'h31; #10;
646        char_in = 8'h32; #10;
647        char_in = 8'h34; #10;
648        end_of_str = 1; #10;
649        // Match output is valid on the cycle immediately following end_of_str assertion
650        if (match_bus === 16'b0000000000000000) begin
651            $display("PASS: Test case 42 ('124') matches expected mask 0000000000000000");
652        end else begin
653            $display("FAIL: Test case 42 ('124') expected 0000000000000000, got %b", match_bus);
654        end
655        end_of_str = 0; #10;
656
657        $display("All tests completed.");
658        #100; $finish;
659    end
660endmodule