VHDL1068: Functions should always return a value
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| HIGH | - | - | Intentionality | Logical | 20min | synthesis, bug-finder, do254, do254-cp9, linty-ultra |
Description
A function that does not always return a value is likely a coding mistake. All paths of a function should return a value.
Noncompliant code example
function my_function (i : in integer) return std_logic is
begin
if i > 5 then
return '0';
end if;
end;
Compliant solution
function my_function (i : in integer) return std_logic is
begin
if i > 5 then
return '0';
else
return '1';
end if;
end;
Parameters
No parameters.