📄 jk_flip_flop.vhd
字号:
--** J K 触 发 器
--文件名:JK_flip_flop.vhd
--功 能:JK触发器
--说 明:“q”采用发光二极管来表示;
-- “set”、“reset”分别用按键S3,S4来表示;
--**注意:按键是'0'有效,默认是'1'电平; 片选信号(cs)为高电平选通;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity JK_flip_flop is
Port (j : IN STD_LOGIC; --用拨盘开关来实现J;
k : IN STD_LOGIC; --用拨盘开关来实现K;
set : in std_logic; --异步置位端;
reset : in std_logic; --异步复位端;
clk : IN STD_LOGIC; --时钟信号;
cs : out std_logic_vector(1 downto 0);
q : OUT STD_LOGIC_vector(7 downto 0) ); --输出信号;
end JK_flip_flop;
architecture Behavioral of JK_flip_flop is
signal q_temp : std_logic;
begin
cs<="01";
process(clk)
variable jk_temp : std_logic_vector(1 downto 0);
begin
if reset='0' then q_temp<='0';
elsif set='0' then q_temp<='1';
elsif clk'event and clk='1' then
jk_temp:=(j&k);
case jk_temp is
when "01" => q_temp<='0';
when "10" => q_temp<='1';
when others => null;
end case;
end if;
q(0)<=q_temp;
q(7 downto 1)<="1111111";--为了便于观察,将不必要的发光二极管熄灭;
end process;
end Behavioral;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -