Gated SR latch

Gated SR latch, also known as clocked SR latch or synchronous SR latch or SR flip-flop can be used as register 1:

Output Inverted Output Set Reset S E R Q Q Enable/Clock

Gated/clocked SR latch

Q Q' S E R

Gated SR latch constructed with four NAND gates

Again corresponding VHDL snippet:

library ieee;
use ieee.std_logic_1164.all;

entity sr_latch is
    port (
        s   : in    std_logic;
        r   : in    std_logic;
        q   : inout std_logic;
        q_n : inout std_logic);
end sr_latch;

architecture behavioral of sr_latch is
    q   <= r nand q_n;
    q_n <= s nand q;
end behavioral;

For instance single SR latch could be implemented using single SN7400N 2 integrated circuit:

SN7400N integrated circuit contains four NAND gates




VHDL KTH latch SR latch