VHDL for FPGA Design/D Flip Flop

From Wikibooks, open books for an open world
< VHDL for FPGA Design
Jump to: navigation, search

Synchronous Positive Edge Triggered D Flip-Flop with Active-High Reset, Preset, and Clock Enable[edit]

library IEEE;

entity D_FF_VHDL is
      clk : in std_logic;

      rst : in std_logic;
      pre : in std_logic;
      ce  : in std_logic;
      d : in std_logic;

      q : out std_logic
end entity D_FF_VHDL;
architecture Behavioral of D_FF_VHDL is
   process (clk) is
      if rising_edge(clk) then  
         if (rst='1') then   
            q <= '0';
         elsif (pre='1') then
            q <= '1';
         elsif (ce='1') then
            q <= d;
         end if;
      end if;
   end process;
end architecture Behavioral;

Simulation Results[edit]

 DFF Final.png

Generated Symbol[edit]

 File:D FF SCH F.png