#! /bin/sh

cppsim_root=${CPPSIMHOME-$HOME/CppSim}
if [ -z "$CPPSIMHOME" ]; then export CPPSIMHOME=$cppsim_root; fi

cppsimshared_bin_dir=$(dirname $0)
cppsimshared_root="${cppsimshared_bin_dir%/*}"
#cppsimshared_root=${CPPSIMSHAREDHOME-$cppsim_root/CppSimShared}
if [ -z "$CPPSIMSHAREDHOME" ]; then export CPPSIMSHAREDHOME=$cppsimshared_root; fi

expand_tilde () { eval "$1=$2" ; }
expand_tilde cppsimshared_root $cppsimshared_root

ARCH=`arch`

if [ "$ARCH" = "i686" ] 
   then
   ${cppsimshared_root}/bin/glnx86/check_verilator_run_status $*
else
if [ "$ARCH" = "x86_64" ] 
   then
   ${cppsimshared_root}/bin/glnxa64/check_verilator_run_status $*
else
if [ "$ARCH" = "i386" ] 
   then
   ${cppsimshared_root}/bin/macosx/check_verilator_run_status $*
else
if [ "$ARCH" = "arm64" ] 
   then
   ${cppsimshared_root}/bin/arm64/check_verilator_run_status $*
else
   echo "Error: architecture $ARCH unknown"
fi
fi
fi
fi
