summaryrefslogtreecommitdiff
path: root/testbench.vh
blob: 565daaa8a173bcc42702446595819e91df292f54 (plain)
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
`ifndef TESTBENCH_VH
`define TESTBENCH_VH

`define MAX_LINE_LENGTH 128
`define EOF 32'hFFFF_FFFF

`define STRINGIFY(x) `"x`"

`define DUMPWAVE(m) \
	$dumpfile({"waves/", `STRINGIFY(m), ".vcd"}); \
	$dumpvars(0, m);

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