gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 15:22:09 25 4
gpt4 key购买 nike

如何从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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com