aboutsummaryrefslogtreecommitdiffstats
path: root/benchmarks/polybench-syn/syn-vivado.sh
blob: 2b310cb17089283813957f1fafbe79cc7dee1597 (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
47
48
49
50
51
52
53
54
55
56
#! /bin/bash

#setup
while read -r benchmark; do
  echo "Setting up $benchmark"
  rm -r "$benchmark-vivado"
  mkdir "$benchmark-vivado"
  cp "$benchmark.v" "$benchmark-vivado/top.v"
done < syn-list

#synthesis
count=0
while read -r benchmark; do
  echo "Synthesising $benchmark"

  cd "$benchmark-vivado" || {
    echo "$benchmark dir does not exist"
    continue
  }
  vivado -mode batch -source ../syn-vivado.tcl
  cd ..
  (( count=count+1 ))

  if [ "$count" -eq 4 ]; then
  echo "I am here"
  wait
  count=0
  fi
done < syn-list

if [ $count -lt 4 ]; then
wait
fi

#extract
while read -r benchmark ; do
  cd "$benchmark-vivado" || {
    echo "$benchmark-vivado does not exist"
    continue
  }

  pwd
  logfile="vivado.log"
  timingfile="worst_timing.txt"

  luts=$(grep "|LUT" "$logfile" | cut -d'|' -f 4 | paste -sd + | bc)
  brams=$(sed -n -e "s/BRAMs: \([0-9]\+\).*$/\1/p" "$logfile")
  dsps=$(sed -n -e "s/DSPs: \([0-9]\+\).*$/\1/p" "$logfile")
  cells=$(grep -A4 "Report Instance Areas:" "$logfile" | tail -1 | cut -d '|' -f5 | tr -d [:space:])
  slack=$(sed -n -e 's/\s\+slack\s\+\(-\?[0-9.]\+\)/\1ns/p' "$timingfile" | tr -d [:space:])

  cd ..

  echo "$benchmark,$slack,$luts,$brams,$dsps" >> results
done < syn-list