我通过在线阅读书籍(Free Range VHDL)来学习 VHDL,并通过 Xilinx ISE Webpack 14.7 在我的 Nexsys2 上实施示例。我正在重新阅读 Free Range VHDL 文本,目前正在讨论流程的章节中。我对流程是什么以及它是如何工作的有深刻的理解,但是我实施了一个例子,但我不理解结果。
我使用以下代码实现了 8 比 1 多路复用器。
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux81 is
port( d_in : in std_logic_vector(7 downto 0);
sel : in std_logic_vector(2 downto 0);
ce : in std_logic;
F : out std_logic);
end mux81;
architecture my_mux81 of mux81 is
begin
mux_proc: process(d_in, sel, ce)
begin
if (ce = '1') then
if (sel = "111") then
F <= d_in(7);
elsif (sel = "110") then
F <= d_in(6);
elsif (sel = "101") then
F <= d_in(5);
elsif (sel = "100") then
F <= d_in(4);
elsif (sel = "011") then
F <= d_in(3);
elsif (sel = "010") then
F <= d_in(2);
elsif (sel = "001") then
F <= d_in(1);
elsif (sel = "000") then
F <= d_in(0);
else
F <= '0';
end if;
else
F <= '0';
end if;
end process mux_proc;
end my_mux81;
仅当“ce”信号为“1”时才执行多路复用器操作。一切都按预期工作。然后我通过从灵敏度列表中删除“ce”信号尝试了一个实验。根据我对流程语句的理解,它应该仅在敏感度列表中的信号发生变化时执行。通过移除“ce”信号,电路不应单独响应“ce”变化。这是修改后的电路:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity mux81 is
port( d_in : in std_logic_vector(7 downto 0);
sel : in std_logic_vector(2 downto 0);
ce : in std_logic;
F : out std_logic);
end mux81;
architecture my_mux81 of mux81 is
begin
mux_proc: process(d_in, sel)
begin
if (ce = '1') then
if (sel = "111") then
F <= d_in(7);
elsif (sel = "110") then
F <= d_in(6);
elsif (sel = "101") then
F <= d_in(5);
elsif (sel = "100") then
F <= d_in(4);
elsif (sel = "011") then
F <= d_in(3);
elsif (sel = "010") then
F <= d_in(2);
elsif (sel = "001") then
F <= d_in(1);
elsif (sel = "000") then
F <= d_in(0);
else
F <= '0';
end if;
else
F <= '0';
end if;
end process mux_proc;
end my_mux81;
如您所见,唯一的变化是从敏感度列表中删除了“ce”。然而,当我实现这个电路时,它的运行方式与灵敏度列表中包含“ce”的版本完全一样。换句话说,保持信号“d_in”和“sel”不变,但修改“ce”会导致流程语句执行并更改输出信号,就好像“ce”仍在敏感列表中一样。运行合成时,我没有收到任何警告。就像程序假设'ce'也应该被监控,但我认为这也应该产生一个警告......
谢谢您的帮助!