blob: 27adf36f92cd287cac33aea54c170930d00c3433 [file] [log] [blame]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001#!/bin/bash
2
3# Copyright lowRISC contributors.
4# Licensed under the Apache License, Version 2.0, see LICENSE for details.
5# SPDX-License-Identifier: Apache-2.0
6
7# to run cdc-lint on all modules, type
8# cdc_lint_all
9
10#-------------------------------------------------------------------------
11# list all blocks
12#-------------------------------------------------------------------------
13declare -a blocks=(
14 "prim_fifo_async"
15 "prim_pulse_sync"
16 "gpio"
17 "rv_core_ibex"
18 "rv_dm"
19 "rv_plic"
20 "spi_device"
21 "rv_timer"
22 "uart"
23 "hmac"
24 "flash_ctrl"
25 "usbuart"
26 "usbdev"
27 "usb_fs_nb_pe"
28 "tlul_adapter_sram"
29 "tlul_socket_1n"
30 "tlul_socket_m1"
31 "sram2tlul"
32 "xbar_main"
33 "top_earlgrey"
34)
35
36#-------------------------------------------------------------------------
37# print header
38#-------------------------------------------------------------------------
39printf "CDC LINT REPORT:\n\n"
40format="%20s %10s %10s %10s \n"
41printf "${format}" "Block" "Clocks" "Crossings" "Warnings"
42echo "------------------------------------------------------"
43
44#-------------------------------------------------------------------------
45# run cdc-lint (meridian) and summarize results
46#-------------------------------------------------------------------------
47\rm -Rf build meridian_project cdc*.log cdc*.rpt
48
49for block in "${blocks[@]}" ; do
50
51 cdc_lint $block > /dev/null 2>&1
52 cp cdc.rpt cdc_${block}.rpt
53 cp cdc.log cdc_${block}.log
54
55 # summarize results
56 crash=`grep "^ ERR" cdc.log`
57 if [ $? -eq 0 ]; then
58 printf "${format}" $block "CRASH"
59 else
60 clocks=`grep "Total Async" cdc.log | cut -d":" -f2`
61 cross=`grep "Total crossings detected" cdc.log | cut -d" " -f4 | cut -d"," -f1`
62 warns=`grep "Total warnings found" cdc.log | cut -d":" -f2`
63 printf "${format}" $block $clocks $cross $warns
64 fi
65done
66
67#-------------------------------------------------------------------------
68# generate detailed reports
69#-------------------------------------------------------------------------
70printf "\n\nLIST OF WARNINGS FOR EACH BLOCK:"
71for block in "${blocks[@]}" ; do
72 printf "\n\n${block}\n"
73 grep "^W_" cdc_${block}.rpt | cut -d";" -f1
74done