There is no way that makes more or less sense for synthesis. Write the code that best expresses your intention.
If you are comparing a vector for all zeros, everyone should give the same results or you must file a serious error regarding the tool!
signal vector_slv : std_logic_vector(2048 downto 0); constant zeros : std_logic_vector(vector_slv'range) := (others => '0'); ... if vector_slv = (vector_slv'range => '0') then -- do something... if vector_slv = zeros then -- do something... if unsigned(vector_slv) = to_unsigned(0, vector_slv'length) then -- do something...
and valid for shorter vectors that fit into an integer:
if intvar = 0 then
will be exactly the same as any 32-bit vector comparison.
<sub> (BTW, notice that there is no need for parentheses around the if -VHDL condition is not C :) Sub>
Martin thompson
source share