speculatrix wrote:
Thanks. I've now got WinCUPL installed. It's kinda ... um ... early 1990s, but I guess it does the job.
Just about.
I use the following Cygwin bash script to wrap the command line tools, as the GUI is quite awful!
Code:
#!/bin/bash
WINCUPL_SHARED="c:/WinCupl/Shared"
# These are documented in http://ee.sharif.edu/~logic_circuits_t/readings/CUPL_Reference.pdf
cuplopts=-jaxf
usage()
{
echo "Usage: $0 <pld> <outdir>"
echo " where <pld> is the PLD source file"
echo " <outdir> is an output directory"
echo
echo "The output directory will contain copies of the source files"
echo "along with all output files, including compiler console output"
echo "(errors, etc) in <pld_basename>.out."
echo
echo "If a corresponding <pld_basename>.si file exists, the simulator"
echo "will also be run after a successful compile."
}
f="$1"
if [ ! -e "$f" ]; then
usage
exit 1
fi
f_base=`basename "$f" .pld`
outdir="$2"
if [ "$outdir" == "" ]; then
usage
exit 1
fi
if [ ! -d "$outdir" ]; then
mkdir -p "$outdir"
if [ ! -d "$outdir" ]; then
echo "Output directory '$outdir' is not a directory"
exit 1
fi
fi
cp "$f" "$outdir"
if [ -f "$f_base".si ]; then
cp "$f_base".si "$outdir"
# Adding the 's' option makes it also run the simulator - it's not in the docs, but
# I read about it somewhere. I can't manage to get the simulator to run standalone.
cuplopts="$cuplopts"s
fi
# Some bits of cupl only work if the files are in the current directory
f=`basename "$f"`
f_base=`basename "$f_base"`
cd "$outdir"
# Remove old output files
for ext in abs doc jed lst out pla sim so wo; do
rm -f "$f_base.$ext"
done
export LIBCUPL="$WINCUPL_SHARED"/atmel.dl
"$WINCUPL_SHARED"/cupl $cuplopts "$f" > "$f_base".out
# Check and report errors
if [ "$?" -gt 0 ]; then
# The compiler outputs errors mixed in with its other output, print them here
grep '^[[]' "$f_base".out
# If the .so file exists, then the compile succeeded and the simulator was run but failed
if [ -e "$f_base".so ]; then
# The simulaton doesn't output errors to the console, only to the .so file
cat "$f_base".so
echo
echo "ERROR: Simulation failed, see errors above"
exit 1
else
# No .so file means the simulator didn't run, i.e. the compile failed
echo "ERROR: Compilation failed"
exit 1
fi
fi