-
Notifications
You must be signed in to change notification settings - Fork 2
/
qp_summary
executable file
·104 lines (86 loc) · 2.72 KB
/
qp_summary
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
#!/usr/bin/env bash
# Show Quartus Prime compilation summary
#
# It is requested for a Quartus revision if there are several of them
# Time-stamp: <2022-07-07 09:19:58>
if [ "$1" == '-h' ] || [ "$1" == '--help' ] || [ "$1" == '-help' ]; then
echo "Usage:"
echo " ${BASH_SOURCE##*/} [revision-file-number]"
echo
echo "ARGS:"
echo " <revision-file-number>"
echo " Quartus revision number."
exit 0
fi
RPT_FILE_NAME=""
REVISION_NAME="*"
select_file ()
{
cnt=1
for p in $(ls $OUTDIR*.fit.summary 2>/dev/null); do
rpt_file[$cnt]=$p
cnt=`expr $cnt + 1`
done
num_rpt_file=0
if [ -z "$1" ]; then
if [ ${#rpt_file[@]} -gt 0 ]; then
if [ ${#rpt_file[@]} -gt 1 ]; then
echo " report-files:"
for (( i=1; i<${#rpt_file[@]}+1; i++ )); do
echo "$i : ${rpt_file[${i}]}"
done
echo "Select revision:"
read -r num_rpt_file
fi
else
echo "ERROR! There must be at least one report-file!"
exit 2
fi
else
num_rpt_file="$1"
fi
if [ -s "${rpt_file[$num_rpt_file]}" ]; then
RPT_FILE_NAME=${rpt_file[$num_rpt_file]}
else
RPT_FILE_NAME=${rpt_file[1]}
if [ ${#rpt_file[@]} -gt 1 ]; then
echo "WARNING: will be open default revision(can't find selected file)"
fi
fi
# Get revision name:
# cut path from file name
RPT_FILE_NAME=${RPT_FILE_NAME##*/}
# cut suffix from file name
REVISION_NAME=${RPT_FILE_NAME%.*.*}
}
if [ "$(ls -A output_files 2>/dev/null)" ]; then
OUTDIR="./output_files/"
else
OUTDIR=""
fi
select_file "$1"
MSG="Fitter summary:"
printf "%b%s%b\n" "\e[32m" "$MSG" "\e[0m"
FMASK="$OUTDIR$REVISION_NAME"
SUMMARY=$(cat "$FMASK"*fit.summary 2>/dev/null)
echo "$SUMMARY"
if [ -n "$SUMMARY" ]; then
# End time and compile time:
echo "------------------------------------------"
START=$(cat "$FMASK"*.map.rpt 2>/dev/null | grep -e 'Processing started:' | sed 's/.*Processing started:\s-*//')
DONE=$(cat "$FMASK"*done 2>/dev/null)
START_TIME=$(echo $START | sed 's/\(.*\) \([0-9]\+:[0-9]\+:[0-9]\+\)\(.*\)/\2/')
DONE_TIME=$(echo $DONE | sed 's/\(.*\) \([0-9]\+:[0-9]\+:[0-9]\+\)\(.*\)/\2/')
START_DATE=$(date -u -d "$START_TIME" +"%s")
DONE_DATE=$(date -u -d "$DONE_TIME" +"%s")
DELTA=$(date -u -d "0 $DONE_DATE sec - $START_DATE sec" +"%H:%M:%S")
echo "Done : $DONE ($DELTA)"
else
echo "... there is nothing ..."
fi
# 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: