sel.vhd

来自「FPGA设计的时钟!很特别」· VHDL 代码 · 共 28 行

VHD
28
字号
--************************************************************************--
--数码管选通信号程序
--说明:将6个数码管轮流选通,从而实现对数码观的扫描。
--************************************************************************--

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity sel is
port( f2hz : in std_logic;
	      q   : out std_logic_vector(2 downto 0) );
end sel;
architecture behv of sel is
	signal	temp : std_logic_vector(2 downto 0);
begin
	process( f2hz )
	begin
		if ( f2hz'event and f2hz='1' ) then
			if temp="101" then		--temp从0到5使6个数码管轮流选通
				temp<="000";
			else
				temp<=temp+1;
			end if;
		end if;
	end process;
	q<=temp;
end behv;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?