From 42e5e92d43777eb7bb632820e6aba2fbea42d665 Mon Sep 17 00:00:00 2001 From: Edmond Cote Date: Tue, 9 Jan 2018 09:54:34 -0800 Subject: [PATCH 1/2] Update TestDriver module to support FSDB Add support for FSDB waveform dumping using existing API. Feature is enabled using +define+FSDB. Change has not been fully regressed (i.e., please don't pull blindly). Impact on existing knobs is minimal, should not affect existing functionality. Automated Travis builds should be sufficient to assess. Alternatively could using +define+VCS. Chose to introduce new define because multiple simulators support FSDB dumping. --- vsrc/TestDriver.v | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/vsrc/TestDriver.v b/vsrc/TestDriver.v index 0984f151..a5d4f6cc 100644 --- a/vsrc/TestDriver.v +++ b/vsrc/TestDriver.v @@ -18,6 +18,7 @@ module TestDriver; reg [63:0] max_cycles = 0; reg [63:0] dump_start = 0; reg [63:0] trace_count = 0; + reg [1023:0] fsdbfile = 0; reg [1023:0] vcdplusfile = 0; reg [1023:0] vcdfile = 0; int unsigned rand_value; @@ -55,12 +56,28 @@ module TestDriver; `endif end + if ($value$plusargs("fsdbfile=%s", fsdbfile)) + begin +`ifdef FSDB + $fsdbDumpfile(fsdbfile); + $fsdbDumpvars("+all"); + //$fsdbDumpSVA; +`else + $fdisplay(stderr, "Error: +fsdbfile is FSDB-only; use +vcdfile or +vcdplus instead"); + $fatal; +`endif + end + if ($value$plusargs("vcdfile=%s", vcdfile)) begin $dumpfile(vcdfile); $dumpvars(0, testHarness); end -`ifdef VCS + +`ifdef FSDB +`define VCDPLUSON $fsdbDumpon; +`define VCDPLUSCLOSE $fsdbDumpoff; +`elsif VCS `define VCDPLUSON $vcdpluson(0); $vcdplusmemon(0); `define VCDPLUSCLOSE $vcdplusclose; $dumpoff; `else @@ -72,9 +89,9 @@ module TestDriver; `define VCDPLUSON `define VCDPLUSCLOSE - if ($test$plusargs("vcdplusfile=") || $test$plusargs("vcdfile=")) + if ($test$plusargs("vcdplusfile=") || $test$plusargs("vcdfile=") || $test$plusargs("fsdbfile=")) begin - $fdisplay(stderr, "Error: +vcdfile or +vcdplusfile requested but compile did not have +define+DEBUG enabled"); + $fdisplay(stderr, "Error: +vcdfile, +vcdplusfile, or +fsdbfile requested but compile did not have +define+DEBUG enabled"); $fatal; end From 904f0f3d936c6cdab6c0a038e999bac20cc7411a Mon Sep 17 00:00:00 2001 From: Edmond Cote Date: Sat, 13 Jan 2018 13:35:52 -0800 Subject: [PATCH 2/2] enhance error message when debug enabled This commit enhances the error message when the user enables waveform dump at runtime but forgets to enable the compile time define. --- vsrc/TestDriver.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsrc/TestDriver.v b/vsrc/TestDriver.v index a5d4f6cc..6d31c0c5 100644 --- a/vsrc/TestDriver.v +++ b/vsrc/TestDriver.v @@ -51,7 +51,7 @@ module TestDriver; `ifdef VCS $vcdplusfile(vcdplusfile); `else - $fdisplay(stderr, "Error: +vcdplusfile is VCS-only; use +vcdfile instead"); + $fdisplay(stderr, "Error: +vcdplusfile is VCS-only; use +vcdfile instead or recompile with VCS=1"); $fatal; `endif end @@ -63,7 +63,7 @@ module TestDriver; $fsdbDumpvars("+all"); //$fsdbDumpSVA; `else - $fdisplay(stderr, "Error: +fsdbfile is FSDB-only; use +vcdfile or +vcdplus instead"); + $fdisplay(stderr, "Error: +fsdbfile is FSDB-only; use +vcdfile/+vcdplus instead or recompile with FSDB=1"); $fatal; `endif end