-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathxviv_ghdl_unisim
executable file
·136 lines (134 loc) · 3.34 KB
/
xviv_ghdl_unisim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/bin/bash
# $Id: xviv_ghdl_unisim 1172 2019-06-29 07:27:24Z mueller $
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright 2015-2019 by Walter F.J. Mueller <[email protected]>
#
# Revision History:
# Date Rev Vers Comment
# 2016-07-02 782 1.1.1 add ghdlopts as 1st option; default is -O2
# 2016-04-17 762 1.1 update for viv 2016.1
# 2015-02-02 642 1.0 Initial version
#
ghdlopts=${1:--O2 -g}
#
if [ -z "$XTWV_PATH" ]
then
echo "XTWV_PATH not defined"
exit 1
fi
if [ ! -d "$XTWV_PATH" ]
then
echo "$XTWV_PATH not existing"
exit 1
fi
#
cd $XTWV_PATH
echo "============================================================"
echo "* Build ghdl UNISIM lib for $XTWV_PATH"
echo "============================================================"
#
if [ ! -d ghdl ]
then
mkdir ghdl
fi
cd ghdl
#
if [ ! -d unisim ]
then
mkdir unisim
fi
cd unisim
#
# copy VCOMP and VPKG ----------------------------
#
cp $XTWV_PATH/data/vhdl/src/unisims/unisim_retarget_VCOMP.vhd .
cp $XTWV_PATH/data/vhdl/src/unisims/unisim_VPKG.vhd .
#
# copy 'primitive' models ------------------------
#
if [ ! -d primitive ]
then
mkdir primitive
fi
pushd primitive
#
cp -p $XTWV_PATH/data/vhdl/src/unisims/primitive/*.vhd .
cp -p $XTWV_PATH/data/vhdl/src/unisims/primitive/vhdl_analyze_order .
# in Vivado 2014.4 the vhdl_analyze_order and contains two extraneous entries
# simply drop them to avoid errors later on
sed -i.bak -e '\|OBUFTDSE3| d' \
-e '\|OBUFTE3| d' \
vhdl_analyze_order
#
xilinx_vhdl_memcolltype_fix
popd
#
# copy 'retarget' models -------------------------
#
if [ ! -d retarget ]
then
mkdir retarget
fi
pushd retarget
#
cp -p $XTWV_PATH/data/vhdl/src/unisims/retarget/*.vhd .
ls -1 *.vhd > vhdl_analyze_order
#
xilinx_vhdl_memcolltype_fix
popd
#
# now compile all --------------------------------
#
echo "# ghdl ... unisim_retarget_VCOMP.vhd"
ghdl -a --ieee=synopsys --work=unisim $ghdlopts unisim_retarget_VCOMP.vhd
echo "# ghdl ... unisim_VPKG.vhd"
ghdl -a --ieee=synopsys --work=unisim $ghdlopts unisim_VPKG.vhd
for file in `cat primitive/vhdl_analyze_order`
do
echo "# ghdl ... primitive/$file"
ghdl -a -fexplicit --ieee=synopsys --work=unisim $ghdlopts \
--no-vital-checks primitive/$file 2>&1 |\
tee primitive/$file.ghdl.log
done
#
for file in `cat retarget/vhdl_analyze_order`
do
echo "# ghdl ... retarget/$file"
ghdl -a -fexplicit --ieee=synopsys --work=unisim $ghdlopts \
--no-vital-checks retarget/$file 2>&1 |\
tee retarget/$file.ghdl.log
done
#
echo "--- scan for compilation errors:"
find primitive retarget -name "*.ghdl.log" | xargs grep error
#
#
echo "============================================================"
echo "* Build ghdl UNIMACRO lib for $XTWV_PATH"
echo "============================================================"
#
cd $XTWV_PATH/ghdl
if [ ! -d unimacro ]
then
mkdir unimacro
fi
cd unimacro
#
cp $XTWV_PATH/data/vhdl/src/unimacro/*.vhd .
if [ -r $XTWV_PATH/data/vhdl/src/unimacro/vhdl_analyze_order ]
then
cp $XTWV_PATH/data/vhdl/src/unimacro/vhdl_analyze_order .
else
ls -1 *.vhd > vhdl_analyze_order
fi
#
for file in `cat vhdl_analyze_order`
do
echo "# ghdl ... $file"
ghdl -a -P../unisim -fexplicit --ieee=synopsys --work=unimacro $ghdlopts \
--no-vital-checks $file 2>&1 | tee $file.ghdl.log
done
#
echo "--- scan for compilation errors:"
find . -name "*.ghdl.log" | xargs grep error
#