VERILOG2141: All paths of a non-void function should return a value
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| HIGH | - | - | Intentionality | Complete | 10min | synthesis, vscode, linter, simulation |
Description
Noncompliant code example
function int fly(input a);
if (a) begin
return 1;
end
endfunction
Compliant solution
function int fly(input a);
if (a) begin
return 1;
end else begin
return 0;
end
endfunction
A non-void function has return statements or assigns to its return value variable but does not do so on all control paths through the function.
Parameters
No parameters.