Dump VCD waveform in irun/ncsim

VCD Waveform


Below are the two ways to dump waveform in VCD (Value Change Dump) format.

  • Using system tasks
  • Using TCL File


Using system tasks


$dumpfile("filename");
$dumpvars();


 Example-1: 

initial begin //{
 $dumpfile("waves.vcd");
 $dumpvars();
end //}

 Example-2: 

initial begin //{
 $dumpfile("waves.vcd");
 $dumpvars(1,top);  //Dumps all variables within top, doesnt dump variables from modules instantiated inside top
end //}

 Example-3: 

initial begin //{
 $dumpfile("waves.vcd");
 $dumpvars(0,top);  //Dumps all variables in top and also from modules instantiated inside top 
end //}

Command to run:
irun -sv +access+rwc top.sv




Using TCL File


database -open -vcd <database name> -into <filename> -default
probe -create -vcd <scope_name> -all

 Example: 

database -open -vcd vcd_db -into waves.vcd -default
probe -create -vcd top -all
run
exit

Place above code in run.tcl file.

Command to run:
irun -sv +access+rwc -input run.tcl top.sv




Delay the VCD dump


In few situations its required to enable the wave dump only after some time.

For example,

  • Enabling the dump will cause slowness of simulation time so it might not be required to enable initialization dump
  • if the dump size going to be more, user need to enable waveform dump only after some time 

This can be achieved by mentioning delay in run.tcl file

 Example: 

database -open -vcd vcd_db -into waves.vcd -default
run 1000ns
probe -create -vcd top -all
run
exit

In above example, "run 1000ns" will enables wave dump only after  1000ns



Related Article: