From bf4b5bfc1ab65ca020a727ac2cf22f82a814f649 Mon Sep 17 00:00:00 2001 From: Jorge Marques Date: Thu, 25 Apr 2024 15:56:47 -0300 Subject: [PATCH 1/3] Match filename in xvlog linter Match the xvlog stdout for the filename to properly filter out the errors per file. --- ale_linters/verilog/xvlog.vim | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ale_linters/verilog/xvlog.vim b/ale_linters/verilog/xvlog.vim index 98b5aae72a..8e0ccbfd2f 100644 --- a/ale_linters/verilog/xvlog.vim +++ b/ale_linters/verilog/xvlog.vim @@ -11,13 +11,16 @@ endfunction function! ale_linters#verilog#xvlog#Handle(buffer, lines) abort "Matches patterns like the following: " ERROR: [VRFC 10-1412] syntax error near output [/path/to/file.v:5] - let l:pattern = '^ERROR:\s\+\(\[.*\)\[.*:\([0-9]\+\)\]' + let l:pattern = '^ERROR:\s\+\(\[.*\)\[\(.*\):\([0-9]\+\)\]' let l:output = [] + let l:dir = expand('#' . a:buffer . ':p:h') " NOTE: `xvlog` only prints 'INFO' and 'ERROR' messages for l:match in ale#util#GetMatches(a:lines, l:pattern) + let l:fname = ale#path#GetAbsPath(l:dir, l:match[2]) call add(l:output, { - \ 'lnum': l:match[2] + 0, + \ 'filename': l:fname, + \ 'lnum': l:match[3] + 0, \ 'type': 'E', \ 'text': l:match[1], \}) From 87542b9511604f1b5135a0b576662512c1a58f4c Mon Sep 17 00:00:00 2001 From: Jorge Marques Date: Thu, 25 Apr 2024 16:21:09 -0300 Subject: [PATCH 2/3] docs: Add tip to xvlog Suggest using Vivado generated compile.sh file to obtain the xvlog options. --- doc/ale-verilog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/ale-verilog.txt b/doc/ale-verilog.txt index 83e4f31e95..c1bb20c857 100644 --- a/doc/ale-verilog.txt +++ b/doc/ale-verilog.txt @@ -127,6 +127,9 @@ g:ale_verilog_xvlog_options *g:ale_verilog_xvlog_options* Default: `''` This variable can be changed to modify the flags/options passed to 'xvlog'. + Vivado generates a 'compile.sh' file in the xsim directory with the flags you + are probably looking for. Note, however, that you may need to change the + relative paths in the Project File '.prj'. =============================================================================== From afecb95a4d3ce4423337d7fa4914f44479521b53 Mon Sep 17 00:00:00 2001 From: Jorge Marques Date: Thu, 25 Apr 2024 17:51:41 -0300 Subject: [PATCH 3/3] Catch warnings in xvlog linter The linter added warnings to the stdout. --- ale_linters/verilog/xvlog.vim | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ale_linters/verilog/xvlog.vim b/ale_linters/verilog/xvlog.vim index 8e0ccbfd2f..51b4ca4757 100644 --- a/ale_linters/verilog/xvlog.vim +++ b/ale_linters/verilog/xvlog.vim @@ -11,18 +11,18 @@ endfunction function! ale_linters#verilog#xvlog#Handle(buffer, lines) abort "Matches patterns like the following: " ERROR: [VRFC 10-1412] syntax error near output [/path/to/file.v:5] - let l:pattern = '^ERROR:\s\+\(\[.*\)\[\(.*\):\([0-9]\+\)\]' + let l:pattern = '^\(WARNING\|ERROR\|INFO\):\s\+\(\[.*\)\[\(.*\):\([0-9]\+\)\]' let l:output = [] let l:dir = expand('#' . a:buffer . ':p:h') " NOTE: `xvlog` only prints 'INFO' and 'ERROR' messages for l:match in ale#util#GetMatches(a:lines, l:pattern) - let l:fname = ale#path#GetAbsPath(l:dir, l:match[2]) + let l:fname = ale#path#GetAbsPath(l:dir, l:match[3]) call add(l:output, { \ 'filename': l:fname, - \ 'lnum': l:match[3] + 0, - \ 'type': 'E', - \ 'text': l:match[1], + \ 'lnum': l:match[4] + 0, + \ 'type': l:match[1][0], + \ 'text': l:match[2], \}) endfor