d_flip_flop.vhd

来自「是一些很好的FPGA设计实例」· VHDL 代码 · 共 37 行

VHD
37
字号
--**                       D触发器

--文件名:D_flip_flop.vhd

--功  能:D触发器

--说  明:以拨盘开关作为数据输入端,用发光二极管来反映锁存的数据;

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity D_flip_flop is
    Port (clk : in std_logic;	  --时钟信号;
	       reset : in std_logic; --异步复位;
	       datain : in std_logic_vector(7 downto 0);  --输入数据;
			 cs  : out std_logic_vector(1 downto 0);  ----数码管、发光二极管片选信号;
			 q   : out std_logic_vector(7 downto 0) );--输出数据;
end D_flip_flop;

architecture Behavioral of D_flip_flop is

begin

cs<="01";       --选通发光二极管;

process(clk,reset)
begin
   if reset='0' then q<="00000000";
   elsif clk'event and clk='1' then
	   q<=datain;
   end if;
end process;

end Behavioral;

⌨️ 快捷键说明

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