Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 104 lines (93 sloc) 2.2 KB
#!/bin/bash
LOG_DIR=logs
COV_DIR=coverage
UCDB=""
MERGED_UCDB=$COV_DIR/merged.ucdb
MINI_REPORT=$LOG_DIR/mini_report.log
ECHO_VSIM=1
COV=0
CLI=-c
SV_SEED=100
POSITIONAL=()
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-s|--seed)
SV_SEED="$2"
shift # past argument
shift # past value
;;
-g|--gui)
CLI=
shift # past argument
;;
-c|--cov)
COV=1
shift # past argument
;;
-n|--no_echo)
ECHO_VSIM=0
shift # past argument
;;
-h|--help)
echo "Usage:"
echo "-s <value> set the seed value (default: 100)"
echo "-g start in gui mode"
echo "-c enable coverage"
echo "-n disable vsim log echoing"
echo "-h show help text"
exit 1
shift # past argument
;;
*) # unknown option
POSITIONAL+=("$1") # save it in an array for later
shift # past argument
;;
esac
done
set -- "${POSITIONAL[@]}" # restore positional parameters
## Compile DUT
vlog -sv dut/*
get_line_number(){
LINE=`grep -n "$1" $2 | cut -f1 -d:`
echo $LINE
}
run_test(){
mkdir -p $LOG_DIR
UCDB+=" $COV_DIR/${1}.ucdb"
LOG=$LOG_DIR/${1}.log
VSIM_DO="run -all"
if [ $COV = 1 ]; then
mkdir -p $COV_DIR
VSIM_DO="coverage save -onexit $COV_DIR/${1}.ucdb; onfinish stop; run -all; fcover report -cvg; quit"
fi
vlog -sv +define+TEST=$1 tb/top.sv
if [ $ECHO_VSIM = 1 ]; then
vsim $CLI -do "$VSIM_DO" -sv_seed $SV_SEED top |& tee $LOG
else
vsim $CLI -do "$VSIM_DO" -sv_seed $SV_SEED top &> $LOG
fi
START=$(get_line_number "BEGIN REPORT" $LOG)
END=$(get_line_number "END REPORT" $LOG)
echo >> $MINI_REPORT
echo "########### $1 Begin ###########" >> $MINI_REPORT
sed -n $START,${END}p $LOG >> $MINI_REPORT
grep "Errors:" $LOG >> $MINI_REPORT
echo "########### $1 End ###########" >> $MINI_REPORT
}
do_coverage(){
## Merge all ucdbs
vcover merge $UCDB -out $MERGED_UCDB
vcover report -cvg -details $MERGED_UCDB &> $COV_DIR/final_report.log
}
rm -rf $MINI_REPORT
## All tests
run_test MaxOneBrStoreLoadTest
run_test RandomBrStoreLoadTest
run_test Test
if [ $COV = 1 ]; then
do_coverage
fi
cat $MINI_REPORT
grep -rn --color=auto "FAILED" $MINI_REPORT
You can’t perform that action at this time.