VHDL237: “others” should be the last clause of a case statement
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| - | - | MEDIUM | Intentionality | Clear | 5min | synthesis, vscode, simulation, linter |
Description
Noncompliant code example
case my_case is when 0 => z <= a; when others => z <= d; -- Noncompliant: "others" clause should be the last item of the "case" statement when 1 => z <= b; when 2 => z <= c; end case;
Compliant solution
case my_case is when 0 => z <= a; when 1 => z <= b; when 2 => z <= c; when others => z <= d; -- Compliant: "other" clause is the last item of the "case" statement end case;
To improve understandability, the others clause should be the last item of a case statement.
Parameters
No parameters.