aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/run-vericert.sh
blob: 9deaa1022027d7406369088848f129ee6411d41a (plain)
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
#!/usr/bin/env bash

rm exec.csv

top=$(pwd)
#set up
while read benchmark ; do
   printf "%10s\t" $(echo "$benchmark" | sed -e 's|/| |g')
   ./$benchmark.gcc > $benchmark.clog
   cresult=$(cat $benchmark.clog | cut -d' ' -f2)
   #echo "C output: "$cresult
   #./$benchmark.iver > $benchmark.tmp
   if [[ ! -f ./$benchmark.verilator/Vmain ]]; then
      echo -e "\e[0;91mFAIL\e[0m: Verilog failed compilation"
      continue
   fi
   ./$benchmark.verilator/Vmain > $benchmark.tmp
   veriresult=$(tail -1 $benchmark.tmp | cut -d' ' -f2)
   cycles=$(tail -2 $benchmark.tmp | head -1 | tr -s ' ' | cut -d' ' -f2)
   #echo "Verilog output: "$veriresult

   #Undefined checks
   if [[ -z "$veriresult" ]]
   then
      echo "\e[0;91mFAIL\e[0m: Verilog returned nothing"
      #exit 0
   fi
   
   # Don't care checks
   if [[ $veriresult == "x" ]]
   then
      echo "\e[0;91mFAIL\e[0m: Verilog returned don't cares"
      #exit 0
   fi

   # unequal result check
   if [[ $cresult -ne $veriresult ]]
   then 
      echo -e "\e[0;91mFAIL\e[0m: Verilog and C output do not match!"
      #exit 0
   else 
      echo -e "\e[0;92mPASS\e[0m"
   fi
   name=$(echo $benchmark | awk -v FS="/" '{print $NF}')
   echo $name","$cycles >> exec.csv
done < benchmark-list-master