使用自定义库模拟 VHDL 设计
Simulating a VHDL design using custom libraries
我正在尝试制作一个简单的VHDL 项目来提高我的记忆力。我正在使用文件 half_adder.vhd 创建另一个我希望模拟的文件 full_adder.vhd。这些文件不在同一个项目中。我使用的是 Xilinx ISE 14.7 版。
我的代码综合得很好,并通过了语法检查。我还可以创建 RTL 原理图。但是,每当我尝试为全加器创建测试台时,我都会收到以下错误消息:
ERROR:HDLParsers:3317 - "E:/workspaceXilinx/FullAdder/full_adder.vhd" Line 23.
Library half_adder cannot be found.
ERROR:HDLParsers:3513 - "E:/workspaceXilinx/FullAdder/full_adder.vhd" Line 24.
Declaration all can not be made visible in this scope since design unit
half_adder is not a package.
我已经将half_adder.vhd添加到work库中,所以我不确定为什么找不到该库.这是我正在使用的两个文件:
half_adder.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity half_adder is
port(a, b: in STD_LOGIC;
s, c: out STD_LOGIC);
end half_adder;
architecture Behavioral of half_adder is
begin
s <= a xor b;
c <= a and b;
end Behavioral;
full_adder.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library half_adder;
use half_adder.all;
entity full_adder is
port (a, b, cin: in STD_LOGIC;
s, cout: out STD_LOGIC);
end full_adder;
architecture Behavioral of full_adder is
signal s1, c1, c2: STD_LOGIC:='0';
begin
HA1: entity work.half_adder port map(a, b, s1, c1);
HA2: entity work.half_adder port map(s1, cin, s, c2);
cout <= c1 or c2;
end Behavioral;
work
库指的是当前正在编译的库。如果您没有在设计工具中明确创建一个 half_adder
库,它就不会存在。您需要做的就是删除与 half_adder
有关的 library
和 use
子句;不需要。
我正在尝试制作一个简单的VHDL 项目来提高我的记忆力。我正在使用文件 half_adder.vhd 创建另一个我希望模拟的文件 full_adder.vhd。这些文件不在同一个项目中。我使用的是 Xilinx ISE 14.7 版。
我的代码综合得很好,并通过了语法检查。我还可以创建 RTL 原理图。但是,每当我尝试为全加器创建测试台时,我都会收到以下错误消息:
ERROR:HDLParsers:3317 - "E:/workspaceXilinx/FullAdder/full_adder.vhd" Line 23. Library half_adder cannot be found.
ERROR:HDLParsers:3513 - "E:/workspaceXilinx/FullAdder/full_adder.vhd" Line 24. Declaration all can not be made visible in this scope since design unit half_adder is not a package.
我已经将half_adder.vhd添加到work库中,所以我不确定为什么找不到该库.这是我正在使用的两个文件:
half_adder.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity half_adder is
port(a, b: in STD_LOGIC;
s, c: out STD_LOGIC);
end half_adder;
architecture Behavioral of half_adder is
begin
s <= a xor b;
c <= a and b;
end Behavioral;
full_adder.vhd
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
library half_adder;
use half_adder.all;
entity full_adder is
port (a, b, cin: in STD_LOGIC;
s, cout: out STD_LOGIC);
end full_adder;
architecture Behavioral of full_adder is
signal s1, c1, c2: STD_LOGIC:='0';
begin
HA1: entity work.half_adder port map(a, b, s1, c1);
HA2: entity work.half_adder port map(s1, cin, s, c2);
cout <= c1 or c2;
end Behavioral;
work
库指的是当前正在编译的库。如果您没有在设计工具中明确创建一个 half_adder
库,它就不会存在。您需要做的就是删除与 half_adder
有关的 library
和 use
子句;不需要。