【问题标题】:Making a single-input DeMultiplexer制作单输入解复用器
【发布时间】:2021-01-07 00:34:16
【问题描述】:

我编写了一个代码来制作一个带有 1 个选择器的 3-1 多路复用器,该选择器通过选择器脉冲工作,这是我在下面编写的代码。 但是,输出仅在 if 条件下分配给输入及其机会。如何让它在改变时始终分配给该值?

library ieee;
use ieee.std_logic_1164.all;

entity selector is
port( ip,selec: in std_logic;
        a,b,c: inout std_logic);
end selector;

architecture Behaviour of selector is
signal temp : std_logic;
begin
    process(selec)
    begin
        if (selec'EVENT and selec ='1') then
            if(a = ip) then
                temp<= b;
            elsif (b = ip) then
                temp <= c;
            else
                temp <= a;
            end if;
        end if;
    end process;
end if;
    
end Behaviour;

我只使用 ModelSim,因为我无法访问硬件进行测试:(

【问题讨论】:

    标签: vhdl quartus


    【解决方案1】:

    在您的流程中,您只在敏感度列表中包含了 selec。因此对 temp 的分配只发生在 select 事件上。

    这将更适合条件赋值。 https://www.ics.uci.edu/~jmoorkan/vhdlref/cond_s_a.html

    signal_name <= expression_1 when condition_1 else
                   expression_2 when condition_2 else
                   expression_3 ;
    

    【讨论】:

    • 这个表达式不起作用,因为我正在分配输入以从特定输出(多路复用器)输出,并且它不能应用于时序电路,我试图在这里制作
    • 您是否尝试将其他信号添加到过程敏感度列表中?
    猜你喜欢
    • 1970-01-01
    • 2020-10-13
    • 1970-01-01
    • 2017-02-08
    • 2014-01-09
    • 2022-01-05
    • 2013-03-14
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多