diff --git a/test/lib/functions.sh b/test/lib/functions.sh index 0322e5e..5e315d0 100644 --- a/test/lib/functions.sh +++ b/test/lib/functions.sh @@ -3,13 +3,12 @@ SCRIPT_DIR=`dirname "${BASH_SOURCE[0]}"` SV2V="$SCRIPT_DIR/../../bin/sv2v +RTS -N1 -RTS" -# USAGE: simulate [ ...] +# USAGE: simulate [ ...] simulate() { # arguments sim_vcd=$1 sim_log=$2 - sim_top=$3 - shift 3 + shift 2 # compile the files sim_vcd_tmp=$SHUNIT_TMPDIR/simvcdtmp sim_prog=$SHUNIT_TMPDIR/simprog.exe @@ -19,8 +18,7 @@ simulate() { -o $sim_prog \ -g2005 \ -gstrict-expr-width \ - -DTEST_VCD="\"$sim_vcd_tmp\"" \ - -DTEST_TOP=$sim_top \ + -DTEST_VCD=\"$sim_vcd_tmp\" \ "$@" \ $SCRIPT_DIR/tb_dumper.v \ 2>&1` @@ -33,10 +31,14 @@ simulate() { assertNotNull "iverilog on $1 did not emit any warnings" "$iv_output" fi # run the simulation - $sim_prog > $sim_log + $sim_prog -no-date > $sim_log assertTrue "simulating $1 failed" $? - # remove the date from the VCD - sed -e "1,3d" < $sim_vcd_tmp | $SCRIPT_DIR/clean_vcd.py > $sim_vcd + # remove parameters from the VCD if present + if grep "var parameter" $sim_vcd_tmp > /dev/null; then + $SCRIPT_DIR/clean_vcd.py < $sim_vcd_tmp > $sim_vcd + elif [ $sim_vcd != "/dev/null" ]; then + mv -f $sim_vcd_tmp $sim_vcd + fi } assertConverts() { @@ -167,9 +169,9 @@ simulateAndCompare() { cvv_log=$SHUNIT_TMPDIR/cvv.log # simulate the three files - simulate $ref_vcd $ref_log top $ve $tb - simulate $cvs_vcd $cvs_log top $cs $tb - simulate $cvv_vcd $cvv_log top $cv $tb + simulate $ref_vcd $ref_log $ve $tb + simulate $cvs_vcd $cvs_log $cs $tb + simulate $cvv_vcd $cvv_log $cv $tb # compare reference verilog to converted succinct output=`diff $ref_vcd $cvs_vcd` diff --git a/test/lib/tb_dumper.v b/test/lib/tb_dumper.v index 7bd7ec0..b89bb1b 100644 --- a/test/lib/tb_dumper.v +++ b/test/lib/tb_dumper.v @@ -1,6 +1,6 @@ module sv2v_dumper; initial begin $dumpfile(`TEST_VCD); - $dumpvars(1, `TEST_TOP); + $dumpvars(1, top); end endmodule diff --git a/test/search/run.sh b/test/search/run.sh index 3ed5144..fc1ab43 100755 --- a/test/search/run.sh +++ b/test/search/run.sh @@ -4,7 +4,7 @@ evaluate() { design_v=$SHUNIT_TMPDIR/search_design.v output_log=$SHUNIT_TMPDIR/search.log touch $output_log - simulate /dev/null $output_log top <(echo "$1") /dev/null + simulate /dev/null $output_log <(echo "$1") /dev/null tail -n1 $output_log } diff --git a/test/truncate/run.sh b/test/truncate/run.sh index 362f050..dc26786 100755 --- a/test/truncate/run.sh +++ b/test/truncate/run.sh @@ -32,8 +32,8 @@ testNumber() { # simulate and compare in strict mode EXPECT_IVERILOG_WARNINGS=`[ $mode = trunc_ivl_warns ]; echo $?` \ - simulate /dev/null $ve_log top $ve - simulate /dev/null $cs_log top $cs + simulate /dev/null $ve_log $ve + simulate /dev/null $cs_log $cs output=`diff $ve_log $cs_log` assertTrue "number literals differ:\n$output" $? @@ -56,8 +56,8 @@ testNumber() { # simulate and compare in lax mode EXPECT_IVERILOG_WARNINGS=`[[ "$number" =~ .\' ]] && [ $mode = trunc_ivl_warns ]; echo $?` \ - simulate /dev/null $ve_log top -gno-strict-expr-width $ve - simulate /dev/null $cs_log top -gno-strict-expr-width $cs + simulate /dev/null $ve_log -gno-strict-expr-width $ve + simulate /dev/null $cs_log -gno-strict-expr-width $cs output=`diff $ve_log $cs_log` assertTrue "number literals differ:\n$output" $? }