Module of D Flip Flop
Module of D Flip Flop
Module of D Flip Flop
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity d2f is
Port ( d : in STD_LOGIC;
clk : in STD_LOGIC;
Q : inout STD_LOGIC;
Qn : inout STD_LOGIC);
end d2f;
begin
Qn<=B NAND Q;
end Behavioral;
Output -
Test bench d flip flop -
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
ENTITY d2fff IS
END d2fff;
COMPONENT d2f
PORT(
d : IN std_logic;
clk : IN std_logic;
Q : INOUT std_logic;
Qn : INOUT std_logic
);
END COMPONENT;
--Inputs
--BiDirs
signal Q : std_logic;
signal Qn : std_logic;
BEGIN
d => d,
Q => Q,
Qn => Qn
);
-- clk_process :process
-- begin
-- end process;
-- Stimulus process
stim_proc: process
begin
clk<='0';
d<='1';
clk<='0';
d<='0';
clk<='0';
d<='0';
clk<='1';
d<='1';
clk<='1';
d<='0';
clk<='1';
d<='1';
wait for 100 ns;
clk<='1';
d<='0';
wait;
end process;
Output -
Module Of T Flip Flop -
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity TFF is
Port ( T : in STD_LOGIC;
clk : in STD_LOGIC;
clr : in STD_LOGIC;
Q : out STD_LOGIC);
end TFF;
signal A: STD_LOGIC;
begin
process(clk,clr)
begin
if clr='1' then
A<='0';
if T='0' then
A<=A;
A<=not(A);
end if;
end if;
end process;
Q<=A;
end Behavioral;
Output -