summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2017-01-08 14:31:29 -0600
committerBobby Bingham <koorogi@koorogi.info>2017-01-08 22:02:28 -0600
commit06089575a8624e6080094a02758dbf724b2fe819 (patch)
tree255815bdc0d3c92e25d792cb9d3658d806a0ea29
parentf8d09347a43ddab462d94f716e0a6f249e2e6635 (diff)
Define macro to simplify dumping of waves
-rw-r--r--alu_tb.v3
-rw-r--r--regFile_tb.v4
-rw-r--r--shifter_tb.v4
-rw-r--r--testbench.vh6
4 files changed, 11 insertions, 6 deletions
diff --git a/alu_tb.v b/alu_tb.v
index 8342e6c..7418ea3 100644
--- a/alu_tb.v
+++ b/alu_tb.v
@@ -16,8 +16,7 @@ module alu_tb ();
integer file, r;
initial begin
- $dumpfile("alu_tb.vcd");
- $dumpvars(0, alu_tb);
+ `DUMPWAVE(alu_tb)
file = $fopenr("tests/alu");
diff --git a/regFile_tb.v b/regFile_tb.v
index 0df3e48..d0da481 100644
--- a/regFile_tb.v
+++ b/regFile_tb.v
@@ -1,3 +1,4 @@
+`include "testbench.vh"
`timescale 1 ns / 100 ps
module regFile_tb ();
@@ -12,8 +13,7 @@ module regFile_tb ();
wire [15:0] dataB;
initial begin
- $dumpfile("regFile_tb.vcd");
- $dumpvars(0, regFile_tb);
+ `DUMPWAVE(regFile_tb)
clk = 1'b0;
diff --git a/shifter_tb.v b/shifter_tb.v
index f586d02..5e25028 100644
--- a/shifter_tb.v
+++ b/shifter_tb.v
@@ -1,3 +1,4 @@
+`include "testbench.vh"
`timescale 1 ns / 100 ps
module shifter_tb ();
@@ -11,8 +12,7 @@ module shifter_tb ();
// xxxxxxxxxxxxxxxx1111101000001010xxxxxxxxxxxxxxxx
initial begin
- $dumpfile("shifter_tb.vcd");
- $dumpvars(0, shifter_tb);
+ `DUMPWAVE(shifter_tb)
v = 16'hFA0A;
by = 16'h0;
diff --git a/testbench.vh b/testbench.vh
index 9838164..c60f66d 100644
--- a/testbench.vh
+++ b/testbench.vh
@@ -4,6 +4,12 @@
`define MAX_LINE_LENGTH 128
`define EOF 32'hFFFF_FFFF
+`define STRINGIFY(x) `"x`"
+
+`define DUMPWAVE(m) \
+ $dumpfile({`STRINGIFY(m), ".vcd"}); \
+ $dumpvars(0, m);
+
task skip_comments(input integer file);
integer c, r, quit;
reg [8*`MAX_LINE_LENGTH:0] line;