From 42e5e92d43777eb7bb632820e6aba2fbea42d665 Mon Sep 17 00:00:00 2001 From: Edmond Cote Date: Tue, 9 Jan 2018 09:54:34 -0800 Subject: [PATCH] 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