From 543b4590cb83ec74df7785ebc880c603fbe8451e Mon Sep 17 00:00:00 2001 From: Zachary Snow Date: Sun, 1 Aug 2021 16:38:41 -0600 Subject: [PATCH] streamline iverilog test wrapper --- test/core/package_scope.v | 3 +++ test/core/paramtype.v | 3 +++ test/core/struct_part_select.sv | 1 + test/core/struct_part_select.v | 1 + test/lib/functions.sh | 15 +++++---------- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/test/core/package_scope.v b/test/core/package_scope.v index 528f57c..49f7758 100644 --- a/test/core/package_scope.v +++ b/test/core/package_scope.v @@ -1,4 +1,7 @@ module top; +endmodule + +module dump; initial begin $display("A 3"); $display("B 3"); diff --git a/test/core/paramtype.v b/test/core/paramtype.v index 091ca2e..beee2f2 100644 --- a/test/core/paramtype.v +++ b/test/core/paramtype.v @@ -1,4 +1,7 @@ module top; +endmodule + +module dump; initial begin // generated by running a commercial simulator $display("m_def 0 00000000000000000000000000000001 1"); diff --git a/test/core/struct_part_select.sv b/test/core/struct_part_select.sv index 5386340..21e99c8 100644 --- a/test/core/struct_part_select.sv +++ b/test/core/struct_part_select.sv @@ -83,4 +83,5 @@ module Example; end endmodule module top; + Example e(); endmodule diff --git a/test/core/struct_part_select.v b/test/core/struct_part_select.v index 4455488..3bbb8ed 100644 --- a/test/core/struct_part_select.v +++ b/test/core/struct_part_select.v @@ -60,4 +60,5 @@ module Example; end endmodule module top; + Example e(); endmodule diff --git a/test/lib/functions.sh b/test/lib/functions.sh index 78820b5..b513e6e 100644 --- a/test/lib/functions.sh +++ b/test/lib/functions.sh @@ -17,6 +17,7 @@ simulate() { sim_top=$3 shift 3 # compile the files + sim_vcd_tmp=$SHUNIT_TMPDIR/simvcdtmp sim_prog=$SHUNIT_TMPDIR/simprog.exe iv_output=`iverilog \ -Wall \ @@ -24,23 +25,17 @@ simulate() { -Wno-portbind \ -o $sim_prog \ -g2005 \ - -DTEST_VCD="\"$sim_vcd\"" \ + -DTEST_VCD="\"$sim_vcd_tmp\"" \ -DTEST_TOP=$sim_top \ $SCRIPT_DIR/tb_dumper.v \ "$@" 2>&1` assertTrue "iverilog on $1 failed" $? - if [ -n "$iv_output" ]; then - assertNull "iverilog emitted warnings:" "$iv_output" - echo "$iv_output" - fi + assertNull "iverilog emitted warnings:\n$iv_output" "$iv_output" # run the simulation - $sim_prog > $sim_log.temp + $sim_prog > $sim_log assertTrue "simulating $1 failed" $? - assertExists $sim_vcd # remove the date from the VCD - sed -i.orig -e "1,3d" $sim_vcd - # remove extraneous log lines - cat $sim_log.temp | grep -v "VCD info: dumpfile" > $sim_log + sed -e "1,3d" < $sim_vcd_tmp > $sim_vcd } assertConverts() {