Skip to content

Commit 80dc471

Browse files
committed
Add support for generating VCD files from testbenches
Add generation of Value Change Dump (VCD) files from the testbenches. This allow the use of waveform viewers to look at registers, signals etc during simulation. The patch also adds the ability to remove vcd file when doing 'make clean'. Signed-off-by: Joachim Strömbergson <joachim@assured.se>
1 parent 9851b9d commit 80dc471

File tree

6 files changed

+34
-5
lines changed

6 files changed

+34
-5
lines changed

src/tb/tb_aes.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ module tb_aes();
549549
$display(" ==============================");
550550
$display("");
551551

552+
$display("Dumping all variables to tb_aes vcd file.");
553+
$dumpfile("tb_aes.vcd");
554+
$dumpvars(0, tb_aes);
555+
552556
init_sim();
553557
dump_dut_state();
554558
reset_dut();
@@ -559,7 +563,9 @@ module tb_aes();
559563
display_test_results();
560564

561565
$display("");
562-
$display("*** AES simulation done. ***");
566+
$display(" -= Testbench for AES completed =-");
567+
$display(" ===============================");
568+
$display("");
563569
$finish;
564570
end // main
565571
endmodule // tb_aes

src/tb/tb_aes_core.v

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ module tb_aes_core();
404404
$display(" ================================");
405405
$display("");
406406

407+
$display("tb: Dumping all variables to tb_aes_core vcd file.");
408+
$dumpfile("tb_aes_core.vcd");
409+
$dumpvars(0, tb_aes_core);
410+
407411
init_sim();
408412
dump_dut_state();
409413
reset_dut();
@@ -482,7 +486,10 @@ module tb_aes_core();
482486

483487
display_test_result();
484488
$display("");
485-
$display("*** AES core simulation done. ***");
489+
490+
$display(" -= Testbench for aes core cmpleted =-");
491+
$display(" =================================");
492+
$display("");
486493
$finish;
487494
end // aes_core_test
488495
endmodule // tb_aes_core

src/tb/tb_aes_decipher_block.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ module tb_aes_decipher_block();
340340
$display(" ============================================");
341341
$display("");
342342

343+
$display("Dumping all variables to tb_aes_decipher_block vcd file.");
344+
$dumpfile("tb_aes_decipher_block.vcd");
345+
$dumpvars(0, tb_aes_decipher_block);
346+
343347
init_sim();
344348
dump_dut_state();
345349
reset_dut();
@@ -394,7 +398,9 @@ module tb_aes_decipher_block();
394398

395399
display_test_result();
396400
$display("");
397-
$display("*** AES decipher block module simulation done. ***");
401+
$display(" -= Testbench for aes decipher block completed =-");
402+
$display(" ============================================");
403+
$display("");
398404
$finish;
399405
end // aes_core_test
400406
endmodule // tb_aes_decipher_block

src/tb/tb_aes_encipher_block.v

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,10 @@ module tb_aes_encipher_block();
534534
$display(" ============================================");
535535
$display("");
536536

537+
$display("Dumping all variables to tb_aes_encipher_block vcd file.");
538+
$dumpfile("tb_aes_encipher_block.vcd");
539+
$dumpvars(0, tb_aes_encipher_block);
540+
537541
init_sim();
538542
reset_dut();
539543

src/tb/tb_aes_key_mem.v

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,10 @@ module tb_aes_key_mem();
428428
$display(" =====================================");
429429
$display("");
430430

431+
$display("Dumping all variables to tb_aes_key_mem vcd file.");
432+
$dumpfile("tb_aes_key_mem.vcd");
433+
$dumpvars(0, tb_aes_key_mem);
434+
431435
init_sim();
432436
dump_dut_state();
433437
reset_dut();
@@ -639,8 +643,10 @@ module tb_aes_key_mem();
639643

640644

641645
display_test_result();
646+
642647
$display("");
643-
$display("*** AES core simulation done. ***");
648+
$display(" -= Testbench for aes key mem completed =-");
649+
$display(" =======================================");
644650
$finish;
645651
end // aes_key_mem_test
646652
endmodule // tb_aes_key_mem

toolruns/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ clean:
109109
rm -f keymem.sim
110110
rm -f core.sim
111111
rm -f top.sim
112-
112+
rm -f *.vcd
113113

114114
help:
115115
@echo "Build system for simulation of AES Verilog core"

0 commit comments

Comments
 (0)