Sie sind auf Seite 1von 3

 JK Flip Flop

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

ENTITY jkff_jkff_test_vhd_tb IS
END jkff_jkff_test_vhd_tb;

ARCHITECTURE behavior OF jkff_jkff_test_vhd_tb IS

COMPONENT jkff
PORT(
clk : IN std_logic;
reset : IN std_logic;
j : IN std_logic;
k : IN std_logic;
q : INOUT std_logic;
qbar : INOUT std_logic
);
END COMPONENT;

SIGNAL clk : std_logic:='0';


SIGNAL reset : std_logic;
SIGNAL j : std_logic;
SIGNAL k : std_logic;
SIGNAL q : std_logic;
SIGNAL qbar : std_logic;
signal temp:std_logic_vector(2 downto 0):="000";
signal qpre:std_logic;

BEGIN

uut: jkff PORT MAP(


clk => clk,
reset => reset,
j => j,
k => k,
q => q,
qbar => qbar
);
-- *** Test Bench - User Defined Section ***
cktest : PROCESS
BEGIN
clk<= not clk;
wait for 1 ns;

END PROCESS;

tb : PROCESS
BEGIN

reset<='1';
qpre<=temp(2);
j<=temp(1);
k<=temp(0);
wait for 3 ns;

assert q = not((j and (not q)) or ((not k) and q))


severity NOTE;
report "Correct output of JK flip flop";
temp<=temp+1;

assert now <= 50 ns


severity FAILURE;

END PROCESS;

-- *** End Test Bench - User Defined Section ***

END;

Simulation Result
# ** Note: Correct output of JK flip flop
# Time: 3 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 6 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 9 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 9 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 12 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 12 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 15 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 18 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 18 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 21 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 21 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 24 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 24 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 27 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 30 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 30 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 33 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 33 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Assertion violation.
# Time: 36 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop
# Time: 36 ns Iteration: 0 Instance: /jkff_jkff_test_vhd_tb
# ** Note: Correct output of JK flip flop