button2.vhd
来自「总体演示程序DEMO_FPGA.rar」· VHDL 代码 · 共 70 行
VHD
70 行
--------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 22:39:20 03/24/05
-- Design Name:
-- Module Name: button2 - Behavioral
-- Project Name:
-- Target Device:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
--------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity button2 is
Port ( clk : in std_logic;
ibutton : in std_logic;
obutton : out std_logic);
end button2;
architecture Behavioral of button2 is
type state is (st0,st1,st2,st3);
signal current_state : state;
begin
process(clk)
begin
if rising_edge(clk) then
case current_state is
when st0=>
obutton<='1';
current_state<=st1;
when st1=>
obutton<='0';
current_state<=st2;
when st2=>
if ibutton='1' then
current_state<=st0;
end if;
when st3=>
if ibutton='0' then
current_state<=st1;
end if;
when others=>
current_state<=st0;
end case;
end if;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?