Commit 0f822402 by Zachary Snow

test runner simplifications

parent a2956445
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
SCRIPT_DIR=`dirname "${BASH_SOURCE[0]}"` SCRIPT_DIR=`dirname "${BASH_SOURCE[0]}"`
SV2V="$SCRIPT_DIR/../../bin/sv2v +RTS -N1 -RTS" SV2V="$SCRIPT_DIR/../../bin/sv2v +RTS -N1 -RTS"
# USAGE: simulate <vcd-file> <log-file> <top-module> <file> [<file> ...] # USAGE: simulate <vcd-file> <log-file> <file> [<file> ...]
simulate() { simulate() {
# arguments # arguments
sim_vcd=$1 sim_vcd=$1
sim_log=$2 sim_log=$2
sim_top=$3 shift 2
shift 3
# compile the files # compile the files
sim_vcd_tmp=$SHUNIT_TMPDIR/simvcdtmp sim_vcd_tmp=$SHUNIT_TMPDIR/simvcdtmp
sim_prog=$SHUNIT_TMPDIR/simprog.exe sim_prog=$SHUNIT_TMPDIR/simprog.exe
...@@ -19,8 +18,7 @@ simulate() { ...@@ -19,8 +18,7 @@ simulate() {
-o $sim_prog \ -o $sim_prog \
-g2005 \ -g2005 \
-gstrict-expr-width \ -gstrict-expr-width \
-DTEST_VCD="\"$sim_vcd_tmp\"" \ -DTEST_VCD=\"$sim_vcd_tmp\" \
-DTEST_TOP=$sim_top \
"$@" \ "$@" \
$SCRIPT_DIR/tb_dumper.v \ $SCRIPT_DIR/tb_dumper.v \
2>&1` 2>&1`
...@@ -33,10 +31,14 @@ simulate() { ...@@ -33,10 +31,14 @@ simulate() {
assertNotNull "iverilog on $1 did not emit any warnings" "$iv_output" assertNotNull "iverilog on $1 did not emit any warnings" "$iv_output"
fi fi
# run the simulation # run the simulation
$sim_prog > $sim_log $sim_prog -no-date > $sim_log
assertTrue "simulating $1 failed" $? assertTrue "simulating $1 failed" $?
# remove the date from the VCD # remove parameters from the VCD if present
sed -e "1,3d" < $sim_vcd_tmp | $SCRIPT_DIR/clean_vcd.py > $sim_vcd 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() { assertConverts() {
...@@ -167,9 +169,9 @@ simulateAndCompare() { ...@@ -167,9 +169,9 @@ simulateAndCompare() {
cvv_log=$SHUNIT_TMPDIR/cvv.log cvv_log=$SHUNIT_TMPDIR/cvv.log
# simulate the three files # simulate the three files
simulate $ref_vcd $ref_log top $ve $tb simulate $ref_vcd $ref_log $ve $tb
simulate $cvs_vcd $cvs_log top $cs $tb simulate $cvs_vcd $cvs_log $cs $tb
simulate $cvv_vcd $cvv_log top $cv $tb simulate $cvv_vcd $cvv_log $cv $tb
# compare reference verilog to converted succinct # compare reference verilog to converted succinct
output=`diff $ref_vcd $cvs_vcd` output=`diff $ref_vcd $cvs_vcd`
......
module sv2v_dumper; module sv2v_dumper;
initial begin initial begin
$dumpfile(`TEST_VCD); $dumpfile(`TEST_VCD);
$dumpvars(1, `TEST_TOP); $dumpvars(1, top);
end end
endmodule endmodule
...@@ -4,7 +4,7 @@ evaluate() { ...@@ -4,7 +4,7 @@ evaluate() {
design_v=$SHUNIT_TMPDIR/search_design.v design_v=$SHUNIT_TMPDIR/search_design.v
output_log=$SHUNIT_TMPDIR/search.log output_log=$SHUNIT_TMPDIR/search.log
touch $output_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 tail -n1 $output_log
} }
......
...@@ -32,8 +32,8 @@ testNumber() { ...@@ -32,8 +32,8 @@ testNumber() {
# simulate and compare in strict mode # simulate and compare in strict mode
EXPECT_IVERILOG_WARNINGS=`[ $mode = trunc_ivl_warns ]; echo $?` \ EXPECT_IVERILOG_WARNINGS=`[ $mode = trunc_ivl_warns ]; echo $?` \
simulate /dev/null $ve_log top $ve simulate /dev/null $ve_log $ve
simulate /dev/null $cs_log top $cs simulate /dev/null $cs_log $cs
output=`diff $ve_log $cs_log` output=`diff $ve_log $cs_log`
assertTrue "number literals differ:\n$output" $? assertTrue "number literals differ:\n$output" $?
...@@ -56,8 +56,8 @@ testNumber() { ...@@ -56,8 +56,8 @@ testNumber() {
# simulate and compare in lax mode # simulate and compare in lax mode
EXPECT_IVERILOG_WARNINGS=`[[ "$number" =~ .\' ]] && [ $mode = trunc_ivl_warns ]; echo $?` \ EXPECT_IVERILOG_WARNINGS=`[[ "$number" =~ .\' ]] && [ $mode = trunc_ivl_warns ]; echo $?` \
simulate /dev/null $ve_log top -gno-strict-expr-width $ve simulate /dev/null $ve_log -gno-strict-expr-width $ve
simulate /dev/null $cs_log top -gno-strict-expr-width $cs simulate /dev/null $cs_log -gno-strict-expr-width $cs
output=`diff $ve_log $cs_log` output=`diff $ve_log $cs_log`
assertTrue "number literals differ:\n$output" $? assertTrue "number literals differ:\n$output" $?
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment