Created
April 26, 2013 12:52
-
-
Save tonussi/5467169 to your computer and use it in GitHub Desktop.
to integer function vhdl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function to_integer(sig : std_logic_vector) return integer is | |
variable num : integer := 0; -- descending sig as integer | |
begin | |
for i in sig'range loop | |
if sig(i)='1' then | |
num := num*2+1; | |
else | |
num := num*2; | |
end if; | |
end loop; -- i | |
return num; | |
end function to_integer; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
vai dentro de architecture