50 lines
960 B
Bash
Executable File
50 lines
960 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
if ! which jq &> /dev/null
|
|
then
|
|
echo to get stastics, please install jq
|
|
exit 0
|
|
fi
|
|
|
|
REPORT_TYPE=brief
|
|
|
|
if [ $# == 0 ]
|
|
then
|
|
echo $0' [report type] <report json file>'
|
|
exit 1
|
|
elif [ $# == 2 ]
|
|
then
|
|
case "$1" in
|
|
"--brief")
|
|
REPORT_TYPE=brief
|
|
;;
|
|
*)
|
|
echo unkown parameter "\"$1\""
|
|
exit 1
|
|
;;
|
|
esac
|
|
REPORT=$2
|
|
else
|
|
REPORT=$1
|
|
fi
|
|
|
|
if ! [ -e "$REPORT" ]
|
|
then
|
|
echo file "\"${REPORT}\"" doesn\'t exist!
|
|
exit 1
|
|
fi
|
|
|
|
LUT_AVAIL=$(jq '.utilization.TRELLIS_COMB.available' "$REPORT" )
|
|
LUT_USED=$(jq '.utilization.TRELLIS_COMB.used' "$REPORT" )
|
|
FF_AVAIL=$(jq '.utilization.TRELLIS_FF.available' "$REPORT" )
|
|
FF_USED=$(jq '.utilization.TRELLIS_FF.used' "$REPORT" )
|
|
|
|
if [ "$REPORT_TYPE" == "brief" ]
|
|
then
|
|
printf '\e[1;30m'
|
|
echo Luts $LUT_USED/$LUT_AVAIL \($(echo "($LUT_USED*100)/$LUT_AVAIL"|bc -l|grep -o '^.*\..')%\)
|
|
echo Flip Flops $FF_USED/$FF_AVAIL \($(echo "($FF_USED*100)/$FF_AVAIL"|bc -l|grep -o '^.*\..')%\)
|
|
printf '\e[0m'
|
|
fi
|