| #!/bin/bash |
| |
| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| # to run cdc-lint on all modules, type |
| # cdc_lint_all |
| |
| #------------------------------------------------------------------------- |
| # list all blocks |
| #------------------------------------------------------------------------- |
| declare -a blocks=( |
| "prim_fifo_async" |
| "prim_pulse_sync" |
| "gpio" |
| "rv_core_ibex" |
| "rv_dm" |
| "rv_plic" |
| "spi_device" |
| "rv_timer" |
| "uart" |
| "hmac" |
| "flash_ctrl" |
| "usbuart" |
| "usbdev" |
| "usb_fs_nb_pe" |
| "tlul_adapter_sram" |
| "tlul_socket_1n" |
| "tlul_socket_m1" |
| "sram2tlul" |
| "xbar_main" |
| "top_earlgrey" |
| ) |
| |
| #------------------------------------------------------------------------- |
| # print header |
| #------------------------------------------------------------------------- |
| printf "CDC LINT REPORT:\n\n" |
| format="%20s %10s %10s %10s \n" |
| printf "${format}" "Block" "Clocks" "Crossings" "Warnings" |
| echo "------------------------------------------------------" |
| |
| #------------------------------------------------------------------------- |
| # run cdc-lint (meridian) and summarize results |
| #------------------------------------------------------------------------- |
| \rm -Rf build meridian_project cdc*.log cdc*.rpt |
| |
| for block in "${blocks[@]}" ; do |
| |
| cdc_lint $block > /dev/null 2>&1 |
| cp cdc.rpt cdc_${block}.rpt |
| cp cdc.log cdc_${block}.log |
| |
| # summarize results |
| crash=`grep "^ ERR" cdc.log` |
| if [ $? -eq 0 ]; then |
| printf "${format}" $block "CRASH" |
| else |
| clocks=`grep "Total Async" cdc.log | cut -d":" -f2` |
| cross=`grep "Total crossings detected" cdc.log | cut -d" " -f4 | cut -d"," -f1` |
| warns=`grep "Total warnings found" cdc.log | cut -d":" -f2` |
| printf "${format}" $block $clocks $cross $warns |
| fi |
| done |
| |
| #------------------------------------------------------------------------- |
| # generate detailed reports |
| #------------------------------------------------------------------------- |
| printf "\n\nLIST OF WARNINGS FOR EACH BLOCK:" |
| for block in "${blocks[@]}" ; do |
| printf "\n\n${block}\n" |
| grep "^W_" cdc_${block}.rpt | cut -d";" -f1 |
| done |