-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoverride_fmax.sh
executable file
·59 lines (50 loc) · 1.21 KB
/
override_fmax.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
#!/bin/bash
skip=0
if [[ -z $1 ]]
then
echo "Missing kernel file path!"
exit -1
else
path=$1
fi
if [[ -z $2 ]]
then
skip=1
else
fmax=$2
fi
( if [[ $skip -eq 0 ]]
then
if [[ -z `quartus_fit --version | grep "Pro"` ]]
then
file=`echo $path/scripts/post_flow.tcl`
else
file=`echo $path/scripts/post_flow_pr.tcl`
fi
# Wait for file to be generated by aoc
while [[ ! -f $file ]]
do
sleep 30
done
# Wait another 10 seconds to make sure the file is fully written to disk
sleep 10
orig=`cat $file | grep adjust_plls.*tcl`
if [[ -z "$orig" ]]
then
echo "Overriding Fmax: FAILURE!! (pattern not found)"
exit -1
fi
text=`echo "$orig" | sed 's/^[[:space:]]*//'`
indent=${orig%"$text"}
orig_fix=$(printf '%s\n' "$orig" | sed 's:[\/&]:\\&:g;$!s/$/\\/')
if [[ -z `cat $file | grep call_script_as_function` ]]
then
new=`echo -e "$indent""set argv [list -fmax $fmax]\n""$indent""set argc 2\n""$orig\n""$indent""unset argv\n""$indent""unset argc"`
else
cut=`echo $orig | cut -d " " -f 2`
new=`echo -e "$indent""call_script_as_function $cut -fmax $fmax"`
fi
new_fix=$(printf '%s\n' "$new" | sed 's:[\/&]:\\&:g;$!s/$/\\/')
sed -i "s/$orig_fix/$new_fix/" $file
echo "Overriding Fmax: SUCCESS!!"
fi ) &