[85] | 1 | #!/bin/bash |
---|
| 2 | |
---|
[82] | 3 | #----------------------------------------------------------- |
---|
| 4 | # $Id: xilinx_extract_info.sh 138 2010-05-12 17:34:01Z rosiere $ |
---|
| 5 | #----------------------------------------------------------- |
---|
[71] | 6 | |
---|
[100] | 7 | ##-----[ usage ]--------------------------------------------- |
---|
| 8 | #function usage () |
---|
| 9 | #{ |
---|
| 10 | # echo "Usage : ${0} [files]"; |
---|
| 11 | # echo "Arguments : "; |
---|
| 12 | # echo ' * files : lists of files. If empty, take *.fpga.log'; |
---|
| 13 | ## echo "Notes :"; |
---|
| 14 | ## echo " * Morpheo's environnement must be positionned."; |
---|
| 15 | # |
---|
| 16 | # exit; |
---|
| 17 | #} |
---|
| 18 | |
---|
[138] | 19 | #-----[ xilinx_extract_info_usage ]------------------------- |
---|
| 20 | function xilinx_extract_info_usage() |
---|
[100] | 21 | { |
---|
[138] | 22 | echo "${0} option [files]"; |
---|
| 23 | echo "Arguments : "; |
---|
| 24 | echo ' * files : lists of files. If empty, take *.fpga.log'; |
---|
| 25 | echo " * -s : print summary section"; |
---|
| 26 | echo " * -t : print timing section"; |
---|
| 27 | exit 1; |
---|
[100] | 28 | } |
---|
| 29 | |
---|
[138] | 30 | #-----[ xilinx_extract_info_summary ]----------------------- |
---|
| 31 | function xilinx_extract_info_summary () |
---|
| 32 | { |
---|
| 33 | summary_line_begin=$(grep -n "Device utilization summary:" ${1} | cut -d : -f 1); |
---|
| 34 | summary_line_end=$(grep -n "Partition Resource Summary:" ${1} | cut -d : -f 1); |
---|
| 35 | |
---|
| 36 | head -n $(($summary_line_end-1)) ${1} | tail -n $(($summary_line_end-$summary_line_begin)); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | #-----[ xilinx_extract_info_timing ]------------------------ |
---|
| 40 | function xilinx_extract_info_timing () |
---|
| 41 | { |
---|
| 42 | timing_line_begin=$(grep -n "Timing Summary:" ${1} | cut -d : -f 1); |
---|
| 43 | timing_line_end=$(grep -n "Timing Detail:" ${1} | cut -d : -f 1); |
---|
| 44 | |
---|
| 45 | head -n $(($timing_line_end-1)) ${1} | tail -n $(($timing_line_end-$timing_line_begin)); |
---|
| 46 | } |
---|
| 47 | |
---|
[100] | 48 | #-----[ main ]---------------------------------------------- |
---|
[138] | 49 | function xilinx_extract_info() |
---|
[100] | 50 | { |
---|
[138] | 51 | local summary=0; |
---|
| 52 | local timing=0; |
---|
| 53 | local nb_params=$#; |
---|
| 54 | set -- $(getopt :tsh "$@") |
---|
| 55 | for arg |
---|
| 56 | do case "$arg" in |
---|
| 57 | -t) timing=1; nb_params=$((nb_params-1));; |
---|
| 58 | -s) summary=1; nb_params=$((nb_params-1));; |
---|
| 59 | -h) xilinx_extract_info_usage ${*}; break;; |
---|
| 60 | --) if test ${summary} -eq 0 -a ${timing} -eq 0; then |
---|
| 61 | summary=1; |
---|
| 62 | timing=1; |
---|
| 63 | fi; |
---|
| 64 | |
---|
| 65 | esac |
---|
| 66 | done |
---|
| 67 | |
---|
| 68 | echo $nb_params; |
---|
| 69 | if test $nb_params -eq 0; then |
---|
[100] | 70 | files="*.fpga.log"; |
---|
| 71 | else |
---|
| 72 | files="$*"; |
---|
| 73 | fi; |
---|
| 74 | |
---|
| 75 | for i in $files; do |
---|
[138] | 76 | if test -f ${i}; then |
---|
| 77 | echo "===================| ${i}"; |
---|
| 78 | |
---|
| 79 | if test ${summary} -ne 0; then |
---|
| 80 | xilinx_extract_info_summary $i; |
---|
| 81 | fi; |
---|
| 82 | if test ${timing} -ne 0; then |
---|
| 83 | xilinx_extract_info_timing $i; |
---|
| 84 | fi; |
---|
| 85 | fi; |
---|
[100] | 86 | done |
---|
| 87 | } |
---|
| 88 | |
---|
| 89 | #-----[ Corps ]--------------------------------------------- |
---|
[138] | 90 | xilinx_extract_info ${*} |
---|
[100] | 91 | |
---|