Latches

Introduction

Latch is simple, transparent, not clocked, asynchronous, level-sensitive opposed to flip-flop which is edge-triggered, opaque, clocked, synchronous, edge-sensitive.

SR latch as memory element

For instance SR latch can essentially be used to store one bit of information 1:

Output Inverted Output Inverted set Inverted reset S R Q Q

SR-latch symbol, inverted output may be omitted.

There are various ways to implement SR latch using gates:

Q S' R' Q'

SR latch constructed with two NAND gates

Corresponding concurrent VHDL snippet would be:

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
begin
    q   <= r nand q_n;
    q_n <= s nand q;
end behavioral;

Replacing NAND operation with NOR should yield in equivalent circuit with inputs and outputs inverted however such circuit gets stuck in an unstable state. Attempting to simulate such circuit using GHDL results in following error message:

./srlatch_testbench:error: simulation stopped by --stop-delta

This means that GHDL has stopped simulation because states could not settle within --stop-delta=N delta cycles without progressing time.

1

http://www.it.kth.se/courses/IL2217/F4_2.pdf

2

http://quarndon.co.uk/index.php?main_page=product_info&products_id=12966

3

http://www.play-hookey.com/digital/sequential/d_nand_latch.html

flip-flop VHDL SR latch KTH latch D latch