vhdl - 在VHDL中使用另一个文件中的实体

标签 vhdl

如何从VHDL的工作空间中“包含”另一个文件,然后如何使用在另一个文件中实现的实体的体系结构?这是我所拥有的,但它是不正确的:

更新代码:

library ieee;
use ieee.std_logic_1164.all;
library Part2;
use Part2.all;


entity problem4Gates is
    port(X,Clk: in std_logic; Q: out std_logic_vector(2 downto 0)) ;
end entity problem4Gates;  

architecture behavioral OF problem4Gates IS  

for all: yourGateName use entity  Part2.JKflipFlop(jkFF); --port (J, K, Clk, Preset, Clear : in std_logic; Q, Qn : Buffer std_logic) --JKflipFlop --jkFF    
signal s0, ns0, s1, ns1, s2, na2, ps0, ps1, ps2, restart : std_logic :='0';
begin
    process(clk)
    begin                  
         yourgatename( ns0, clk, '0', restart, Q(0), ns0 );
    end process;
end architecture behavioral;

我现在收到2个错误:
# Error: COMP96_0078: Part3.vhd : (13, 10): Unknown identifier "yourGateName".
# Error: COMP96_0134: Part3.vhd : (13, 10): Cannot find component declaration.

最佳答案

How does one "include" another file from a workspace in VHDL and then use an architecure of an entity that is implemented in another file?



您不“包含文件”。 VHDL不是C。

如果编译特定实体的几种不同体系结构,则它们都可以在一个文件中,甚至可以与该实体在同一文件中,或者可以分散在多个文件中。

然后,您可以使用它们-最简单的方法是直接实例化。在更高级别的体系结构中,您可以执行以下操作:
inst_of_one_arch     : entity work.some_entity(one_arch) port map....
inst_of_another_arch : entity work.some_entity(another_arch) port map....

还有其他方法,但是它们可能会很麻烦。

关于vhdl - 在VHDL中使用另一个文件中的实体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26288447/

相关文章:

vhdl - Xilinx ISE block ram 推理的稳健性

VHDL:将数值放入 STD_LOGIC_VECTOR 变量的代码

vhdl - 如何在Xilinx中定义时钟输入

vhdl - 如何使该 VHDL 代码可综合?

logic - 4 位加减法逻辑

vhdl - 如何在 VHDL 中声明具有多个零的输出

integer - VHDL 使用什么更有效 : an integer with range or a std_logic_vector

vhdl - 将 STD_LOGIC_VECTOR 中的一位分配给 STD_LOGIC

Vhdl代码模拟

vhdl - 尝试在 VHDL 中为 logic_vector 左移逻辑 (sll)。获取错误 ["found ' 0' definitions of operator "sll"]