Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • Start Here6
  • SystemVerilog Language Foundations28
  • Object-Oriented SystemVerilog for Verification30
  • Constraint Randomization — Interview-Critical Deep Dive36
  • SystemVerilog Assertions — Interview-Critical Deep Dive40
  • Functional Coverage in SystemVerilog22
  • Testbench Architecture in SystemVerilog23
  • Advanced Language & Integration25
    • DPI-C: Calling C from SystemVerilog
    • bind: Attaching Verification to RTL
    • Macros, Defines & Compilation
    • Plusargs, Files & Runtime Configuration
      • $test$plusargs & $value$plusargs
      • File I/O
      • Config Architecture: Files vs Plusargs vs Objects
      • Wave Dumping & Runtime Control
    • Simulation Performance & TB Memory
    • RTL/TB Boundaries, Races & Timing
  • Senior & Interview Preparation21
  • Principal-Level Verification28
Loading lesson

‹Plusargs, Files & Runtime Configuration
  1. Topics
  2. SystemVerilog
  3. Advanced Language & Integration
  4. Plusargs, Files & Runtime Configuration
  5. Wave Dumping & Runtime Control

Part 7 · Advanced & Integration · Intermediate

Wave Dumping & Runtime Control

Dump scope and windows, finishing vs stopping vs fatal exits and verbosity knobs.

On this page

    Dump only what you need

    $dumpfile names the VCD output, and $dumpvars with a depth and a scope selects how much hierarchy to record. Depth 0 records the scope and everything below it, while depth 1 records only the scope's own signals.

    Dump scope is the largest lever on run time and disk use. Full-design dumps slow runs and flood disks, so regressions run dump-free and reruns record a window instead.

    Call

    Records

    $dumpvars(0, tb_top)

    The scope and everything below, the expensive default

    $dumpvars(0, tb_top.dut.u_dma)

    One suspect subtree only

    $dumpvars(1, tb_top.dut)

    The scope signals without the children

    Commercial flows record FSDB or vendor equivalents instead of VCD. The scoping ideas match, and the compression is far better, through tool-specific tasks.

    A window around the failure

    $dumpoff and $dumpon gate recording at run time. The window edges below come from plusargs, so a failing seed reruns with waves only around the failure.

    The listing names DUT hierarchy, so it is not run in this course's checks. $test$plusargs matches prefixes, so the window knobs are named +WIN_START and +WIN_STOP: WAVES is not a prefix of either, and only +WAVES turns dumping on.

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    // not-run: needs a testbench harness with a matching DUT hierarchy
    `timescale 1ns/1ps
    time dump_start = 0;
    time dump_stop = 0;   // 0 means run to the end
    
    initial begin
      if ($test$plusargs("WAVES")) begin
        void'($value$plusargs("WIN_START=%d", dump_start));
        void'($value$plusargs("WIN_STOP=%d", dump_stop));
        $dumpfile("waves.vcd");
        $dumpvars(0, tb_top.dut);
        if (dump_start > 0) begin
          $dumpoff;                       // armed but not recording
          #(dump_start) $dumpon;          // open the window
        end
        if (dump_stop > dump_start)
          #(dump_stop - dump_start) $dumpoff;   // close it
      end
    end
    
    // Clean run:        simv +TESTNAME=stress
    // Rerun the fault:  simv +TESTNAME=stress +WAVES +WIN_START=9000000 +WIN_STOP=9400000

    The bottom rows show the window, the fault and an 8-bit counter. The fault lands inside the open window.

    • Slot 0: win is 0 and data reads 10, before the window.

    • Slot 1: data reads 11, still outside the window.

    • Slot 2: win rises and data reads 12, so recording starts.

    • Slot 3: win stays high and data reads 13.

    • Slot 4: fault pulses and data reads ee, the signature inside the window.

    • Slot 5: win falls and data reads 14, so recording stops.

    Diagram
    DUMP WINDOW STRATEGY
    
      full dump        ██████████████████████████████  large file, slow run
                       0ms                        10ms
    
      windowed dump    ░░░░░░░░░░░░░░░░░░░░░░░░██░░░  small file, fast run
                                              ▲  ▲
                                      window open   failure inside
                                      before fault  window closes after
    
      regression default: no +WAVES, so zero wave cost
      failure rerun:      +WAVES with a window around the failing time

    End the run and tune the noise

    Three calls end a run three ways. $finish terminates normally and runs final checks, $stop pauses into the debugger, and $fatal terminates with an error status for scripts.

    Call

    Meaning

    Regression rule

    $finish

    Normal termination

    Every passing or cleanly failing test ends here

    $stop

    Pause for interaction

    Never in batch code, since the job hangs at a prompt

    $fatal(status, msg)

    Error termination with a status

    Check the tool mapping from status to exit code, and grep logs as a backstop

    Verbosity is one more run-time knob. A log helper compares each message level against it, so rerunning louder never recompiles.

    Every testbench also carries a timeout guard. The guard below has a time unit, so it is a plain illustration rather than a checked block.

    design.sv
    1
    2
    3
    4
    5
    6
    // snippet
    `timescale 1ns/1ps
    initial begin
      #50ms;
      $fatal(1, "TIMEOUT: test did not complete");
    end

    The testbench below proves the verbosity filter: with the default of 1, two of three messages show.

    design.sv
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    module tb_verbosity;
      integer verbosity = 1;   // 0 shows errors only, 1 is normal, 2 is debug
      integer shown = 0;
      integer errors = 0;
      integer matched;
    
      task automatic log_msg(input integer level);
        if (level <= verbosity) shown = shown + 1;
      endtask
    
      initial begin
        matched = $value$plusargs("VERBOSITY=%d", verbosity);
        if (matched != 0) errors++;   // no plusargs in this run, so 0 is expected
        log_msg(0);
        log_msg(1);
        log_msg(2);
        if (shown != 2) errors++;     // levels 0 and 1 pass the default filter
    
        if (errors == 0) $display("PASS: verbosity 1 showed 2 of 3 messages");
        else $fatal(1, "FAIL: %0d verbosity checks did not hold", errors);
        $finish;
      end
    endmodule

    Common mistakes

    Common pitfall

    Dumping the whole design by default costs gigabytes and doubles run time. Keep regressions dump-free, gate windows on a non-prefix knob, and never leave $stop where batch jobs can reach it.

    Interview

    Likely questions: $finish against $stop against $fatal, how to cut wave overhead in regression, and the debug loop for a failing seed. The expected loop reruns the seed with +WAVES and a window around the failure time, at higher verbosity, without recompiling.

    Check yourself A batch job hangs forever at the point of failure. Which call is the likely cause, and what replaces it?

    $stop is the cause: it waits at an interactive prompt. Batch code uses $fatal with a message and a status instead, so the run ends and the script sees it.

    Check yourself The suite passes but one test never calls $finish. How does the run end?

    At the timeout guard, which reports red. Every path out of a test ends at $finish or $fatal.

    Check yourself Why must verbosity come from a plusarg rather than a parameter?

    Verbosity changes per rerun, and a parameter change recompiles. A plusarg tunes the same image in seconds.

    Related topics

    • Regression flow

    • Performance and memory

    Previous

    202 / 259

    Next: Simulation Performance & TB Memory

    Up next

    Up nextSimulation Performance & TB Memory

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • $test$plusargs & $value$plusargs
    • File I/O
    clkwinfaultdata10111213ee14
    A recording window opening before a fault pulse and closing after it