blob: 5a4cde079005489720d3d232e395d2ea01e0c17f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
library ieee;
use ieee.std_logic_1164.all;
entity ret03 is
port (di : std_logic_vector (7 downto 0);
res : out integer);
end ret03;
architecture behav of ret03 is
function ffs (v : std_logic_vector (7 downto 0)) return integer is
begin
for i in v'range loop
if v (i) = '1' then
return i;
end if;
end loop;
return -1;
end ffs;
begin
res <= ffs (di);
end behav;
|