Vhdl “如何只发送一个”;1“;在输出中,即使条目保持打开状态;1“;

Vhdl “如何只发送一个”;1“;在输出中,即使条目保持打开状态;1“;,vhdl,Vhdl,我正在做一些VHDL,但我是一个初学者,我有一个用户在条目中不断发送1。我只希望我的输出像“10000000”,而不是“111111”,除非输入是“101010”,那么输出是“101010”。我试过一种粉状机器 library ieee; use ieee.std_logic_1164.ALL; use ieee.std_logic_unsigned.all; entity Button1_sync is port ( i_button1 : in std_log

我正在做一些VHDL,但我是一个初学者,我有一个用户在条目中不断发送1。我只希望我的输出像“10000000”,而不是“111111”,除非输入是“101010”,那么输出是“101010”。我试过一种粉状机器

library ieee;
use ieee.std_logic_1164.ALL;
use ieee.std_logic_unsigned.all;

entity Button1_sync is
   port (   i_button1        : in    std_logic;
            i_clk        : in    std_logic;
            i_clk_game        : in    std_logic;
            i_rst      : in    std_logic;
            o_button1_sync  : out   std_logic);
end Button1_sync;

architecture BEHAVIORAL of Button1_sync is
    type stateType is (noPressure, Pressed);
   signal state, nextState : stateType;

begin
   process(i_clk_game,i_rst)
      begin
          if (i_rst = '0') then
              state <= noPressure;
              o_button1_sync <= '0';
          elsif rising_edge(i_clk_game) then
              state <= nextState;
          end if;
   end process;

   process(state,i_button1)
      begin
          if i_button1 = '1' then
              nextState <= Pressed;
          else
              nextState <= noPressure;
          end if; 
    end process;

    o_button1_sync <= '1' when (state = noPressure and i_button1 ='1') else '0';
end Behavioral;
ieee库;
使用ieee.std_logic_1164.ALL;
使用ieee.std_logic_unsigned.all;
实体按钮1\u同步为
端口(i_按钮1:标准_逻辑中;
i_clk:标准逻辑;
i_clk_游戏:标准逻辑;
第一:标准逻辑;
o_按钮1_同步:输出标准逻辑);
结束按钮1_同步;
按钮1\u sync的架构是
类型stateType为(无压力,已按下);
信号状态,下一状态:stateType;
开始
过程(i_clk_游戏,i_rst)
开始
如果(i_rst='0'),则

状态最简单的方法是将输入信号移位一个时钟周期,如(在过程中):

例如,在流程中的IF中。该表达式表示信号在上一个时钟为“0”,而在当前时钟为“1”,因此只是上升了。
使用“1”和“0”进行测试以在下降沿(之后)的“1”处获得唯一脉冲也是很常见的。

然后,如果需要,您可以将此表达式与其他表达式(例如,可能是一个或与输入或同一脉冲再移动一个周期)组合,以保持信号向上或向下

是的,现在我修改了使用你解释的方式,但是我的输出是“U”型的,如果你仍然使用你发布的代码,要知道输出o_按钮1_sync不能同时在(第一个)进程和外部(第二个进程之后),因为你要尝试驱动信号两次,得到“U”或“X”是的,然后我做了一些修改,它工作了!感谢您的帮助按钮1\u同步被驱动两次,从一个进程开始,在代码的最后一行!
i_button1_d <= i_button1;
i_button1_d = '0' and i_button1 = '1'