2015-12-05 7 views
1

Я создаю новый проект на Quartus II с VHDL, но после запуска он дает мне ошибки, показанные ниже. Вы знаете, почему?VHDL - библиотека не работает

Error (10481): VHDL Use Clause error at test_VHDL.vhd(5): design library "work" does not contain primary unit "std_arith"

Error (10800): VHDL error at test_VHDL.vhd(5): selected name in use clause is not an expanded name

Error: Quartus II 64-Bit Analysis & Synthesis was unsuccessful. 2 errors, 1 warning
Error: Peak virtual memory: 1003 megabytes
Error: Processing ended: Sat Dec 5 19:50:39 2015
Error: Elapsed time: 00:00:13
Error: Total CPU time (on all processors): 00:00:38
Error (293001): Quartus II Full Compilation was unsuccessful. 4 errors, 1 warning

Вот мой код:

library ieee; 
use ieee.std_logic_1164.all; 

library work; 
use work.std_arith.all;        --extinde operatorul ” + “ la opera]ii \ntre semnale 
                    --[i numere \ntregi 
entity SUM is 
    port (a : in std_logic_vector(3 downto 0); 
     b : in std_logic; 
     ini,start,clk,a_disponibil,b_disponibil : in std_logic; 
     sum : out std_logic_vector(4 downto 0); 
     q : inout std_logic_vector(4 downto 0)); 
end SUM; 

architecture arch_SUM of SUM is 

    signal load_a,load_b,reset,load_s : std_logic; 
    signal z : std_logic_vector(0 to 3); 
     type STARE is (S0,S1,S2,S3,S4);         --st`rile automatului 
     signal S : STARE; 
begin 

    --NUMARATOR 
      --------------------------------------------------------------- 

    NUM : process(b) 
    begin 
     if rising_edge(b) then 
      if reset='1' then q<=(others=>'0'); 
      elsif load_a='1' then 
       for i in 3 downto 0 loop      --\ncarc` operandul a 
        q(i) <= a(i);        --\n ultimii 3 bistabili 
       end loop;            --ai num`r`torului 
      elsif load_b='1' then  
        q <= q+1;             --adun` b la a 
      end if; 
     end if; 
    end process NUM; 

    --REGISTRU 
      -------------------------------------------------------------------- 

    REG: process(clk) 
    begin 
     if rising_edge(clk) then 
       if reset='1' then sum<=(others=>'0'); 
       elsif load_s='1' then 
        sum<=q; 
       end if; 
     end if; 
    end process REG; 

    --AUTOMAT 
      ----------------------------------------------------------------------------------- 
    AUTOMAT : process(ini,clk)  
    begin 
     if INI='1' then s<=S0;           --ini]ializeaz` automatul 
     elsif rising_edge(clk) then 
         case S is              --descrie diagrama st`rilor 
       when S0 => 
        if start='1' then S<=S1; 
             else S<=S0; 
              end if; 
       when S1 => 
        if a_disponibil='1' then S<=S2; 
               else S<=S1; 
        end if; 
       when S2 => 
        if b_disponibil='1' then S<=S3; 
                   else S<=S2; 
        end if;   
       when S3 => 
        if b_disponibil='0' then S<=S4; 
                  else S<=S3; 
        end if; 
       when S4 => S<=S0; 
      end case; 
     end if; 
    end process AUTOMAT; 

    with S select 
      z<= "0000" when S0,            --genereaz` ie[irea 
      "0010" when S1, 
      "1000" when S2, 
      "0100" when S3, 
      "0001" when others; 

    load_a <= z(0); 
    load_b <= z(1);                    --conexiuni interne 
    reset <= z(2); 
    load_s <= z(3); 

end arch_SUM; 

есть кто-нибудь понять, почему и как решить эту проблему?

ответ

1

В заявлении use work.std_arith.all; представлен компилятор sysnthesis для поиска пакета std_arith в той же библиотеке, что и в файле VHDL. Если вы не указали один из параметров проекта Quartus, это будет библиотека по умолчанию. В этом случае вы должны предоставить свою собственную реализацию пакета и добавить этот файл в проект Quartus.

Если вы ищете нестандартный пакет от Synopsys, то вы должны изменить строку на use ieee.std_logic_arith.all;. Но эта библиотека не определяет оператора + для типа std_logic_vector. EDIT Требуемый оператор определяется в пакете std_logic_unsigned, если вы хотите обработать std_logic_vector s как беззнаковые числа. Пакет включен с use ieee.std_logic_unsigned.all;. Если вы хотите вместо этого добавить арифметику, включите use ieee.std_logic_signed.all;.

Но я рекомендую вместо этого использовать стандартную библиотеку IEEE ieee.numeric_std, которая определяет арифметические операторы на векторных типах unsigned и signed.

Например, объявите в сущности

sum : out unsigned(4 downto 0); 
q : inout unsigned(4 downto 0); 
+0

И как я могу добавить эту библиотеку, если он не определен? Или я могу использовать только ieee.std_logic_arith.all; ? –

+0

@ J.D Что вы имели в виду? У вас действительно есть реализация пакета 'std_arith'? –

+0

И если это уже реализовано, почему у меня есть эта ошибка? –

Смежные вопросы