shaiko
Advanced Member level 5
Hello,
Please help me write a function that receives an unsigned vector of an unconstraid lengh and returns the position of the first '1' from the right.
For example :
Please help me write a function that receives an unsigned vector of an unconstraid lengh and returns the position of the first '1' from the right.
For example :
Code:
constant x unsigned ( 7 downto 0 ) := "000[COLOR="#FF0000"]1[/COLOR]010" ; -- for x the function shall return the integer 3.
constant y unsigned ( 7 downto 0 ) := "00[COLOR="#FF0000"]1[/COLOR]1010" ; -- for y the function shall return the integer 4.
constant z unsigned ( 7 downto 0 ) := "0000000" ; -- for z the function shall return the integer 0.