#!/bin/bash
|
#!/bin/bash
|
# $Id: xise_ghdl_unisim 782 2016-07-03 08:09:36Z mueller $
|
# $Id: xise_ghdl_unisim 782 2016-07-03 08:09:36Z mueller $
|
#
|
#
|
# Copyright 2007-2016 by Walter F.J. Mueller
|
# Copyright 2007-2016 by Walter F.J. Mueller
|
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
|
# License disclaimer see LICENSE_gpl_v2.txt in $RETROBASE directory
|
#
|
#
|
# Revision History:
|
# Revision History:
|
# Date Rev Vers Comment
|
# Date Rev Vers Comment
|
# 2016-07-02 782 1.3.1 add ghdlopts as 1st option; default is -O2
|
# 2016-07-02 782 1.3.1 add ghdlopts as 1st option; default is -O2
|
# 2015-02-03 642 1.3 remove ISE 10 legacy support; add unimacro support
|
# 2015-02-03 642 1.3 remove ISE 10 legacy support; add unimacro support
|
# 2015-01-29 639 1.2 rename from xilinx_*; use XTWI_PATH rather XILINX
|
# 2015-01-29 639 1.2 rename from xilinx_*; use XTWI_PATH rather XILINX
|
# 2009-11-08 248 1.1 adopt to ISE 11.1, use VITAL models from ./primitive
|
# 2009-11-08 248 1.1 adopt to ISE 11.1, use VITAL models from ./primitive
|
# 2007-10-26 92 1.0 Initial version
|
# 2007-10-26 92 1.0 Initial version
|
#
|
#
|
ghdlopts=${1:--O2 -g}
|
ghdlopts=${1:--O2 -g}
|
#
|
#
|
if [ -z "$XTWI_PATH" ]
|
if [ -z "$XTWI_PATH" ]
|
then
|
then
|
echo "XTWI_PATH not defined"
|
echo "XTWI_PATH not defined"
|
exit 1
|
exit 1
|
fi
|
fi
|
if [ ! -d "$XTWI_PATH/ISE_DS/ISE" ]
|
if [ ! -d "$XTWI_PATH/ISE_DS/ISE" ]
|
then
|
then
|
echo "$XTWI_PATH/ISE_DS/ISE not existing"
|
echo "$XTWI_PATH/ISE_DS/ISE not existing"
|
exit 1
|
exit 1
|
fi
|
fi
|
#
|
#
|
ise_path=$XTWI_PATH/ISE_DS/ISE
|
ise_path=$XTWI_PATH/ISE_DS/ISE
|
#
|
#
|
cd $ise_path
|
cd $ise_path
|
echo "============================================================"
|
echo "============================================================"
|
echo "* Build ghdl UNISIM lib for $ise_path"
|
echo "* Build ghdl UNISIM lib for $ise_path"
|
echo "============================================================"
|
echo "============================================================"
|
#
|
#
|
if [ ! -d ghdl ]
|
if [ ! -d ghdl ]
|
then
|
then
|
mkdir ghdl
|
mkdir ghdl
|
fi
|
fi
|
cd ghdl
|
cd ghdl
|
#
|
#
|
if [ ! -d unisim ]
|
if [ ! -d unisim ]
|
then
|
then
|
mkdir unisim
|
mkdir unisim
|
fi
|
fi
|
cd unisim
|
cd unisim
|
#
|
#
|
cp $ise_path/vhdl/src/unisims/unisim_VCOMP.vhd .
|
cp $ise_path/vhdl/src/unisims/unisim_VCOMP.vhd .
|
cp $ise_path/vhdl/src/unisims/unisim_VPKG.vhd .
|
cp $ise_path/vhdl/src/unisims/unisim_VPKG.vhd .
|
#
|
#
|
if [ ! -d primitive ]
|
if [ ! -d primitive ]
|
then
|
then
|
mkdir primitive
|
mkdir primitive
|
fi
|
fi
|
pushd primitive
|
pushd primitive
|
#
|
#
|
cp -p $ise_path/vhdl/src/unisims/primitive/*.vhd .
|
cp -p $ise_path/vhdl/src/unisims/primitive/*.vhd .
|
cp -p $ise_path/vhdl/src/unisims/primitive/vhdl_analyze_order .
|
cp -p $ise_path/vhdl/src/unisims/primitive/vhdl_analyze_order .
|
#
|
#
|
xilinx_vhdl_memcolltype_fix
|
xilinx_vhdl_memcolltype_fix
|
popd
|
popd
|
|
|
echo "# ghdl ... unisim_VCOMP.vhd"
|
echo "# ghdl ... unisim_VCOMP.vhd"
|
ghdl -a --ieee=synopsys --work=unisim $ghdlopts unisim_VCOMP.vhd
|
ghdl -a --ieee=synopsys --work=unisim $ghdlopts unisim_VCOMP.vhd
|
echo "# ghdl ... unisim_VPKG.vhd"
|
echo "# ghdl ... unisim_VPKG.vhd"
|
ghdl -a --ieee=synopsys --work=unisim $ghdlopts unisim_VPKG.vhd
|
ghdl -a --ieee=synopsys --work=unisim $ghdlopts unisim_VPKG.vhd
|
|
|
for file in `cat primitive/vhdl_analyze_order`
|
for file in `cat primitive/vhdl_analyze_order`
|
do
|
do
|
echo "# ghdl ... primitive/$file"
|
echo "# ghdl ... primitive/$file"
|
ghdl -a -fexplicit --ieee=synopsys --work=unisim $ghdlopts \
|
ghdl -a -fexplicit --ieee=synopsys --work=unisim $ghdlopts \
|
--no-vital-checks primitive/$file 2>&1 |\
|
--no-vital-checks primitive/$file 2>&1 |\
|
tee primitive/$file.ghdl.log
|
tee primitive/$file.ghdl.log
|
done
|
done
|
#
|
#
|
echo "--- scan for compilation errors:"
|
echo "--- scan for compilation errors:"
|
find primitive -name "*.ghdl.log" | xargs grep error
|
find primitive -name "*.ghdl.log" | xargs grep error
|
#
|
#
|
echo "============================================================"
|
echo "============================================================"
|
echo "* Build ghdl UNIMACRO lib for $XTWI_PATH/ISE_DS/ISE"
|
echo "* Build ghdl UNIMACRO lib for $XTWI_PATH/ISE_DS/ISE"
|
echo "============================================================"
|
echo "============================================================"
|
#
|
#
|
cd $ise_path/ghdl
|
cd $ise_path/ghdl
|
if [ ! -d unimacro ]
|
if [ ! -d unimacro ]
|
then
|
then
|
mkdir unimacro
|
mkdir unimacro
|
fi
|
fi
|
#
|
#
|
cd unimacro
|
cd unimacro
|
cp $ise_path/vhdl/src/unimacro/*.vhd .
|
cp $ise_path/vhdl/src/unimacro/*.vhd .
|
#
|
#
|
for file in *.vhd
|
for file in *.vhd
|
do
|
do
|
echo "# ghdl ... $file"
|
echo "# ghdl ... $file"
|
ghdl -a -P../unisim -fexplicit --ieee=synopsys --work=unimacro $ghdlopts \
|
ghdl -a -P../unisim -fexplicit --ieee=synopsys --work=unimacro $ghdlopts \
|
--no-vital-checks $file 2>&1 | tee $file.ghdl.log
|
--no-vital-checks $file 2>&1 | tee $file.ghdl.log
|
done
|
done
|
#
|
#
|
echo "--- scan for compilation errors:"
|
echo "--- scan for compilation errors:"
|
find . -name "*.ghdl.log" | xargs grep error
|
find . -name "*.ghdl.log" | xargs grep error
|
#
|
#
|
|
|