lemueltra

ffjk

Feb 16th, 2017
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.61 KB | None | 0 0
  1. -- Descrição do flip-flop JK
  2. library ieee;
  3. use ieee.std_logic_1164.all;
  4.  
  5. entity ffjk is
  6.     port(
  7.         j: in std_logic;
  8.         k: in std_logic;
  9.         clk: in std_logic;
  10.         clr: in std_logic;
  11.         q: out std_logic
  12.         );
  13. end ffjk;
  14.  
  15. architecture funcional of ffjk is
  16. signal qaux: std_logic := '0';
  17. begin
  18.     process(clk,clr)
  19.     begin
  20.         if clr = '0' then
  21.             qaux <= '0';
  22.         elsif falling_edge(clk) then
  23.             if j = '0' and k = '1' then
  24.                 qaux <= '0';
  25.             elsif j = '1' and k = '0' then
  26.                 qaux <= '1';
  27.             elsif j = '1' and k = '1' then
  28.                 qaux <= not qaux;
  29.             end if;
  30.         end if;
  31.     end process;
  32.     q <= qaux;
  33. end funcional;
Advertisement
Add Comment
Please, Sign In to add comment