chitra ranganath
Member level 2

hi how to count the total no of bits stored in a register which includes even a space in between
???
???
Code VHDL - [expand] 1 2 3 4 5 6 7 8 9 10 function count_ones(slv : std_logic_vector) return natural is variable n_ones : natural := 0; begin for i in slv'range loop if slv(i) = '1' then n_ones := n_ones + 1; end if; end loop; return n_ones; end function count_ones;