Skip to content

Commit

Permalink
Use allow list in verible formatter script
Browse files Browse the repository at this point in the history
For now it contains only files unchanged by the formatter.

Signed-off-by: Rafal Kapuscik <[email protected]>
  • Loading branch information
Rafal Kapuscik committed Apr 13, 2021
1 parent 71174e0 commit 5473c34
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
18 changes: 18 additions & 0 deletions util/verible-format-allowlist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright lowRISC contributors.
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
# SPDX-License-Identifier: Apache-2.0
#
# This is a list of files to be passed to Verible formatter
# by calling verible-format.sh

hw/ip/adc_ctrl/dv/tests/adc_ctrl_test_pkg.sv
hw/ip/adc_ctrl/dv/env/adc_ctrl_env_pkg.sv
hw/ip/gpio/dv/tests/gpio_test_pkg.sv
hw/ip/adc_ctrl/dv/env/seq_lib/adc_ctrl_vseq_list.sv
hw/ip/adc_ctrl/dv/env/seq_lib/adc_ctrl_smoke_vseq.sv
hw/ip/prim_xilinx/rtl/prim_xilinx_buf.sv
hw/ip/pwm/dv/tests/pwm_test_pkg.sv
hw/ip/pwm/dv/env/pwm_env_pkg.sv
hw/ip/pwm/dv/env/seq_lib/pwm_smoke_vseq.sv
hw/ip/pwm/dv/env/seq_lib/pwm_vseq_list.sv
hw/ip/gpio/dv/env/seq_lib/gpio_vseq_list.sv
30 changes: 24 additions & 6 deletions util/verible-format.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ VERIBLE_ARGS="--formal_parameters_indentation=indent \
--port_declarations_indentation=indent \
--inplace"

if [ -z $VERIBLE_VERSION ]; then
if [[ -z $VERIBLE_VERSION ]]; then
echo "verible-verilog-format either not installed or not visible in PATH"
exit 1
fi
Expand All @@ -31,13 +31,31 @@ fi
# overwriting of uncomitted changes
git add -u

# get all system verilog files and pipe through style formatter
find . -type f -name "*.sv" -o -name "*.svh" | \
xargs -n 1 -P $NUM_PROCS verible-verilog-format \
$VERIBLE_ARGS
# By default format only files in allow list
MODE=${MODE:-allowlist}

case $MODE in
allowlist)
FILES_TO_FORMAT=`grep -v '^#' util/verible-format-allowlist.txt`
;;

echo "Usign verible-verilog-format version $VERIBLE_VERSION" > $REPORT_FILE
all)
# get all system verilog files and pipe through style formatter
FILES_TO_FORMAT=`find . -type f -name "*.sv" -o -name "*.svh"`
;;

*)
echo "verible-format.sh: Unknown mode $MODE"
exit 1
;;
esac

echo $FILES_TO_FORMAT | \
xargs -n 1 -P $NUM_PROCS verible-verilog-format \
$VERIBLE_ARGS


echo "Using verible-verilog-format version $VERIBLE_VERSION" > $REPORT_FILE

# report changed files
git status | \
Expand Down

0 comments on commit 5473c34

Please sign in to comment.