Open main menu

Wikibooks β

VHDL for FPGA Design/T Flip Flop

< VHDL for FPGA Design

Synchronous Positive edge T Flip-Flop with Reset and Clock enableEdit

library IEEE;

entity t_trigger is
   port (T,Reset,CLK,CLK_enable: in std_logic;
	 Q: out std_logic);
end t_trigger;
architecture beh_t_trigger of t_trigger is	 
	signal temp: std_logic;
    process (Reset,CLK) 
        if (rising_edge(CLK)) then    --sometimes you need to include a package for rising_edge, you can use CLK'EVENT AND CLK = '1' instead
            if Reset='1' then   
                temp <= '0';  		
            elsif CLK_enable ='1' then
                temp <= T xor temp;
            end if;
        end if; 
    end process;
    Q <= temp;	   
end beh_t_trigger;

Simulation ResultsEdit


Generated SymbolEdit