VHDL1045: Both active-low and active-high enables should not be used for the same enable signal
Summary
| Reliability | Security | Maintainability | Code attribute | Effort to fix | Tags |
|---|---|---|---|---|---|
| MEDIUM | - | - | Consistency | Conventional | 30min | synthesis, bug-finder, enable, linty-ultra |
Description
Noncompliant code example
architecture rtl of fly is
begin
A: process (clk, rst) is
begin
if rst = '1' then
o1 <= '0';
elsif rising_edge(clk) then
if enable = '0' then -- Active-low enable
o1 <= i1;
end if;
end if;
end process;
B: process (clk, rst) is
begin
if rst = '1' then
o2 <= '0';
elsif rising_edge(clk) then
if enable = '1' then -- Active-high enable
o2 <= i2;
end if;
end if;
end process;
end architecture;
Compliant solution
architecture rtl of fly is
begin
A: process (clk, rst) is
begin
if rst = '1' then
o1 <= '0';
elsif rising_edge(clk) then
if enable = '1' then -- Active-high enable
o1 <= i1;
end if;
end if;
end process;
B: process (clk, rst) is
begin
if rst = '1' then
o2 <= '0';
elsif rising_edge(clk) then
if enable = '1' then -- Active-high enable
o2 <= i2;
end if;
end if;
end process;
end architecture;
Both active-low and active-high enables should not be used for the same enable signal.
Parameters
No parameters.