#!/bin/csh
#-------------------------------------------------------------------------------
# Project:     DLX
# File:        _run.command
# Description: Script to simulate DLX with GHDL
#-------------------------------------------------------------------------------
# Notes:       the script works with GHDL installed using Wine - if required
#-------------------------------------------------------------------------------

echo `pwd`

set SIM={`pwd`}
set SRC=${SIM}/../src
set WORK=${SIM}/work

# create working directories
mkdir -p ./work

#-------------------------------------------------------------------------------
# perform GHDL simulation
echo ${WORK}

# import sources to library, make simulator to current working directory
ghdl --clean --workdir=${WORK}
ghdl -i --workdir=${WORK} -v ${SRC}/*.vhdl
ghdl -m --workdir=${WORK} dlx_test_behaviour

# copy the program code supplied in test_loop.out to the RUN directory
cp -f ${SRC}/test_loop.out dlx.out

# execute from current working directory
ghdl -r --workdir=${WORK} dlx_test_behaviour --assert-level=note

#-------------------------------------------------------------------------------
# final cleanup
echo done

#-------------------------------------------------------------------------------
# end of file
