mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--neovim-06-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
In the vein of commit ea72d66b "Verilator current file search path (#3500)"
This includes the directory of the current file in the library
search path. From `man iverilog`:
-ylibdir
Append the directory to the library module search
path. When the compiler finds an undefined module, it
looks in these directories for files with the right name.
45 lines
1.4 KiB
VimL
45 lines
1.4 KiB
VimL
" Author: Masahiro H https://github.com/mshr-h
|
|
" Description: iverilog for verilog files
|
|
|
|
call ale#Set('verilog_iverilog_options', '')
|
|
|
|
function! ale_linters#verilog#iverilog#GetCommand(buffer) abort
|
|
return 'iverilog -t null -Wall '
|
|
\ . '-y%s:h '
|
|
\ . ale#Var(a:buffer, 'verilog_iverilog_options')
|
|
\ . ' %t'
|
|
endfunction
|
|
|
|
function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort
|
|
" Look for lines like the following.
|
|
"
|
|
" tb_me_top.v:37: warning: Instantiating module me_top with dangling input port 1 (rst_n) floating.
|
|
" tb_me_top.v:17: syntax error
|
|
" memory_single_port.v:2: syntax error
|
|
" tb_me_top.v:17: error: Invalid module instantiation
|
|
let l:pattern = '^[^:]\+:\(\d\+\): \(warning\|error\|syntax error\)\(: \(.\+\)\)\?'
|
|
let l:output = []
|
|
|
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
let l:line = l:match[1] + 0
|
|
let l:type = l:match[2] =~# 'error' ? 'E' : 'W'
|
|
let l:text = l:match[2] is# 'syntax error' ? 'syntax error' : l:match[4]
|
|
|
|
call add(l:output, {
|
|
\ 'lnum': l:line,
|
|
\ 'text': l:text,
|
|
\ 'type': l:type,
|
|
\})
|
|
endfor
|
|
|
|
return l:output
|
|
endfunction
|
|
|
|
call ale#linter#Define('verilog', {
|
|
\ 'name': 'iverilog',
|
|
\ 'output_stream': 'stderr',
|
|
\ 'executable': 'iverilog',
|
|
\ 'command': function('ale_linters#verilog#iverilog#GetCommand'),
|
|
\ 'callback': 'ale_linters#verilog#iverilog#Handle',
|
|
\})
|