aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue542/nest.vhdl
blob: 0becf0fe20f11606498194754ee6e5d0a6d7da4e (plain)
1
2
3
4
5
6
7
8
9
1' href='#n11'>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;