-
Notifications
You must be signed in to change notification settings - Fork 5
/
script.sh
78 lines (66 loc) · 1.53 KB
/
script.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
#!/bin/bash
wait_for_result () {
local result
{
ghdl $@ &&
result="OK"
} || {
check_result="Failed"
}
echo "$result"
}
wait_for_build () {
local result
{
ghdl -e $1 &&
result="OK"
} || {
check_result="Failed"
}
echo "$result"
}
wait_for_dump () {
local result
{
ghdl -r $1 --vcd=$2 &&
result="OK"
} || {
check_result="Failed"
}
echo "$result"
}
for file in "$@"
do
filename="$(basename -- $file)"
filepath="${file%/$filename}/"
syntax_check_result="$(wait_for_result -s $file)"
echo "$file: Syntax-Check $syntax_check_result"
if [ "$syntax_check_result" = "Failed" ]; then
exit
fi
analyse_check_result="$(wait_for_result -a $file)"
echo "$file: Analyse-Check $analyse_check_result"
if [ "$analyse_check_result" = "Failed" ]; then
exit
fi
entity="$(grep -o -P '(?<=entity ).*(?= is)' $file)"
build_result="$(wait_for_build $entity)"
echo "$file $entity: Build $build_result"
if [ "$build_result" = "Failed" ]; then
exit
fi
done
for file in "${!#}"
do
filename="$(basename -- $file)"
filepath="${file%/$filename}/"
entity="$(grep -o -P '(?<=entity ).*(?= is)' $file)"
dump_result="$(wait_for_dump $entity $entity.vcd)"
echo "$file $entity: VCD-Dump $dump_result"
if [ "$dump_result" = "Failed" ]; then
exit
fi
echo "Startet GTKWave"
gtkwave "$entity.vcd"
exit
done