Start for free Book a free session

Parentheses around a logical reduction

VHDL-2008 introduced the logical reduction operators. These are the unary forms of and, or, nand, nor, xor, and xnor, which combine all elements of an array into a single value (LRM 9.2.2).

In VHDL-2008, a reduction that is combined with another operator has to be written in parentheses, operator and operand together (LRM 9.1). VHDL-2019 no longer requires the parentheses, so this check only applies to VHDL-2008 code.

VHDL
architecture rtl of receiver is
  signal data   : std_logic_vector(7 downto 0);
  signal enable : std_logic;
  signal valid  : std_logic;
  signal parity : std_logic;
begin
  process(all) is
  begin
    valid  <= and data and enable;   -- the reduction is not in parentheses
    valid  <= (and data) and enable; -- the reduction of data, combined with enable
    parity <= xor data;              -- allowed, the reduction is the whole expression
  end process;
end architecture;