VERILOG2121: A constant function should not access a queue with a reversed range
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| HIGH | - | - | Intentionality | Logical | 10min | synthesis, vscode, simulation, linter |
Description
Noncompliant code example
typedef int ret_type[$];
localparam ret_type foo = func();
function ret_type func;
automatic int i[$] = {1, 2, 3};
return i[2:0]; // Noncompliant: Reversed selection range [2:0] for queue will always yield an empty result
endfunction
A constant function is accessing a queue with a reversed range, which is defined to always yield an empty queue.
Parameters
No parameters.