forked from bmartini/zynq-axis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
syn-proj
executable file
·86 lines (63 loc) · 1.42 KB
/
syn-proj
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
#!/usr/bin/env bash
set -o errexit
function print_usage() {
echo "
Usage: $0 [OPTION] [project-name]
Description: Synthesize a project in scratch & produce bitfile.
Options:
-h Print this help info.
-s Synthesize only. Assumes that the 'syn-proj-prep' script has already
been run.
Argument:
The 'project-name' is an optional argument that will select which
project to synthesize. Without the argument the default
project-zedboard-conv' is used.
"
}
flag_s=
# command line options
while getopts "hs" flag
do
case "$flag" in
s) flag_s=1;;
h) print_usage; exit 2;;
?) print_usage; exit 2;;
esac
done
# default project selection
PROJ='project-zedboard_axis'
# sanitise project argument
shift $(($OPTIND - 1))
if [ $# -gt 1 ]
then :
echo "ERROR: To many arguments"
exit 1
elif [ ! -d "syn/$@" ]
then :
echo "ERROR: Project not found"
exit 1
fi
# assign project if given as argument
if [[ ! -z "$@" && "$@" != "$PROJ" ]]
then :
PROJ=$@
fi
# prep for project syntheses
if [ -z "$flag_s" ]
then :
./syn-proj-prep
fi
if [ ! -d syn/scratch ]
then :
echo "ERROR: No 'syn/scratch' directory found"
exit 1
fi
if [ -z "$(command -v vivado)" ]; then
echo "ERROR: No Xilinx tool has been sourced."
exit 1
fi
# generate the bitfile using Xilinx tools
cd syn/scratch/
vivado -mode tcl -source $PROJ/generate-bitfile.tcl
# copy bitfile to repo root
find ./$PROJ -name "*.bit" | xargs -I F cp F ../../${PROJ#"project-"}.bit