-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·84 lines (69 loc) · 2.67 KB
/
build.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
#!/bin/bash
rm -rf impl/pnr
rm -rf impl/tmp
rm -rf impl/gwsynthesis
attempt_build() {
stdbuf -o0 /mnt/c/Gowin/Gowin_V1.9.10.03_x64/IDE/bin/gw_sh.exe tn_vdp.tcl | \
stdbuf -o0 grep --color=always -e "Bitstream generation completed" -e ERROR -e completed -e WARN -e "Undeclared symbol" | \
stdbuf -o0 grep --color=always -v "PA1001" | \
stdbuf -o0 grep --color=always -v "NL0002" | \
stdbuf -o0 grep --color=always -v "Generic routing resource will be used to clock signal 'clk_d'" | \
stdbuf -o0 grep --color=always -v "Can't calculate clocks' relationship between: \"clk_audio\" and \"clk_w\""
}
counter=0
while [[ $counter -lt 4 ]]
do
counter=$((counter+1))
attempt_build
if [ ! -f impl/gwsynthesis/project.log ]; then
echo "impl/gwsynthesis/project.log does not exists, retrying..."
continue
fi
if grep -q ERROR impl/gwsynthesis/project.log; then
exit 1
fi
if [ ! -f impl/pnr/project.log ]; then
echo "impl/pnr/project.log does not exists, retrying..."
continue
fi
if grep -q ERROR impl/pnr/project.log; then
exit 1
fi
if [ ! -f impl/pnr/project.tr ]; then
echo "project.tr does not exists, retrying..."
continue
fi
break
done
if [[ $counter -eq 4 ]]
then
echo "Build tool has crashed after 3 attempts. Exiting..."
exit 1
fi
echo ""
echo "Timing Viloations:"
grep -e "<Numbers of Falling Endpoints>" \
-e "<Numbers of Setup Violated Endpoints>" \
-e "<Numbers of Hold Violated Endpoints>" \
impl/pnr/project.tr | sed 's/<//g; s/>//g' | sed -r 's/:([0-9]+)/: \x1b[31m\1\x1b[0m/g' | sed 's/^/ /'
# will produce a output like:
#
# Numbers of Falling Endpoints:0
# Numbers of Setup Violated Endpoints:15
# Numbers of Hold Violated Endpoints:1
# echo ""
# echo "Max Frequency Summary:"
# echo ""
# echo " NO. Clock Name Constraint Actual Fmax Level Entity"
# echo " ===== ============== ============== ============== ======= ========"
# awk '/2.3 Max Frequency Summary/{flag=1;next}/2.4 Total Negative Slack Summary/{flag=0}flag' impl/pnr/project.tr | grep -P '^\s*\d'
# will produce a output like:
# NO. Clock Name Constraint Actual Fmax Level Entity
# ===== ============== ============== ============== ======= ========
# 1 clk_w 27.000(MHz) 66.906(MHz) 14 TOP
# 2 clk_135 135.000(MHz) 229.104(MHz) 6 TOP
# 3 clk_135_w 135.000(MHz) 229.104(MHz) 6 TOP
# 4 clk_sdramp 108.000(MHz) 134.816(MHz) 7 TOP
# 5 clk_sdramp_w 108.000(MHz) 134.816(MHz) 7 TOP
# 6 clk_sdram 108.000(MHz) 787.468(MHz) 2 TOP
# 7 clk_audio 0.044(MHz) 437.607(MHz) 3 TOP