scandisp.vhd

来自「VHDL 在MAXPLUS环境下运行」· VHDL 代码 · 共 38 行

VHD
38
字号
library ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_unsigned.all;
--use ieee.std_logic_arith.all;

entity ScanDisp is
  port(
	clk1KHZ,reset:	in std_logic;
	outdis:	in std_logic_vector(15 downto 0);
	one:	out std_logic_vector(3 downto 0);
	SS:	 inout std_logic_vector(2 downto 0));
  end ScanDisp;

  ARCHITECTURE arch OF ScanDisp IS
  BEGIN

	scan:PROCESS(clk1KHZ,reset)
	BEGIN
	  if(reset = '0') then
		SS <= "111";
	  elsif(clk1KHZ'event and clk1KHZ = '1') then
		if(SS > 4) then
		   SS <= SS - '1';
		else
		   SS <= "111";
		end if;
	  end if;
	END PROCESS scan;

	WITH SS SELECT
	  one <= outdis(3 downto 0)   WHEN "111",
		 	 outdis(7 downto 4)   WHEN "110",
		 	 outdis(11 downto 8)  WHEN "101",
		 	 outdis(15 downto 12) WHEN OTHERS;

  END arch;

⌨️ 快捷键说明

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