-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqp_open
executable file
·95 lines (80 loc) · 2.1 KB
/
qp_open
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
#!/usr/bin/env bash
#
# Open Intel Quartus project
#
# This script look for Intel Quartus Prime project file (qpf) and opens one of the revisions.
#
# Time-stamp: <2022-07-07 09:19:41>
echo "+------------------------------------------------------------------------+"
echo "| Open quartus project |"
echo "+------------------------------------------------------------------------+"
if [ "$1" = '-h' ] || [ "$1" = '--help' ] || [ "$1" = '-help' ]; then
echo "Usage:"
echo " ${BASH_SOURCE##*/} [revision-number]"
echo
echo "ARGS:"
echo " <revision-number>"
echo " Quartus revision file number."
exit 0
fi
cnt=1
for p in `ls *.qpf 2>/dev/null`; do
prj[$cnt]=$p
cnt=`expr $cnt + 1`
done
if [ ${#prj[@]} -ne 1 ]; then
echo "ERROR! There must be only one *.qpf file in the directory: $(pwd)"
exit 2
else
project=${prj[1]}
echo "Project: $project"
fi
cnt=1
for p in `ls *.qsf 2>/dev/null`; do
rev[$cnt]=$p
cnt=`expr $cnt + 1`
done
nrevs=${#rev[@]}
revision="$1"
echo_revisions () {
echo "Revisions:"
for (( i=1; i<$nrevs+1; i++ )); do
echo "$i -> ${rev[${i}]}"
done
}
if [ "$revision" = "" ]; then
if [ "$nrevs" -eq 0 ]; then
echo "ERROR! There must be at least one *.qsf file in dir: $(pwd)"
exit 3
elif [ "$nrevs" -eq 1 ]; then
num_revision=1
else
echo_revisions
echo "Select revision:"
read -r num_revision
fi
else
num_revision=$revision
fi
case "$num_revision" in
[1-9])
revision_name=${rev[$num_revision]}
;;
esac
if [ ! -f "$revision_name" ]; then
echo "ERROR! You have selected a non-existent version!"
echo_revisions
exit 1
fi
if [ ! -s "$revision_name" ]; then
echo "Warning! You select an empty revision file!"
echo_revisions
fi
echo "open revision: $revision_name"
quartus "$project" -c "$revision_name" &
# This is for the sake of Emacs.
# Local Variables:
# time-stamp-end: "$"
# time-stamp-format: "<%:y-%02m-%02d %02H:%02M:%02S>"
# time-stamp-start: "Time-stamp: "
# End: