Skip to content

Instantly share code, notes, and snippets.

@tonussi
Created April 26, 2013 12:52
Show Gist options
  • Save tonussi/5467169 to your computer and use it in GitHub Desktop.
Save tonussi/5467169 to your computer and use it in GitHub Desktop.
to integer function vhdl
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;
@tonussi
Copy link
Author

tonussi commented Apr 26, 2013

vai dentro de architecture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment