From f8d09347a43ddab462d94f716e0a6f249e2e6635 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Sun, 8 Jan 2017 15:09:38 -0600 Subject: Move ALU test cases to external testcase file This makes is a little easier to create new ALU testcases and to quickly read and understand the existing testcases. Additionally, the test bench itself can now report when a test fails, rather than requiring inspection on the waveform (though the waveform is still available). --- testbench.vh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 testbench.vh (limited to 'testbench.vh') diff --git a/testbench.vh b/testbench.vh new file mode 100644 index 0000000..9838164 --- /dev/null +++ b/testbench.vh @@ -0,0 +1,27 @@ +`ifndef TESTBENCH_VH +`define TESTBENCH_VH + +`define MAX_LINE_LENGTH 128 +`define EOF 32'hFFFF_FFFF + +task skip_comments(input integer file); + integer c, r, quit; + reg [8*`MAX_LINE_LENGTH:0] line; + + quit = 0; + while (quit == 0) begin + c = $fgetc(file); + if (c == `EOF) begin + quit = 1; + end else if (c == "#") begin + r = $fgets(line, file); + end else if (c != "\n") begin + r = $ungetc(c, file); + quit = 1; + end + end +endtask + +`endif + +// vim: syntax=verilog -- cgit v1.2.3