eng.amr2009
Junior Member level 3
I have this code to count number of ones in a std_logic_vector in VHDL
I need to know how to implement this code in verilog ? I'm somehow new to verilog.
Thanks in advance.
Code:
process(Input)
variable rCount : std_logic_vector(log2(Input'length) downto 0);
begin
rCount := (others=>'0');
for i in 0 to Input'length-1 loop
if Input(i)='1' then
rCount := Count+'1';
end if;
end loop;
Count <= rCount;
end process;
I need to know how to implement this code in verilog ? I'm somehow new to verilog.
Thanks in advance.