Hallo!
Ich habe habe mir ein kleines Package mit zwei Funktionen geschrieben:
1 | package log2 is
|
2 | function log2ceil(x : natural) return natural;
|
3 | function log2floor(x : natural) return natural;
|
4 | end log2;
|
5 |
|
6 | package body log2 is
|
7 |
|
8 | function log2ceil(x : natural) return natural is
|
9 | begin
|
10 | for i in 0 to 32 loop
|
11 | if 2**i > x then
|
12 | return i;
|
13 | end if;
|
14 | end loop;
|
15 | return 32;
|
16 | end function;
|
17 |
|
18 | function log2floor(x : natural) return natural is
|
19 | begin
|
20 | for i in 1 to 33 loop
|
21 | if 2**i > x then
|
22 | return i-1;
|
23 | end if;
|
24 | end loop;
|
25 | return 32;
|
26 | end function;
|
27 |
|
28 | end log2;
|
Und diese Funktionen möchte ich in einer anderen Entity benutzen:
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 | library work;
|
4 | use work.log2.all;
|
5 |
|
6 | entity blubb is
|
7 | generic (
|
8 | bits : natural);
|
9 | port (
|
10 | clk : in std_logic;
|
11 | reset : in std_logic;
|
12 | gain : in std_logic_vector(log2ceil(2*bits) downto 0);
|
13 | input : in std_logic_vector(bits-1 downto 0);
|
14 | output : out std_logic_vector(bits-1 downto 0));
|
15 | end blubb;
|
Allerdings scheint Synplify Pro Probleme damit zu haben:
1 | @E:CD255 : main.vhd(83) | No identifier "log2ceil" in scope
|
2 | 1 error parsing file C:\Documents and Settings\myself\Desktop\bla\hdl\main.vhd
|
Mit GHDL funktioniert das super. Wo ist das Problem und wie kann ich es
beheben?
Ich benutze übrigens Actels Libero.