【问题标题】:VHDL - library doesn't workVHDL - 库不起作用
【发布时间】:2015-12-10 04:21:02
【问题描述】:

我已经使用 VHDL 在 Quartus II 上创建了一个新项目,但是在我运行它之后会出现如下所示的错误。你知道为什么吗?

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 子句不是扩展名称

错误:Quartus II 64-Bit Analysis & Synthesis 不成功。 2 个错误,1 个警告
错误:峰值虚拟内存:1003 MB
错误:处理结束:2015 年 12 月 5 日星期六 19:50:39
错误:经过时间:00:00:13
错误:总 CPU 时间(在所有处理器上):00:00:38
错误 (293001):Quartus II 完整编译不成功。 4 个错误,1 个警告

这是我的代码:

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;

有谁知道为什么以及如何解决它?

【问题讨论】:

    标签: iis vhdl quartus


    【解决方案1】:

    语句use work.std_arith.all; 引入了 sysnthesis 编译器以在与 VHDL 文件相同的库中查找包 std_arith。如果您没有在 Quartus 项目设置中指定一个,它将是默认库。在这种情况下,您必须提供自己的包实现并将该文件添加到 Quartus 项目中。

    如果您正在寻找来自 Synopsys 的非标准软件包,则必须将行更改为 use ieee.std_logic_arith.all;。但是,这个库没有为std_logic_vector 类型定义运算符+EDIT 如果您想将std_logic_vectors 视为无符号数字,则在包std_logic_unsigned 中定义了所需的运算符。该软件包包含在use ieee.std_logic_unsigned.all; 中。如果您想要有符号算术,请包含 use ieee.std_logic_signed.all;

    但是,我建议改用标准 IEEE 库 ieee.numeric_std,它定义了向量类型 unsignedsigned 上的算术运算符。

    例如在实体中声明

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

    【讨论】:

    • 如果他没有定义,我该如何添加该库?或者我可以只使用 ieee.std_logic_arith.all; ?
    • @J.D 你是什么意思?你真的有包std_arith 的实现吗?
    • 你说的已经实现是什么意思?通过谁?石英?
    • 或者,使用 Synopsys 库,您可以将第 5 行的 use 子句更改为 use ieee.std_logic_unsigned.all;,之后问题的代码分析成功。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-11-30
    相关资源
    最近更新 更多