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
???
???
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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;