slang-tidy does not find functions from different files.
Andful opened this issue · 3 comments
Describe the bug
When running slang-tidy
, it does not find functions from different files.
To Reproduce
Consider the following code snippet.
function automatic integer unsigned min(integer unsigned x, integer unsigned y);
return (x < y) ? x : y;
endfunction
module top;
initial begin
$display("%d", min(1,2));
end
endmodule
If I run slang-tidy
on the code in its entirety within a file, slang-tidy
does not complain. If I put top
in top.sv
and min
in min.sv
and run either:
$ slang-tidy min.sv top.sv
or
$ slang-tidy top.sv min.sv
slang-tidy
complains with:
top.v:3:20: error: use of undeclared identifier 'min'
$display("%d", min(1,2));
^~~
slang-tidy: errors found during compilation
Additional context
Tested it on v6.0 ( commit 7bcff26 ), with a self-compiled alpine docker image. The docker image can be run with:
$ docker run --rm -it -v `pwd`:/workdir ghcr.io/andful/pipelined-math:master
Not sure if it is intended behavior, but it differs in behavior from iverilog
.
The same behavior seem to occur with slang
.
By default each file is considered its own compilation unit. If you would like them to be concatenated together you can use --single-unit
. See: https://sv-lang.com/user-manual.html#compilation-units
Ah thanks!