The name T flip-flop derives from the behavior of the circuit, which “toggles” its state when T = 1. The toggle
feature makes the T flip-flop a useful element for building counter circuits.
VHDL Code
entity t_ff is
port(clk,rst,t: in std_logic;
q,qbar: inout std_logic);
end t_ff;
architecture Behavioral of t_ff is
begin
process(clk,rst,t)
begin
if(rst='0') then
q<='0';
elsif(clk'event and clk='1') then
if (t='0') then
q <= q;
else
q <= not q;
end if;
end if;
end process;
qbar<= not q;
end Behavioral;
No comments:
Post a Comment