2021-05-03 21:32:05 +00:00
|
|
|
#!/bin/bash
|
2021-01-27 11:40:26 +00:00
|
|
|
# check for warnings in Verilog code
|
2024-01-29 22:51:21 +00:00
|
|
|
# The verilator lint tool is faster and better than Questa so it is best to run this first.
|
2024-09-14 13:38:01 +00:00
|
|
|
# SPDX-License-Identifier: Apache-2.0 WITH SHL-2.1
|
2024-01-31 19:39:59 +00:00
|
|
|
|
2021-05-24 22:11:56 +00:00
|
|
|
export PATH=$PATH:/usr/local/bin/
|
|
|
|
verilator=`which verilator`
|
2021-01-27 11:40:26 +00:00
|
|
|
|
2021-10-23 13:15:26 +00:00
|
|
|
basepath=$(dirname $0)/..
|
2024-02-01 04:03:14 +00:00
|
|
|
RED='\033[0;31m'
|
|
|
|
GREEN='\033[0;32m'
|
|
|
|
NC='\033[0m' # No Color
|
|
|
|
fails=0
|
2024-01-31 19:39:59 +00:00
|
|
|
|
2024-04-17 03:57:49 +00:00
|
|
|
if [ "$1" == "--nightly" ]; then
|
2024-06-20 07:10:03 +00:00
|
|
|
configs=(rv32e rv64gc rv32gc rv32imc rv32i rv64i)
|
2024-01-31 19:39:59 +00:00
|
|
|
derivconfigs=`ls $WALLY/config/deriv`
|
|
|
|
for entry in $derivconfigs
|
|
|
|
do
|
2024-02-01 04:03:14 +00:00
|
|
|
if [[ $entry != *"syn_sram"* ]]; then # ignore syn_sram* configs that contain undefined module
|
|
|
|
configs[${#configs[@]}]=$entry
|
|
|
|
fi
|
2024-01-31 19:39:59 +00:00
|
|
|
done
|
|
|
|
else
|
2024-06-20 07:10:03 +00:00
|
|
|
configs=(rv32e rv64gc rv32gc rv32imc rv32i rv64i fdqh_rv64gc)
|
2024-01-31 19:39:59 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
for config in ${configs[@]}; do
|
2024-02-01 04:03:14 +00:00
|
|
|
# echo "$config linting..."
|
2024-06-18 13:23:43 +00:00
|
|
|
if !($verilator --lint-only --quiet --top-module wallywrapper \
|
|
|
|
"-I$basepath/config/shared" "-I$basepath/config/$config" "-I$basepath/config/deriv/$config" \
|
|
|
|
$basepath/src/cvw.sv $basepath/testbench/wallywrapper.sv $basepath/src/*/*.sv $basepath/src/*/*/*.sv \
|
2024-11-16 20:35:37 +00:00
|
|
|
-Wall -Wno-UNUSEDSIGNAL -Wno-VARHIDDEN -Wno-GENUNNAMED -Wno-PINCONNECTEMPTY); then
|
2024-02-01 04:03:14 +00:00
|
|
|
if [ "$1" == "-nightly" ]; then
|
|
|
|
echo -e "${RED}$config failed lint${NC}"
|
2024-02-01 04:24:16 +00:00
|
|
|
fails=$((fails+1))
|
2024-02-01 04:03:14 +00:00
|
|
|
else
|
|
|
|
echo -e "${RED}$config fails with lint errors or warnings"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo -e "${GREEN}$config passed lint${NC}"
|
2021-04-29 18:48:41 +00:00
|
|
|
fi
|
|
|
|
done
|
2024-02-06 20:35:56 +00:00
|
|
|
if [ $fails -gt 0 ]; then
|
2024-02-01 04:24:16 +00:00
|
|
|
echo -e "${RED}Linting failed for $fails of ${#configs[@]} configurations"
|
2024-02-01 04:03:14 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2024-02-01 04:24:16 +00:00
|
|
|
echo -e "${GREEN}All ${#configs[@]} lints run with no errors or warnings"
|
2021-01-27 11:40:26 +00:00
|
|
|
|
|
|
|
# --lint-only just runs lint rather than trying to compile and simulate
|
2023-10-18 12:38:36 +00:00
|
|
|
# -I points to the include directory where files such as `include config.vh are found
|
2021-01-27 11:40:26 +00:00
|
|
|
|
2021-10-25 17:05:41 +00:00
|
|
|
# For more exhaustive (and sometimes spurious) warnings, add --Wall to the Verilator command
|
2024-06-18 15:15:48 +00:00
|
|
|
# verilator --lint-only -Wall --quiet --top-module wallywrapper -Iconfig/shared -Iconfig/rv64gc src/cvw.sv testbench/wallywrapper.sv src/*/*.sv src/*/*/*.sv -Wno-UNUSEDPARAM -Wno-VARHIDDEN -Wno-GENUNNAMED -Wno-PINCONNECTEMPTY
|
2021-01-27 11:40:26 +00:00
|
|
|
# Unfortunately, this produces a bunch of UNUSED and UNDRIVEN signal warnings in blocks that are configured to not exist.
|