3.6 STEP 6: A Register

3.6.1 Synopsis

When an exposure time is selected by the user it has to be stored. Edge-triggered Flip-Flops are used for this purpose. The contents of the register are updated only with the rising edge of the clock signal. This way, differences in the path delay become irrelevant as long as the maximum delay is shorter than the clock period.

In addition to the clock signal a second enabling condition is needed in this case. Valid exposure times shall be stored until another exposure time is selected. Only legal button combinations are mapped to display values other than (0,0,0) by the decoder, i.e. it is sufficient to exclude this value triple from being stored.

The reset input signal is necessary to be able to bring the chip into a defined state, e.g. after power-up.

The complete interface of the register is shown in the following figure:

 

The exposure time latch

 
             if RESET
                 ...
             elsif RISING_CLOCK_EDGE
                 ...

3.6.2 Implementation

The exposure latch code

library ieee;
use ieee.std_logic_1164.all;
use work.P_DISPLAY.all;

entity EXP_FF is
port(CLK : in  std_ulogic;
     RESET : in  std_ulogic;
     KEY : in  T_DIGITS;
     EXP_TIME : out T_DIGITS);
end EXP_FF;

architecture RTL of EXP_FF is
begin
  process(CLK, RESET)
  begin
    if (RESET = '1') then
      EXP_TIME <= (0,0,1);

    elsif (CLK'event and CLK = '1') then



      if (KEY /= (0,0,0)) then
        EXP_TIME <= KEY;
      end if;
    end if;
  end process;
end RTL;
                       
  • As the reset signal is evaluated asyn-
    chronously it has to be included in
    the sensitivity list.
  • The following code is executed after
    each rising clock edge
  • The decoder output is set to (0,0,0) if
    no or several keys are pressed. Other
    values signal a valid exposure time
    that has to be stored