---------------------------------------------------------------------------- -- Lawrence Berkeley National Laboratory (c) 1997 -- BaBar Trigger Electronics ---------------------------------------------------------------------------- -- Description: -- 16 bit wide synchronous latch ---------------------------------------------------------------------------- -- Author: Armin Karcher -- History: -- Karcher 03/97 - First Version ---------------------------------------------------------------------------- library IEEE; use IEEE.std_logic_1164.all; ---------------------------------------------------------------------------- --PORT DECLARATION ---------------------------------------------------------------------------- entity latch16 is port (clk : in std_logic; -- clk60 input, distributed rst : in std_logic; -- global reset enable : in std_logic; -- enable latch data_in : in std_logic_vector(15 downto 0); -- data in data_out: out std_logic_vector(15 downto 0) -- latched data ); end latch16; architecture rtl of latch16 is ---------------------------------------------------------------------------- --SIGNAL DECLARATION ---------------------------------------------------------------------------- signal reg_val: std_logic_vector(15 downto 0); -- latched data begin ---------------------------------------------------------------------------- --PROCESS DECLARATION ---------------------------------------------------------------------------- lat: process (clk,rst,enable) begin if (rst = '1') then reg_val <= "0000000000000000"; elsif (clk'event and clk = '1' ) then if (enable = '1') then reg_val <= data_in; -- synchronous latch end if; end if; end process; ---------------------------------------------------------------------------- --OUTPUT ASSIGNMENTS ---------------------------------------------------------------------------- data_out <= reg_val; end rtl;