forked from RedPitaya/RedPitaya-FPGA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
synCheck.sh
executable file
·189 lines (150 loc) · 4.36 KB
/
synCheck.sh
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/bin/bash
# comon variables
RPT="SYNTHESIS REPORT: "
REPORT="synReport.txt"
# # # # # # #
# functions #
# # # # # # #
# initial lines to the report section with description as $1 argument
function startRprt {
TEXT=$1
SIZE=${#TEXT}
LINE=`printf "%.s"'-' $(eval "echo {1.."$((100-$SIZE))"}")`
echo "" >> $REPORT
echo "${TEXT}${LINE}" >> $REPORT
echo "" >> $REPORT
}
# last lines to the report sectoin
function endRprt {
LINE=`printf "%.s"'-' $(eval "echo {1.."$((100))"}")`
echo "" >> $REPORT
echo " ${LINE}" >> $REPORT
echo "" >> $REPORT
}
# test passes
function passed {
echo "PASSED" >> $REPORT
}
function fileMiss {
# user notification
echo "ERROR: file $1 not found!"
# to report file
echo "ERROR: file $1 not found!" >> $REPORT
}
# # # # # # # # #
# start report #
# # # # # # # # #
echo "# # # # # # # # # # # # # # # # # " > $REPORT
echo "# #" >> $REPORT
echo "# $RPT #" >> $REPORT
echo "# #" >> $REPORT
echo "# `date` # " >> $REPORT
echo "# #" >> $REPORT
echo "# # # # # # # # # # # # # # # # # " >> $REPORT
echo "" >> $REPORT
# # # # # # # # # # # # # # # # # # # # # # # #
# find sub-optimal timing INFOs in vivado.log #
# # # # # # # # # # # # # # # # # # # # # # # #
if [ -f "vivado.log" ]; then
GREP='grep -i "sub-optimal" vivado.log | sort | uniq'
SUBN=$(eval "$GREP | grep -i 'sub-optimal' -c")
if [[ $SUBN != 0 ]]; then
# user notification
echo "${RPT} WARNING: $SUBN sub-optimal timings detected!"
# to report file
startRprt "SUB-OPTIMAL TIMING"
echo "WARNING: $SUBN sub-optimal timings detected:">> $REPORT
echo "$(eval ${GREP})" >> $REPORT
endRprt
else
# user notification
echo "sub-optimal timing test - PASSED"
# to report file
passed
fi
else
fileMiss "vivado.log"
fi
# # # # # # # # # # # # # # # # # # # # # # #
# displays CRITICAL WARNING in report FILE #
# # # # # # # # # # # # # # # # # # # # # # #
if [ -f "vivado.log" ]; then
GREP='grep -i "CRITICAL WARNING:" vivado.log | sort | uniq'
SUBN=$(eval "$GREP | grep -i 'CRITICAL WARNING:' -c")
if [[ $SUBN != 0 ]]; then
# user notification
echo "${RPT} WARNING: $SUBN CRITICAL WARNING: timings detected!"
# to report file
startRprt "CRITICAL WARNINGs"
echo "WARNING: $SUBN CRITICAL WARNING timings detected:">> $REPORT
echo "$(eval ${GREP})" >> $REPORT
endRprt
else
# user notification
echo "CRITICAL WARNING timing test - PASSED"
# to report file
passed
fi
else
fileMiss "vivado.log"
fi
# # # # # # # # # # # # # # # # # # # # # # #
# displays violated timings in report FILE #
# # # # # # # # # # # # # # # # # # # # # # #
function grepTiming {
FILE=$1
if [ -f ${FILE} ]; then
GREP='grep -i "violated" ${FILE}'
SUBN=$(eval "$GREP | grep -i 'violated' -c")
startRprt "${FILE} timing violation test"
if [[ $SUBN != 0 ]]; then
# user notification
echo "${RPT} ERROR: $SUBN timing violations detected!"
# to report file
echo "$(eval grep -i "violated" ${FILE} -A 4)" >> $REPORT
else
# user notification
echo "timing violations test for ${FILE} - PASSED"
# to report file
passed
fi
endRprt
else
fileMiss ${FILE}
fi
}
# define report directory
FILEPATH="prj/v0.94/out/"
# check timing in synthesis, placement, route timing reports
grepTiming ${FILEPATH}post_synth_timing_summary.rpt
grepTiming ${FILEPATH}post_place_timing_summary.rpt
grepTiming ${FILEPATH}post_route_timing_summary.rpt
# # # # # # # # # # # #
# displays all errors #
# # # # # # # # # # # #
if [ -f "vivado.log" ]; then
GREP='grep -i "error:" vivado.log | sort | uniq'
SUBN=$(eval "$GREP | grep -i 'error:' -c")
if [[ $SUBN != 0 ]]; then
# user notification
echo "${RPT} ERROR: $SUBN errors detected!"
# to report file
startRprt "ERROR:"
echo "ERROR: $SUBN errors detected:">> $REPORT
echo "$(eval ${GREP})" >> $REPORT
endRprt
else
# user notification
echo "No other errors detected."
# to report file
passed
fi
else
fileMiss "vivado.log"
fi
# create backup file
n=0;
while [ -f ${REPORT}-$n ]; do
((++n));
done;
mv ${REPORT} ${REPORT}-$n