From 50722494b919c7244fe71c742e04ac3d4ac22f83 Mon Sep 17 00:00:00 2001 From: Stephen Williams Date: Sun, 26 Feb 2023 14:43:01 -0800 Subject: [PATCH] ivtest: Add the dumpfile.v test Add a regression test to show that the proper dumpfile is selected, by noting in the output from the vvp command what file name it is creating. To make this work, I also needed to add some capabilities to the vvp_reg.py regression test rig. --- Documentation/developer/regression_tests.rst | 14 ++++++++++++++ ivtest/gold/dumpfile-iverilog-stderr.gold | 0 ivtest/gold/dumpfile-iverilog-stdout.gold | 0 ivtest/gold/dumpfile-vvp-stderr.gold | 0 ivtest/gold/dumpfile-vvp-stdout.gold | 2 ++ ivtest/ivltests/dumpfile.v | 15 +++++++++++++++ ivtest/regress-vvp.list | 1 + ivtest/run_ivl.py | 9 +++++++-- ivtest/vvp_reg.py | 4 +++- ivtest/vvp_tests/dumpfile.json | 6 ++++++ 10 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 ivtest/gold/dumpfile-iverilog-stderr.gold create mode 100644 ivtest/gold/dumpfile-iverilog-stdout.gold create mode 100644 ivtest/gold/dumpfile-vvp-stderr.gold create mode 100644 ivtest/gold/dumpfile-vvp-stdout.gold create mode 100644 ivtest/ivltests/dumpfile.v create mode 100644 ivtest/vvp_tests/dumpfile.json diff --git a/Documentation/developer/regression_tests.rst b/Documentation/developer/regression_tests.rst index 8f8eec7db..4f833c38f 100644 --- a/Documentation/developer/regression_tests.rst +++ b/Documentation/developer/regression_tests.rst @@ -77,3 +77,17 @@ iverilog-args (optional) If this is specified, it is a list of strings that are passed as arguments to the iverilog command line. + +vvp-args (optional) +^^^^^^^^^^^^^^^^^^^^ + +If this is specified, it is a list of strings that are passed as arguments to +the vvp command. These arguments go before the vvp input file that is to be +run. + +vvp-args-extended (optional) +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +If this is specified, it is a lost of strings that are passed as arguments to +the vvp command. These are extended arguments, and are placed after the vvp +input file that is being run. This is where you place things like plusargs. diff --git a/ivtest/gold/dumpfile-iverilog-stderr.gold b/ivtest/gold/dumpfile-iverilog-stderr.gold new file mode 100644 index 000000000..e69de29bb diff --git a/ivtest/gold/dumpfile-iverilog-stdout.gold b/ivtest/gold/dumpfile-iverilog-stdout.gold new file mode 100644 index 000000000..e69de29bb diff --git a/ivtest/gold/dumpfile-vvp-stderr.gold b/ivtest/gold/dumpfile-vvp-stderr.gold new file mode 100644 index 000000000..e69de29bb diff --git a/ivtest/gold/dumpfile-vvp-stdout.gold b/ivtest/gold/dumpfile-vvp-stdout.gold new file mode 100644 index 000000000..86219d705 --- /dev/null +++ b/ivtest/gold/dumpfile-vvp-stdout.gold @@ -0,0 +1,2 @@ +VCD info: dumpfile foo.vcd opened for output. +ivltests/dumpfile.v:11: $finish called at 30 (1s) diff --git a/ivtest/ivltests/dumpfile.v b/ivtest/ivltests/dumpfile.v new file mode 100644 index 000000000..de6284219 --- /dev/null +++ b/ivtest/ivltests/dumpfile.v @@ -0,0 +1,15 @@ +// Github Issue #202 + +module main; + reg clk = 0; + + initial begin + //$dumpfile("foo"); // We really want to test the command line flag + $dumpvars(0, main); + #10 clk <= 1; + #10 clk <= 0; + #10 $finish; + + end + +endmodule // main diff --git a/ivtest/regress-vvp.list b/ivtest/regress-vvp.list index eb22d756a..71ec08878 100644 --- a/ivtest/regress-vvp.list +++ b/ivtest/regress-vvp.list @@ -20,6 +20,7 @@ dffsynth8 vvp_tests/dffsynth8.json dffsynth9 vvp_tests/dffsynth9.json dffsynth10 vvp_tests/dffsynth10.json dffsynth11 vvp_tests/dffsynth11.json +dumpfile vvp_tests/dumpfile.json macro_str_esc vvp_tests/macro_str_esc.json memsynth1 vvp_tests/memsynth1.json struct_packed_write_read vvp_tests/struct_packed_write_read.json diff --git a/ivtest/run_ivl.py b/ivtest/run_ivl.py index 6e5821bc4..06e2c0b93 100644 --- a/ivtest/run_ivl.py +++ b/ivtest/run_ivl.py @@ -18,7 +18,10 @@ def assemble_iverilog_cmd(source: str, it_dir: str, args: list) -> list: def assemble_vvp_cmd(args: list = [], plusargs: list = []) -> list: - res = ["vvp", os.path.join("work", "a.out")] + res = ["vvp"] + res = res + args + res.append(os.path.join("work", "a.out")) + res = res + plusargs return res @@ -130,6 +133,8 @@ def do_run_normal(options : dict, expected_fail : bool) -> list: it_key = options['key'] it_dir = options['directory'] it_iverilog_args = options['iverilog_args'] + it_vvp_args = options['vvp_args'] + it_vvp_args_extended = options['vvp_args_extended'] it_gold = options['gold'] it_diff = options['diff'] @@ -144,7 +149,7 @@ def do_run_normal(options : dict, expected_fail : bool) -> list: return [1, "Failed - Compile failed"] # run the vvp command - vvp_cmd = assemble_vvp_cmd() + vvp_cmd = assemble_vvp_cmd(it_vvp_args, it_vvp_args_extended) vvp_res = subprocess.run(vvp_cmd, capture_output=True) log_results(it_key, "vvp", vvp_res); diff --git a/ivtest/vvp_reg.py b/ivtest/vvp_reg.py index a8f47d365..91243edec 100755 --- a/ivtest/vvp_reg.py +++ b/ivtest/vvp_reg.py @@ -45,7 +45,9 @@ def process_test(item: list) -> str: 'source' : it_dict['source'], 'modulename' : None, 'gold' : it_dict.get('gold', None), - 'diff' : None + 'diff' : None, + 'vvp_args' : it_dict.get('vvp-args', [ ]), + 'vvp_args_extended' : it_dict.get('vvp-args-extended', [ ]) } if it_type == "NI": diff --git a/ivtest/vvp_tests/dumpfile.json b/ivtest/vvp_tests/dumpfile.json new file mode 100644 index 000000000..26952c828 --- /dev/null +++ b/ivtest/vvp_tests/dumpfile.json @@ -0,0 +1,6 @@ +{ + "type" : "normal", + "source" : "dumpfile.v", + "gold" : "dumpfile", + "vvp-args-extended" : [ "-vcd", "-dumpfile=foo" ] +}