URL
https://opencores.org/ocsvn/w11/w11/trunk
Subversion Repositories w11
[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [bin/] [tbrun_tbw] - Rev 40
Go to most recent revision | Compare with Previous | Blame | View Log
#!/bin/bash
# $Id: tbrun_tbw 641 2015-02-01 22:12:15Z mueller $
#
# Copyright 2014- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
#
# Revision History:
# Date Rev Version Comment
# 2014-12-27 622 1.0.1 add --stack, --ghw, --tbw, --pcom
# 2014-12-26 621 1.0 Initial version
#
docmd ()
{
echo "$1"
if [[ -z "$optdry" ]] ; then
eval "$1"
fi
}
optdry=""
optlsuf=""
optstack=""
optghw=""
opttbw=""
optpcom=""
# handle options
while (( $# > 0 )) ; do
case $1 in
-dry|--dry) optdry=$1 ; shift 1 ;;
-lsuf|--lsuf) optlsuf=$2 ; shift 2 ;;
-stack|--stack) optstack=$2 ; shift 2 ;;
-ghw|--ghw) optghw=$2 ; shift 2 ;;
-tbw|--tbw) opttbw=$2 ; shift 2 ;;
-pcom|--pcom) optpcom=$1 ; shift 1 ;;
-*) echo "tbrun_tbw-E: invalid option '$1'"; exit 1 ;;
*) break;;
esac
done
tbench=$1
stimfile=$2
# complain if no tbench defined
if (( $# == 0 )) ; then
echo "Usage: tbrun_tbw [opts] testbench [stimfile]"
echo " Options:"
echo " --dry dry run, print commands, don't execute"
echo " --lsuf suff use '_<suff>.log' as suffix for log file"
echo " --stack nnn use <nnn> as ghdl stack size"
echo " --ghw fname write ghw file with name '<fname>.ghw"
echo " --tbw opts append <opts> to tbw command"
exit 1
fi
# check for ISim
isisim=""
if [[ $tbench =~ _ISim ]] ; then
isisim=true
fi
# check for ghdl with _ssim, _fsim, _tsim
isghdlxsim=""
if [[ "$isisim" == "" ]] && [[ $tbench =~ _[sft]sim$ ]] ; then
isghdlxsim=true
logsuff=""
fi
# issue makes
if [[ -n "$isghdlxsim" ]] ; then docmd "make ghdl_tmp_clean"; fi
docmd "make $tbench"
exitstat=$?
if [[ -n "$isghdlxsim" ]] ; then docmd "make ghdl_tmp_clean"; fi
if (( $exitstat > 0 )) ; then exit $exitstat; fi
# determine logfile name
logsuff="_dsim"
if [[ $tbench =~ _[sft]sim$ ]] ; then logsuff=""; fi
if [[ -n "$optlsuf" ]] ; then logsuff="_$optlsuf"; fi
logfile="${tbench}${logsuff}.log"
# now build actual test command (a tbw|filter|tee|egrep pipe)
cmd="time tbw $tbench"
if [[ -n "$isisim" ]] ; then cmd+=" -run"; fi
if [[ -n "$stimfile" ]] ; then cmd+=" $stimfile"; fi
if [[ -n "$opttbw" ]] ; then cmd+=" $opttbw"; fi
if [[ -n "$optstack" ]] ; then cmd+=" --stack-max-size=$optstack"; fi
if [[ -n "$optghw" ]] ; then cmd+=" --wave=$optghw.ghw"; fi
cmd+=" 2>&1"
if [[ -z "$isisim" ]] ; then cmd+=" | ghdl_assert_filter"; fi
cmd+=" | tee $logfile"
pcomtag=""
if [[ -n "$optpcom" ]] ; then pcomtag="^C|"; fi
# FAIL, PASS, DONE come from tbs; ERROR comes from ISim
cmd+=" | egrep \"(${pcomtag}-[EFW]:|ERROR|FAIL|PASS|DONE)\""
docmd "$cmd"
Go to most recent revision | Compare with Previous | Blame | View Log