VHDL170: Functions should only contain one single “return” statement
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| - | - | LOW | Intentionality | Clear | 2min | synthesis, vscode, linter, simulation |
Description
Functions should only contain one single return statement.
Noncompliant code example
function my_function(z : boolean) return std_logic is
begin
if z then
return '1';
else
return '0';
end if;
end;
Compliant Code Example
function my_function(z : boolean) return std_logic is
variable tmp : std_logic;
begin
if z then
tmp := '1';
else
tmp := '0';
end if;
return tmp; -- Compliant
end;
Parameters
No parameters.