【问题标题】:vhdl std_logic not declared errorvhdl std_logic 未声明错误
【发布时间】:2015-08-25 14:41:55
【问题描述】:

我不断收到未声明 std_logic 的烦人错误。我不知道为什么会出现此错误,因为我已包含所有必要的库。 这是我的代码和错误。

     ---------------------------------------------------------------------    -------------
          -- Company: 
          -- Engineer: 
          -- 
-- Create Date:    15:26:41 08/23/2015 
-- Design Name: 
-- Module Name:    Deficit-Round_Robbin_algorithem - Behavioral 
-- Project Name: 
-- Target Devices: 
-- Tool versions: 
-- Description: 
--
-- Dependencies: 
--
-- Revision: 
-- Revision 0.01 - File Created
-- Additional Comments: 
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
package TwoDArray is
  Type array_integer is array(1 to 6) of integer range 0 to 6;
end package TwoDArray;
-- Uncomment the following library declaration if instantiating
-- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

  entity Deficit_Round_Robbin_algorithem is

generic(
Quantom:integer range 0 to 256:=2;
Num_queues:integer:=5 ;
IN_FIFO_DEPTH_BIT:integer:=6
);
port(
clk,axi_resetn,m_axis_tready:in std_logic;
--packet_size:in array_integer range 0 to Num_queues+1;
--fifo_out_tlast,empty:in std_logic_vector(Num_queues - 1 downto 0);
--depth_of_fifo:in integer range 0 to Num_queues+1;
--rd_en:out std_logic_vector(Num_queues - 1 downto 0);
pkt_fwd:out std_logic
);
end Deficit_Round_Robbin_algorithem;

architecture Behavioral of Deficit_Round_Robbin_algorithem is
--signal cur_queue,cur_queue_next,cur_queue_plus1:integer range 0 to Num_queues-1:=0;
--signal pkt_fwd_next:std_logic:='0'; 
--
--signal Drr_counter:array_integer ;
--
--subType STATE_TYPE is bit_vector (1 downto 0);
--signal next_state,state:STATE_TYPE :="00"; --00 start state
--constant Idle:STATE_TYPE:="00";
--constant WR_PKT:STATE_TYPE:="01";
begin
--cur_queue_plus1<=0 when cur_queue=Num_queues-1 else cur_queue + 1;
--Drr_counter[cur_queue]<=Drr_counter[cur_queue] + Quantom;
--Medvedev_state_diagram:process(state,cur_queue,empty,m_axis_tready,fifo_out_tlast,depth_of_fifo) is
--begin
--      cur_queue_next  <= cur_queue;
--      rd_en           <= (others =>'0');
--      pkt_fwd_next    <= '0';
--      case state is
--      when Idle=> if(empty[cur_queue]='0') then
--                          if(m_axis_tready) then
--                              if(Drr_counter[cur_queue] >= packet_size[cur_queue]) then
--                                  next_state<= WR_PKT;
--                                  rd_en[cur_queue] <= '1';
--                                  pkt_fwd_next <= '1';
--                              end if;
--                          end if;
--                      else
--                      cur_queue_next <= cur_queue_plus1;
--                      end if;
--                      end case;
--end process;

end Behavioral;

我的错误

ERROR:HDLCompiler:69 - "I:\xilinx\Deficit-Round_Rrobbin\Deficit-Round_Robbin_algorithem.vhd" Line 42: <std_logic> is not declared.
ERROR:HDLCompiler:69 - "I:\xilinx\Deficit-Round_Rrobbin\Deficit-Round_Robbin_algorithem.vhd" Line 47: <std_logic> is not declared.
ERROR:HDLCompiler:854 - "I:\xilinx\Deficit-Round_Rrobbin\Deficit-Round_Robbin_algorithem.vhd" Line 34: Unit <deficit_round_robbin_algorithem> ignored due to previous errors.
ERROR:HDLCompiler:374 - "I:\xilinx\Deficit-Round_Rrobbin\Deficit-Round_Robbin_algorithem.vhd" Line 51: Entity <deficit_round_robbin_algorithem> is not yet compiled.

【问题讨论】:

    标签: vhdl


    【解决方案1】:

    Use 子句(库声明)实际上是 VHDL 中库单元声明(包、实体、配置等)的一部分。它们不适用于文件中声明的所有库单元。

    因此,在您的情况下,文件顶部用于导入 IEEE 库的 use 子句仅适用于包 TwoDArray。您需要在包声明后重新定义适用于 Deficit_Round_Robbin_algorithem 的库。

    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    use ieee.std_logic_arith.all;
    -- Uncomment the following library declaration if using
    -- arithmetic functions with Signed or Unsigned values
    --use IEEE.NUMERIC_STD.ALL;
    package TwoDArray is
      Type array_integer is array(1 to 6) of integer range 0 to 6;
    end package TwoDArray;
    -- Uncomment the following library declaration if instantiating
    -- any Xilinx primitives in this code.
    --library UNISIM;
    --use UNISIM.VComponents.all;
    
    library IEEE;
    use IEEE.STD_LOGIC_1164.ALL;
    library work;
    use work.TwoDArray.all;
    
    entity Deficit_Round_Robbin_algorithem is
    generic(
    ...
    

    编辑:根据 cmets 在实体的 use 子句中添加了 TwoDArray 包。

    【讨论】:

    • IEEE Std 1076-2008 13.4 上下文子句,“上下文子句定义了分析设计单元的初始名称环境。” “库子句定义了可以在设计单元中引用的库逻辑名称;库子句在 13.2 中描述。使用子句使某些声明在设计单元中直接可见;使用子句在 12.4 中描述。” 13.2 “除了上下文声明和包 STANDARD 之外的每个设计单元都假定包含以下隐式上下文项作为其上下文子句的一部分:库 STD、WORK;使用 STD.STANDARD.all;”没有标准逻辑。
    • 哇,答案真棒。多谢!!!!!!只是另一个问题如何使用我创建的包。
    • 我已经编辑了答案,将TwoDArray 添加到Deficit_Round_Robbin_algorithem 的使用子句中。但是,这假定您正在将此文件编译为默认库 work
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多