用两个输入驱动一个输出vhdl

时间:2018-05-01 21:30:49

标签: vhdl fpga

我从VHDL开始。我的代码非常简单,我用一个进程来打开/关闭LED,这个进程需要clk上升沿并在“t”变量中计算时钟的cicles:

entity leds_vhdl is
    Port ( clk : in  STD_LOGIC;
           led1 : out  STD_LOGIC;
           led2: out  STD_LOGIC;
           change : in STD_LOGIC);
   end leds_vhdl;

architecture Behavioral of leds_vhdl is

constant t1s : integer := 50000000;

begin
process (clk)
variable t : integer := 0;
begin
    if (rising_edge(clk)) then
        t := t + 1;
        if (t > 5*t1s) then 
            t := 0;
        if (t <= 3*t1s) then
                led1 <= '0';
                led2 <= '0';
        elsif (t > 3*t1s and t <= 5*t1s) then
                led1 <= '1';
                led2 <= '1';
        end if;
end if;
end process;
end Behavioral;

现在,我想在输入的不同状态“改变”时修改LED。例如,如果“更改”为“1”,我该如何更改LED? (例如,led1 ='1',led2 ='0')。 ¿有可能在同一个过程中完成,或者更好地做另一个过程吗? 我一直在尝试,但是我已经在sinthetizing阶段有这么多的问题。

非常感谢。

0 个答案:

没有答案
相关问题