aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue1404/pkg.vhdl
blob: 265c524829796baac0f62b02d09be031f4592420 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package mylib_pkg is

  pure function ceil_log2(constant v : natural) return natural;

end package mylib_pkg;

package body mylib_pkg is

  pure function ceil_log2(constant v : natural) return natural is
    variable res : natural;
  begin
    res := 31;
    for i in 30 downto 0 loop
      if (2**i >= v) then
        res := i;
      end if;
    end loop;
    return res;
  end function ceil_log2;

end package body mylib_pkg;