Forum: FPGA, VHDL & Co. Problem mit Bibliothek numeric standard


von transcend (Gast)


Lesenswert?

Hallo zusammen;

Ich habe da folgendes Problem:
Mein VHDL Compiler erkennt die numeric_std nicht:
1
library IEEE;
2
use IEEE.std_logic_1164.all;
3
use IEEE.numeric_std.all;
4
5
-- Beschreibung der Black Box:
6
7
entity d_ff_reg is
8
  port
9
  (
10
    d_i : in std_logic_vector (3 downto 0);
11
    clk_i : in std_logic;
12
    en_i : in std_logic;
13
    sh_i : in std_logic;
14
    reset : in std_logic;
15
    q_o : out std_logic_vector (3 downto 0)
16
  );
17
end d_ff_reg;
18
19
architecture sim of d_ff_reg is
20
21
signal output_holder : std_logic_vector (3 downto 0);
22
23
begin
24
  p_logic0 : process (clk_i, reset)
25
  begin
26
    if(reset='1') then
27
      output_holder <= "0000";
28
    elsif(clk_i'event and clk_i='1') then
29
      if(en_i='0' and sh_i='0') then
30
        output_holder <= output_holder;
31
      elsif(en_i='0' and sh_i='1') then
32
        output_holder <= output_holder;
33
      elsif(en_i='1' and sh_i='0') then
34
        output_holder <= d_i;
35
      elsif(en_i='1' and sh_i='1') then
36
        output_holder <= SHIFT_LEFT(UNSIGNED(output_holder),1);
37
      end if;
38
    end if;
39
  end process p_logic0;
40
  q_o <= output_holder;
41
end sim;

Warum bekomme ich folgende Fehlermeldung obwohl die packages doch eh 
oben eingeblendet sind:

vhd(36): No feasible entries for subprogram "shift_left".
in Zeile:
1
output_holder <= SHIFT_LEFT(UNSIGNED(output_holder),1);
vhd(41): VHDL Compiler exiting

von Duke Scarring (Gast)


Lesenswert?

Hier die Definition:
1
  -- Id: S.1
2
  function SHIFT_LEFT (ARG: UNSIGNED; COUNT: NATURAL) return UNSIGNED;
Dein Rückgabetyp pass nicht.

So geht's:
1
        output_holder <= std_logic_vector( SHIFT_LEFT(UNSIGNED(output_holder),1));

Duke

von PittyJ (Gast)


Lesenswert?

Meiner übersetzt das auch nicht, aber aus einem anderen Grund:
Das Ergebnis von shift_left() ist ein unsigned und kein 
std_logic_vector.

Mit
        output_holder <= 
std_logic_vector(SHIFT_LEFT(UNSIGNED(output_holder),1));

geht das.

von transcend (Gast)


Lesenswert?

Vielen vielen Dank für eure Hilfe und eure wertvolle Zeit.

von Michael F. (dasdgw)


Lesenswert?

Also ich persönliches finde es übersichtlicher das Signal output_holder 
gleich als unsigned anzulegen. Dann muss man nur einen cast bei der 
Zuweisung zum Ausgangsport machen. In etwa so:
1
signal output_holder unsigned (3 downto 0);
2
...
3
output_holder <= SHIFT_LEFT(output_holder,1);
4
...
5
q_o <= std_logic_vector(output_holder);
Eventuell könnte man ja auch den Ausgangsport als unsigned wählen.
Dann könnte man sich den letzten cast auch noch sparen.

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.