lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # to run JasperGold FPV on all modules, type |
| 4 | # fpv_all |
| 5 | |
Cindy Chen | c5fb426 | 2020-04-09 13:01:59 -0700 | [diff] [blame] | 6 | tool="jg" |
| 7 | while [ "$1" != "" ]; do |
| 8 | case "$1" in |
| 9 | "-t") |
| 10 | shift |
| 11 | tool=$1 |
| 12 | ;; |
| 13 | esac |
| 14 | shift |
| 15 | done |
| 16 | |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 17 | #------------------------------------------------------------------------- |
| 18 | # list all blocks |
| 19 | #------------------------------------------------------------------------- |
| 20 | declare -a blocks=( |
Cindy Chen | 531ae5a | 2020-06-05 09:59:50 -0700 | [diff] [blame] | 21 | "alert_handler" |
| 22 | "aes" |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 23 | "gpio" |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 24 | "flash_ctrl" |
Cindy Chen | 531ae5a | 2020-06-05 09:59:50 -0700 | [diff] [blame] | 25 | "hmac" |
Cindy Chen | 872edb7 | 2020-05-18 21:44:26 -0700 | [diff] [blame] | 26 | "otp_ctrl" |
Cindy Chen | e89bc96 | 2020-04-27 21:18:15 -0700 | [diff] [blame] | 27 | "pwrmgr" |
Cindy Chen | 531ae5a | 2020-06-05 09:59:50 -0700 | [diff] [blame] | 28 | "rv_core_ibex" |
| 29 | "rv_dm" |
| 30 | "rv_timer" |
| 31 | "spi_device" |
| 32 | "uart" |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 33 | "usbdev" |
Cindy Chen | 531ae5a | 2020-06-05 09:59:50 -0700 | [diff] [blame] | 34 | "usbuart" |
Cindy Chen | de3b010 | 2020-01-17 10:55:43 -0800 | [diff] [blame] | 35 | #"top_earlgrey" |
Michael Schaffner | d0fdd73 | 2019-09-19 17:45:07 -0700 | [diff] [blame] | 36 | # run formal on dedicated FPV testbenches |
Michael Schaffner | 8e1d093 | 2020-01-24 18:13:36 -0800 | [diff] [blame] | 37 | "prim_arbiter_ppc_fpv" |
| 38 | "prim_arbiter_tree_fpv" |
Michael Schaffner | 7008042 | 2020-06-16 15:08:37 -0700 | [diff] [blame] | 39 | "prim_arbiter_fixed_fpv" |
Cindy Chen | 8c725d4 | 2019-11-14 09:33:18 -0800 | [diff] [blame] | 40 | "prim_alert_rxtx_fpv" |
| 41 | "prim_alert_rxtx_async_fpv" |
| 42 | "prim_esc_rxtx_fpv" |
Cindy Chen | 531ae5a | 2020-06-05 09:59:50 -0700 | [diff] [blame] | 43 | "prim_lfsr_fpv" |
| 44 | "prim_fifo_sync_fpv" |
Cindy Chen | 496b90f | 2020-06-07 17:57:13 -0700 | [diff] [blame] | 45 | "prim_packer_fpv" |
Cindy Chen | 8c725d4 | 2019-11-14 09:33:18 -0800 | [diff] [blame] | 46 | "pinmux_fpv" |
| 47 | "padctrl_fpv" |
| 48 | "rv_plic_fpv" |
Cindy Chen | c30dad2 | 2020-03-19 13:26:13 -0700 | [diff] [blame] | 49 | "rv_plic_generic_fpv" |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 50 | ) |
| 51 | |
| 52 | #------------------------------------------------------------------------- |
| 53 | # print header |
| 54 | #------------------------------------------------------------------------- |
| 55 | printf "FPV RESULTS PER BLOCK\n" |
| 56 | printf "Below table shows the total number of assertions, and\n" |
| 57 | printf "the percentages of covered and proven assertions.\n\n" |
Cindy Chen | de3b010 | 2020-01-17 10:55:43 -0800 | [diff] [blame] | 58 | format1="%28s %10s %10s %10s \n" |
| 59 | format2="%28s %10s %9.0f%% %9.0f%% \n" |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 60 | printf "${format1}" "Block" "Asserts" "Covered" "Proven" |
Cindy Chen | 1860473 | 2020-01-28 09:50:40 -0800 | [diff] [blame] | 61 | echo "-----------------------------------------------------------------" |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 62 | |
| 63 | #------------------------------------------------------------------------- |
| 64 | # run fpv and summarize results |
| 65 | #------------------------------------------------------------------------- |
| 66 | \rm -Rf fpv_*.log |
| 67 | |
| 68 | for block in "${blocks[@]}" ; do |
| 69 | |
Cindy Chen | c5fb426 | 2020-04-09 13:01:59 -0700 | [diff] [blame] | 70 | ./fpv $block -t ${tool} > /dev/null 2>&1 |
lowRISC Contributors | 802543a | 2019-08-31 12:12:56 +0100 | [diff] [blame] | 71 | cp fpv.log fpv_${block}.log |
| 72 | |
| 73 | # summarize results |
| 74 | crash=`grep "ERROR" fpv.log` |
| 75 | if [ $? -eq 0 ]; then |
| 76 | printf "${format1}" $block "CRASH" |
| 77 | else |
| 78 | asserts=`grep " assertions " fpv.log | cut -d":" -f2 | cut -d"(" -f1` |
| 79 | covered=`grep " - covered " fpv.log | cut -d"(" -f2 | cut -d"%" -f1` |
| 80 | proven=`grep " - proven " fpv.log | cut -d"(" -f2 | cut -d"%" -f1` |
| 81 | printf "${format2}" $block $asserts $covered $proven |
| 82 | fi |
| 83 | done |
| 84 | |
| 85 | #------------------------------------------------------------------------- |
| 86 | # print errors |
| 87 | #------------------------------------------------------------------------- |
| 88 | printf "\n\nLIST OF ERRORS AND UNPROVEN ASSERTIONS FOR EACH BLOCK:" |
| 89 | printf "\nNote: \"cex\" below indicates that JasperGold found a" |
| 90 | printf "\n\"counter example\", which could be caused by an RTL" |
| 91 | printf "\nbug or a missing assume property on an input." |
| 92 | |
| 93 | for block in "${blocks[@]}" ; do |
| 94 | printf "\n\n${block}\n" |
| 95 | grep "ERROR" fpv_${block}.log |
| 96 | |
| 97 | # print uncovered and unproven assertions |
| 98 | grep "^\[[1-9]" fpv_${block}.log | egrep -v " (proven|covered) " |
| 99 | done |