-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathqp_info
executable file
·100 lines (83 loc) · 2.35 KB
/
qp_info
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
#!/usr/bin/env bash
# Show information about Quartus Prime project
# Time-stamp: <2022-10-21 15:49:13>
usage() {
SCRIPT_NAME="${BASH_SOURCE##*/}"
echo "Usage:"
echo " $SCRIPT_NAME"
}
if [ "$#" -gt 0 ]; then
usage
exit 0
fi
qp_prj_info() {
PRJ=$(ls ./*.qpf 2>/dev/null)
if [ -z "$PRJ" ]; then
echo "ERROR! Can not find Quartus Prime project (qsf) file!"
exit 0
else
echo "Project file: $PRJ"
fi
}
parsing_revision_file() {
REVFNAME="$1"
QP_VERISON=$("$CMD" "$CMD_FLAGS" -e "-name LAST_QUARTUS_VERSION\s" "$REVFNAME" |\
sed 's/.*LAST_QUARTUS_VERSION\s\"\(.*\)\"/\1/')
FAMILY=$("$CMD" "$CMD_FLAGS" -e "-name FAMILY" "$REVFNAME" | \
sed 's/.*FAMILY\s*\"\(.*\)\"/\1/')
DEVICE=$("$CMD" "$CMD_FLAGS" -e "-name DEVICE\s" "$REVFNAME" | \
sed 's/.*DEVICE\s*\(.*\)/\1/')
CFG_DEVICE=$("$CMD" "$CMD_FLAGS" -e "-name\s.*CONFIGURATION_DEVICE\s" "$REVFNAME" | \
"$CMD" "$CMD_FLAGS" -e "\s*EPC" | \
sed 's/.*CONFIGURATION_DEVICE\s*\(.*\)/\1/')
CFG_SCH=$("$CMD" "$CMD_FLAGS" -e "-name\s.*CONFIGURATION_SCHEME\s" "$REVFNAME" | \
sed 's/.*CONFIGURATION_SCHEME\s*\(.*\)/\1/')
if [ -z "$FAMILY" ]; then
FAMILY="-"
fi
if [ -z "$DEVICE" ]; then
DEVICE="-"
fi
CFG_INFO=""
if [ -z "$CFG_DEVICE" ]; then
CFG_INFO="-"
else
CFG_INFO="$CFG_DEVICE"
if [ -n "$CFG_SCH" ]; then
CFG_INFO="$CFG_INFO (scheme: $CFG_SCH)"
fi
fi
echo "Quartus: $QP_VERISON"
echo "Family/Device: $FAMILY / $DEVICE"
if [ "$CFG_INFO" != "-" ]; then
echo "Config.device: $CFG_INFO"
fi
}
qp_revision_info() {
cnt=1
for p in $(ls $OUTDIR*.qsf 2>/dev/null); do
revision[$cnt]=$p
cnt=`expr $cnt + 1`
done
echo "Revision(s):"
for (( i=1; i<${#revision[@]}+1; i++ )); do
REVFNAME=${revision[${i}]}
echo "$i. $REVFNAME"
parsing_revision_file "$REVFNAME"
done
}
if hash rg 2>/dev/null; then
CMD=rg
CMD_FLAGS="-IN"
else
CMD=grep
CMD_FLAGS="-h"
fi
qp_prj_info
qp_revision_info
# 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: