bcp_test 5.12 KB
#!/bin/sh

if [ "$ROOT" = "" ]; then
	echo "########################################"
	echo "       Please specify ROOT please       "
	echo "########################################"
	exit 1
fi

sim=${ROOT}/PR/hw2/chip/vsim/sim.ipc
iosim=${ROOT}/PR/iosim/src/iosim
REGR_DIR=${ROOT}/PR/rspsim/vuregre/regression2
PRROOT=${ROOT}/PR
cvtdmem=${ROOT}/PR/rspsim/vuregre/bin/cvtdmem
dat2rdram=${ROOT}/PR/rspsim/vuregre/bin/dat2rdram
d2asm=${ROOT}/PR/rspsim/vuregre/bin/d2asm

mkdir ctrace
echo $1
if [ "$1" = "dma" ]; then
	cp ${ROOT}/PR/rspsim/dmaregre/ready/rdram_*.dat .
	cp ${ROOT}/PR/rspsim/dmaregre/ready/rdram_*.bin .
	cp ${ROOT}/PR/rspsim/dmaregre/ready/rdram_reordered_0.data .

	cp -f ${REGR_DIR}/testsuite .
	grep "^DMA" testsuite | sed -e s/"DMA.*rsp"/DMA.rsp/ > run_test
else 
	cp -f ${REGR_DIR}/small_testsuite testsuite
	grep "^SU" testsuite | sed -e s/"SU.*rsp"/SU.rsp/ > run_test
	grep "^VU" testsuite | sed -e s/"VU.*rsp"/VU.rsp/ >> run_test
	grep "^DMA" testsuite | sed -e s/"DMA.*rsp"/DMA.rsp/ >> run_test
	
fi
	
if [ "$IOSIM_PORT" = "" ]; then
	export IOSIM_SERVER=127.0.0.1
	export IOSIM_PORT=8888
fi

rm -rf test.result
OIFS=$IFS;  IFS=.
while read test_type path ext
do
	IFS=$OIFS
	file=`basename $path`
	
	#### Create Make file #####
	echo "TARGET1 = ${file}.${ext}" > Makefile
	echo "TARGET2 = ${file}.rdram_IMEM" >> Makefile
	echo >> Makefile
	echo "\$(TARGET2): ${file}.${ext}"  >> Makefile
	echo "	rm -f a.out*" >> Makefile

	echo "$ext" | grep "in" && {
		echo "	$d2asm ${file}.in ${file}.s ${file}.inlst" >> Makefile
	}

	echo "	${PRROOT}/rspasm1201/rspasm -b 0 ${file}.s" >> Makefile
	echo "	mv a.out ${file}.out" >> Makefile
	echo "	mv a.out.lst ${file}.lst" >> Makefile
	echo "	mv a.out.dat ${file}.dat" >> Makefile
	
	if [ "$test_type" = "VU" ]; then
		echo "	${PRROOT}/rspsim/vuregre/bin/make_rtsk ${file} 31 1" >> Makefile
	else
		if [ "$test_type" = "SU" ]; then
			echo "	${PRROOT}/rspsim/vuregre/bin/make_rtsk ${file} 1 1" >> Makefile
		else
			echo "	${PRROOT}/rspsim/vuregre/bin/make_dma_rtsk ${file} 1 1" >> Makefile
		fi
	fi 

	echo "	${PRROOT}/rspsim/rsp -ntz ${file}.rtsk</dev/null> ${file}.simlog" >> Makefile
	echo "	${cvtdmem} ${file}.eoe_dmem | $dat2rdram 1 > ${file}.eoe_DMEM" >> Makefile
	echo "	mv trace_out ctrace/${file}.ctrace" >> Makefile
	echo "	${cvtdmem} ${file}.dat | $dat2rdram > rdram.DMEM" >> Makefile
	echo "	(cd ctrace; ${PRROOT}/rspsim/vuregre/bin/trace2ver $file)" >> Makefile
	echo "	${PRROOT}/rspsim/vuregre/bin/lst2IMEM ${file}.lst > rdram.IMEM"  >> Makefile
    echo "	${PRROOT}/rspsim/vuregre/bin/reorder" >> Makefile 
    echo "	mv dmem_reordered.data ${file}.rdram_DMEM" >> Makefile
    echo "	mv imem_reordered.data ${file}.rdram_IMEM" >> Makefile
	
	echo >> Makefile
	echo  "\$(TARGET1): ${PRROOT}/${path}.${ext} " >> Makefile
	echo  "	cp ${PRROOT}/${path}.${ext} ${file}.${ext}" >> Makefile
	echo  "	chmod +w ${file}.${ext}" >> Makefile
	echo  "	cp ${PRROOT}/rspsim/suregre/csrc/suregre.h suregre.h"  >> Makefile
	echo  "	cp ${PRROOT}/rspsim/vuregre/src/include/VU_AVP.h VU_AVP.h" >> Makefile
	echo  "	chmod +w suregre.h" >> Makefile
	echo  "	chmod +w VU_AVP.h"  >> Makefile

	make 

	#create the test script 
    echo "k 1" > test.tst
 	echo >> test.tst
	echo "//t 200  00000000 00000000 00000000 00000000" >> test.tst
	if [ "$1" = "dma" ]; then
		echo "sp_load rdram_reordered_0.data" >> test.tst
	fi
	echo "sp_load ${file}.rdram_IMEM" >> test.tst
	echo "sp_load ${file}.rdram_DMEM" >> test.tst
	echo >> test.tst
    echo "t 0063 00000001 04000000 00000000 00001000" >> test.tst
    echo "t 0063 00000001 04001000 00001000 00001000" >> test.tst
    echo "t 0104 04040010 0000000c 00000001 00000000" >> test.tst
    echo "t 0102 04040010 00000020 00000001 00000000" >> test.tst
    echo  >> test.tst

    case $test_type in
		SU) this_type=0;;
		VU) this_type=1;;
		DMA) this_type=3;;
	esac

	echo "Running test RSP $1 : ${file}" >> /tmp/bb_perf

	if [ "$1" = "pin_single" ]; then
		echo "sp_start 1 1 $this_type" >> test.tst
		echo "t 0401 00000002 00020002 00000002 00020002"  >> test.tst 
	else
	    echo "sp_start 1 0 $this_type" >> test.tst
    	echo "t 0400 0000002 00000002 00000000 00000000" >> test.tst
	fi

    echo "sp_start 0 0" >> test.tst
    echo  >> test.tst 
    echo "t 0063 00000002 04000000 00003000  00001000" >> test.tst
    echo "t 0104 04040010 0000000c 00000001  00000000" >> test.tst

	if [ "$file" != "dma60" ]; then
		echo "t 0100 00003000 00000000 00000000  00000000" >> test.tst
	    echo "sp_compare ${file}.eoe_DMEM" >> test.tst
	fi
	
	if [ "$1" != "dma" ]; then
		echo "sp_trace 0 ctrace/${file}.trSU" >> test.tst
		echo "sp_trace 1 ctrace/${file}.trVU" >> test.tst
		echo "sp_trace 2 ctrace/${file}.trDM" >> test.tst	
	fi
	
    echo  >> test.tst
    echo "k 0" >> test.tst
    echo "//q" >> test.tst
 	
	echo  >> test.result
	echo "Test ${file} @ `date`" >> test.result

	if [ "$2" = "" ]; then
		${iosim} -f test.tst -d 0241 >> test.result 2>&1
	else
    	echo "k 1" > rand.tst
		if [ "$1" = "dma" ]; then
			echo "sp_rand 1 $file" >> rand.tst
		else
			echo "sp_rand 0 $file" >> rand.tst
		fi
    	echo "k 0" >> rand.tst
		${iosim} -f rand.tst -d 0241 2>&1 >> rand.result
	fi

	#rm test.tst
	OIFS=$IFS;  IFS=.
done < run_test
IFS=$OIFS