2023-08-11 20:59:39 -05:00
|
|
|
#!/usr/bin/env bash
|
2018-10-18 14:27:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
TESTNAME=$1
|
|
|
|
|
|
|
|
STDOUTFILE=${TESTNAME}.log_stdout
|
|
|
|
STDERRFILE=${TESTNAME}.log_stderr
|
|
|
|
|
|
|
|
echo "" > $STDOUTFILE
|
|
|
|
echo "" > $STDERRFILE
|
|
|
|
|
|
|
|
echo -n "Test: ${TESTNAME} -> "
|
|
|
|
|
2019-04-25 08:12:24 -05:00
|
|
|
set -e
|
|
|
|
|
2019-05-03 07:40:51 -05:00
|
|
|
$PWD/../../yosys -p "read_verilog -sv ${TESTNAME}.sv ; hierarchy -check -top TopModule ; synth ; write_verilog ${TESTNAME}_syn.v" >> $STDOUTFILE 2>> $STDERRFILE
|
|
|
|
$PWD/../../yosys -p "read_verilog -sv ${TESTNAME}_ref.v ; hierarchy -check -top TopModule ; synth ; write_verilog ${TESTNAME}_ref_syn.v" >> $STDOUTFILE 2>> $STDERRFILE
|
2018-10-18 14:27:04 -05:00
|
|
|
|
|
|
|
rm -f a.out reference_result.txt dut_result.txt
|
|
|
|
|
|
|
|
iverilog -g2012 ${TESTNAME}_syn.v
|
|
|
|
iverilog -g2012 ${TESTNAME}_ref_syn.v
|
|
|
|
|
|
|
|
set +e
|
|
|
|
iverilog -g2012 ${TESTNAME}_tb.v ${TESTNAME}_ref_syn.v
|
|
|
|
./a.out
|
|
|
|
mv output.txt reference_result.txt
|
2018-10-20 04:58:25 -05:00
|
|
|
if [ -f ${TESTNAME}_wrapper.v ] ; then
|
|
|
|
iverilog -g2012 ${TESTNAME}_tb_wrapper.v ${TESTNAME}_syn.v
|
|
|
|
else
|
|
|
|
iverilog -g2012 ${TESTNAME}_tb.v ${TESTNAME}_syn.v
|
|
|
|
fi
|
2018-10-18 14:27:04 -05:00
|
|
|
./a.out
|
|
|
|
mv output.txt dut_result.txt
|
|
|
|
|
|
|
|
diff reference_result.txt dut_result.txt > ${TESTNAME}.diff
|
|
|
|
RET=$?
|
|
|
|
if [ "$RET" != "0" ] ; then
|
|
|
|
echo "ERROR!"
|
|
|
|
exit -1
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "ok"
|
|
|
|
exit 0
|