[lint] Add Verible configuration file and update parsing script
Signed-off-by: Michael Schaffner <msf@opentitan.org>
diff --git a/hw/lint/common.core b/hw/lint/common.core
index f7ce7f7..77e87c7 100644
--- a/hw/lint/common.core
+++ b/hw/lint/common.core
@@ -15,6 +15,10 @@
- tools/ascentlint/common.waiver: {file_type: waiver}
- tools/ascentlint/ascentlint-config.tcl: {file_type: tclSource}
+ files_veriblelint:
+ files:
+ - tools/veriblelint/rules.vbl: {file_type: veribleLintRules}
+
files_check_tool_requirements:
depend:
- lowrisc:tool:check_tool_requirements
@@ -22,6 +26,7 @@
targets:
default: &default_target
filesets:
- - tool_verilator ? (files_verilator)
- - tool_ascentlint ? (files_ascentlint)
+ - tool_verilator ? (files_verilator)
+ - tool_ascentlint ? (files_ascentlint)
+ - tool_veriblelint ? (files_veriblelint)
- files_check_tool_requirements
diff --git a/hw/lint/data/lint.mk b/hw/lint/data/lint.mk
index a3628a0..584541b 100644
--- a/hw/lint/data/lint.mk
+++ b/hw/lint/data/lint.mk
@@ -19,7 +19,7 @@
compile: pre_compile
@echo "[make]: compile"
# we check the status in the parse script below
- -cd ${build_dir} && ${build_cmd} ${build_opts} | tee ${build_log}
+ -cd ${build_dir} && ${build_cmd} ${build_opts} 2>&1 | tee ${build_log}
post_compile: compile
@echo "[make]: post_compile"
diff --git a/hw/lint/tools/veriblelint/parse-lint-report.py b/hw/lint/tools/veriblelint/parse-lint-report.py
index 6c81539..35b9196 100755
--- a/hw/lint/tools/veriblelint/parse-lint-report.py
+++ b/hw/lint/tools/veriblelint/parse-lint-report.py
@@ -43,8 +43,10 @@
full_file = f.read()
err_warn_patterns = {("errors", r"^ERROR: .*"),
("errors", r"^Error: .*"),
+ ("errors", r"^E .*"),
("warnings", r"^WARNING: .*"),
("warnings", r"^Warning: .* "),
+ ("warnings", r"^W .*"),
("lint_warnings", r"^.*\[Style:.*")}
extract_messages(full_file, err_warn_patterns, results)
except IOError as err:
diff --git a/hw/lint/tools/veriblelint/rules.vbl b/hw/lint/tools/veriblelint/rules.vbl
new file mode 100644
index 0000000..3b77084
--- /dev/null
+++ b/hw/lint/tools/veriblelint/rules.vbl
@@ -0,0 +1,19 @@
+# Copyright lowRISC contributors.
+# Licensed under the Apache License, Version 2.0, see LICENSE for details.
+# SPDX-License-Identifier: Apache-2.0
+#
+# OpenTitan-specific style lint rule configurations
+
+# line length currently set to 150 to remove clutter in reports.
+# set this back to 100 once we can waive this rule for generated
+# files or once the file generators can respect this constraint
+line-length=length:150
+
+# we allow "classic" verilog string parameters without explicit type
+explicit-parameter-storage-type=exempt_type:string
+
+# localparam can be both ALL_CAPS and CamelCase according to our style
+parameter-name-style=localparam_style:CamelCase|ALL_CAPS
+
+# we allow nested struct definitions
+-typedef-structs-unions
diff --git a/hw/syn/data/syn.mk b/hw/syn/data/syn.mk
index fb2af5c..bf03968 100644
--- a/hw/syn/data/syn.mk
+++ b/hw/syn/data/syn.mk
@@ -22,7 +22,7 @@
compile: pre_compile
@echo "[make]: compile"
# we check the status in the parse script below
- cd ${sv_flist_gen_dir} && ${build_cmd} ${build_opts} | tee ${build_log}
+ cd ${sv_flist_gen_dir} && ${build_cmd} ${build_opts} 2>&1 | tee ${build_log}
post_compile: compile
@echo "[make]: post_compile"