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