Vhdl 找不到引用的上下文元素

Vhdl 找不到引用的上下文元素,vhdl,active-hdl,Vhdl,Active Hdl,我正在尝试为D触发器编写一些简单的行为代码(源文件可以很好地编译),但是测试台文件不能编译。我得到以下错误: 错误:COMP96_0078:D_FF_tb.vhd:(23,15):未知标识符“D_触发器” 错误:COMP96_0056:D_FF_tb.vhd:(23,15):找不到引用的实体声明“D_触发器” 错误:COMP96_0055:D_FF_tb.vhd:(23,15):找不到引用的上下文元素“D_触发器” 以下是我的源代码: library IEEE; use IEEE.STD_LOG

我正在尝试为D触发器编写一些简单的行为代码(源文件可以很好地编译),但是测试台文件不能编译。我得到以下错误:

错误:COMP96_0078:D_FF_tb.vhd:(23,15):未知标识符“D_触发器”

错误:COMP96_0056:D_FF_tb.vhd:(23,15):找不到引用的实体声明“D_触发器”

错误:COMP96_0055:D_FF_tb.vhd:(23,15):找不到引用的上下文元素“D_触发器”

以下是我的源代码:

library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.numeric_std.all; 

entity d_flipflop is
    port(  
    d_in : in STD_LOGIC;
    q_out: out STD_LOGIC;
    qbar_out: out STD_LOGIC;
    clock : in STD_LOGIC;
    reset : in STD_LOGIC
    );
end d_flipflop;

architecture behavioral of d_flipflop is
begin
    process (clock) is
    begin
        if rising_edge(clock) then
            if(reset = '1') then
                q_out <= '0';
                qbar_out <= '1';
            else 
                q_out <= d_in;
                qbar_out <= not d_in;
            end if; 
        end if;
    end process;
end architecture behavioral;
IEEE库;
使用IEEE.STD_LOGIC_1164.all;
使用IEEE.numeric_std.all;
实体d_触发器为
港口(
d_in:在标准逻辑中;
q_out:输出标准逻辑;
qbar_输出:输出标准逻辑;
时钟:标准逻辑;
复位:在标准逻辑中
);
结束d_触发器;
d_触发器的结构是
开始
进程(时钟)是
开始
如果上升沿(时钟),则
如果(重置='1'),则
q_out重置,
时钟_tb=>时钟
);
时钟:进程
开始
而end_sim=假循环

时钟\u tb如果您使用实体名称d\u flipflop而不是尝试实例化d\u flipflop?您最初将其称为
d\u flipflop
,然后将其称为
d\u flipflop
。尝试删除第二个下划线。是的。。。我一开始没注意到。谢谢@user1155120第一个错误mesg告诉你分析器不知道任何上下文项中的d_触发器(它不是库名、包名或设计单元名)。第二个告诉您它没有看到该名称的实体。第三个是告诉你,如果有一个d_触发器,它应该是沿着
实体工作的路线。仅仅修改名字是不够的。没有“有用的工作,一切”;上下文项使d_触发器在没有选定名称的情况下可见。
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use IEEE.numeric_std.all;          

entity d_flipflop_tb is
end d_flipflop_tb; 

architecture tb_architecture of d_flipflop_tb is

    -- Stimulus Signals--
    signal d_tb : std_logic;
    signal q_tb : std_logic;
    signal qbar_tb: std_logic;
    signal reset_tb: std_logic;
    signal clock_tb: std_logic := '0'; 
    
    signal end_sim : boolean := false;
    
    constant half_period : time := 5 ns;

    begin
        
        UUT: entity d_flip_flop
            port map(
            d_tb => d_in,
            q_tb => q_out,
            qbar_tb => qbar_out,
            reset_tb => reset, 
            clock_tb => clock
            );
            
            clock: process
            begin
                while end_sim = false loop
                    clock_tb <= not clock_tb;
                    wait for half_period;
                end loop;
                wait;
            end process;
            
            stim: process
            begin        
                -- Initialize
                d_tb <= '0';
                reset_tb <= '1';
                
                --Wait for 1 period
                wait for half_period*2;
                reset_tb <= '0';
                
                --Provide stimulus
                for i in 0 to 5 loop
                    d_tb <= not d_tb;
                    wait for half_period;
                end loop;
                
                end_sim <= true;
                    
                wait;
                
            end process; 
    --end process;
        
end tb_architecture;