I have this very simple VHDL code that should implement a flip-flop with asynchronous (active low) Set and Reset. The clock (Clk) has no oscillator connected to the pin, only an input I can toggle with a switch. The code have been implemented on a real device and works as intended.
I have two questions to this:
Since no "real" clock is used would it have been better to replace the
rising_edge(Clk)and simply used aelsif Clk = '1'?If this can be considered as a pure combinatorial circuit, would it work better in a CPLD?
library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity Flip_Flop is port( Clk, CLR, PRE, D : in std_logic; Q, Q_not : out std_logic); end Flip_Flop; architecture Behavioral of Flip_Flop is begin process (Clk, CLR, PRE) is begin if CLR = '0' then Q <= '0'; Q_not <= '1'; elsif PRE = '0' then Q <= '1'; Q_not <= '0'; elsif rising_edge(Clk) then Q <= D; Q_not <= not D; end if; end process; end Behavioral;