I am new to VHDL. I am trying out a code to find whether a bit vector is is even r not (using hamming weight of the bit vector). The code I wrote is:
entity hw_mod is
generic(
bits:integer );
port (
inp : in std_logic_vector((bits-1) downto 0;
cout : out std_logic );
end entity hw_mod
architecture hw_arch of hw_mod is
begin
process(inp)
variable count : Integer:=0;
begin
labelloop: for i in 0 to (bits-1) loop
if(inp(i)=='1') then
count:= count+1;
end if;
end loop;
if ((count mod 2)== '0') then
cout:=1;
else
cout:=0;
end if;
end process;
end hw_arch;
the error I keep getting is "near "=": syntax error in two places.

=, not==.end entity hw_modis missing a statement closing semicolon,countis an integer compare it to a decimal literal, use signal assignment for cout, and it's std_ulogic based (e.gcout <= '0'; notcout := 0;). You have superfluous parentheses in your if statement conditions.countrepresents the '1's popcount ofinput,count mod 2 = 0represents even parity (even numbers of '1's). In -2008:cout <= not (xor inp);(Thats a unary XOR (reduction) operator, an even number of '1's will produce a '1' oncout, it's an optimization of popcount looking at the LS bit). An array value (e.g. std_logic_vector) arithmetic ("+", count) would also be modular without amodoperator.