xiaodou2.vhd
来自「本源码用VHDL语言实现了用键盘控制米字管显示十进制」· VHDL 代码 · 共 51 行
VHD
51 行
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 xiaodou2 is
port ( gclk : in std_logic;
shuru : in std_logic;
rst : in std_logic;
rxout : out std_logic);
end xiaodou2;
architecture Behavioral of xiaodou2 is
signal count : std_logic_vector(2 downto 0);
signal dout : std_logic;
begin
process (gclk,rst)
begin
if rst = '1' then
rxout <= '0';
dout <= '0';
count <= "000";
elsif gclk ' event and gclk = '1' then
if (shuru = '0') and (count(2) = '0') and (dout = '1') then
dout <= '1';
count <= count+1;
elsif (shuru = '0') and (count(2) = '1') and (dout = '1') then
dout <= '0';
count <= "000";
elsif (shuru = '1') and (count(2) = '0') and (dout = '0') then
dout <= '0';
count <= count+1;
elsif (shuru = '1') and (count(2) = '1') and (dout = '0') then
dout <= '1';
count <= "000";
else
rxout <= dout;
count <= "000";
end if;
end if;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?