VHDL进程与灵敏度列表的混淆

VHDL进程与灵敏度列表的混淆,vhdl,xilinx-ise,Vhdl,Xilinx Ise,我通过在线阅读书籍(自由范围VHDL)学习VHDL,并通过Xilinx ISE网页14.7在我的Nexsys2上实现示例。我正在重读自由范围的VHDL文本,目前正在讨论过程。我对过程是什么以及它是如何工作的有着坚实的理解,但是我实现了一个示例,我不理解结果 我使用以下代码实现了一个8到1的多路复用器 library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity mux81 is port( d_in : in std_logic_vector(7

我通过在线阅读书籍(自由范围VHDL)学习VHDL,并通过Xilinx ISE网页14.7在我的Nexsys2上实现示例。我正在重读自由范围的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;
IEEE库;
使用IEEE.STD_LOGIC_1164.ALL;
实体mux81是
端口(d_in:标准逻辑向量(7到0);
sel:标准逻辑向量(2到0);
ce:标准逻辑;
F:输出标准(U逻辑);
末端mux81;
mux81的体系结构my_mux81是
开始
mux_过程:过程(d_-in、sel、ce)
开始
如果(ce='1'),则
如果(sel=“111”),则

灵敏度列表被许多综合工具所忽略。检查合成工具中的警告,您可能会发现它警告丢失的CE信号

不完整的敏感度列表是导致问题的一个臭名昭著的原因,因为模拟和合成后的行为不一样

通常,您不希望使用电平敏感闩锁。它们会引起各种各样的麻烦,而且比普通的旧同步逻辑更难验证


如果您真的想创建一个级别敏感锁存器,您应该实例化由FPGA供应商提供的锁存器,或者找出使用哪种编码风格使合成工具推断闩锁。

我认为可能的重复解释了合成工具没有义务生成逻辑将在非敏感列表输入的更改中保留值。自由范围文本非常糟糕。让你的“sel”端口成为一个合适的自然范围的子类型,整个内部
if
语句减少到
F“敏感度列表被许多合成工具忽略了。”我不知道!那么它主要用于模拟吗?@radensb是的。检查灵敏度列表中的每个信号是否有事件,如果有,则计算结果。此列表中的信号越少,意味着计算量越少,可以提高模拟速度。这是由顺序过程(带有时钟)使用的,该顺序过程仅在灵敏度列表中列出时钟信号,如果需要,还可以列出复位等异步信号,因为只有在时钟切换时才能发生信号转换。
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;