File tree Expand file tree Collapse file tree 3 files changed +68
-12
lines changed Expand file tree Collapse file tree 3 files changed +68
-12
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
- function fail()
4
- {
5
- echo " *** Fail"
6
- exit 1
7
- }
3
+ source tests/common.sh
8
4
9
- O=build
10
5
S=tests/cc
11
- RUN=$O /rv32emu
12
-
13
- if [ ! -f $RUN ]; then
14
- echo " No build/rv32emu found!"
15
- exit 1
16
- fi
17
6
18
7
echo " Generating cross compiler..."
19
8
cat $S /stdlib.c $S /emit.c $S /cc.c | cc -o $O /cc-native -x c - || fail
Original file line number Diff line number Diff line change
1
+ function fail()
2
+ {
3
+ echo " *** Fail"
4
+ exit 1
5
+ }
6
+
7
+ O=build
8
+ RUN=$O /rv32emu
9
+
10
+ if [ ! -f $RUN ]; then
11
+ echo " No build/rv32emu found!"
12
+ exit 1
13
+ fi
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ source tests/common.sh
4
+
5
+ num_runs=10
6
+
7
+ function run_dhrystone()
8
+ {
9
+ # Run Dhrystone and extract the DMIPS value
10
+ # output=$($RUN $O/dhrystone.elf)
11
+ # dmips=$(echo "$output" | grep -oE '[0-9]+' | awk 'NR==5{print}')
12
+ # echo "$dmips"
13
+ output=$( $RUN $O /dhrystone.elf 2>&1 )
14
+ local exit_code=$?
15
+ [ $exit_code -ne 0 ] && fail
16
+ dmips=$( echo " $output " | grep -oE ' [0-9]+' | awk ' NR==5{print}' )
17
+ echo " $dmips "
18
+ }
19
+
20
+ # Run Dhrystone benchmark and collect DMIPS values
21
+ dmips_values=()
22
+ for (( i= 1 ; i<= $num_runs ; i++ ))
23
+ do
24
+ echo " Running Dhrystone benchmark - Run $i "
25
+ dmips=$( run_dhrystone)
26
+ exit_code=$?
27
+ [ $exit_code -ne 0 ] && fail
28
+ dmips_values+=(" $dmips " )
29
+ done
30
+
31
+ # Filter out non-numeric values
32
+ filtered_dmips=()
33
+ for dmips in " ${dmips_values[@]} "
34
+ do
35
+ if [[ $dmips =~ ^[0-9]+$ ]]; then
36
+ filtered_dmips+=(" $dmips " )
37
+ fi
38
+ done
39
+
40
+ # Calculate average DMIPS excluding outliers
41
+ num_filtered=${# filtered_dmips[@]}
42
+ if (( num_filtered > 0 )) ; then
43
+ total_filtered_dmips=0
44
+ for dmips in " ${filtered_dmips[@]} "
45
+ do
46
+ total_filtered_dmips=$( echo " $total_filtered_dmips + $dmips " | bc -l)
47
+ done
48
+ average_filtered_dmips=$( echo " scale=2; $total_filtered_dmips / $num_filtered " | bc -l)
49
+ echo " ---------------------"
50
+ echo " Average DMIPS (Excluding Outliers): $average_filtered_dmips "
51
+ echo " ---------------------"
52
+ else
53
+ fail
54
+ fi
You can’t perform that action at this time.
0 commit comments