[Menu]>[CPLD]>[8bits Latch Register]


Source code and Explanation
for 8bits Latch Register

001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017
018
019
020
021
022
023
024
025
026
027
028
--******************************************************************************
--*                                                                            *
--*                           8 bits Latch Register                            *
--*                                                     Device : XC9536-PC44   *
--*                                                     Author : Seiichi Inoue *
--******************************************************************************

library ieee;                                    -- Defines std_logic types
use ieee.std_logic_1164.all;

entity Latch1 is
  port ( DIN : in std_logic_vector(7 downto 0);  -- Defines ports
         CLK : in std_logic;
         Q : out std_logic_vector(7 downto 0));
end Latch1;

architecture Latch1_arch of Latch1 is
begin
  process( CLK ) begin
    if CLK='1' and CLK'event then                -- Clock rising edge ?
      Q <= DIN;                                  -- Latch data
    end if;
  end process;
end Latch1_arch;

--******************************************************************************
--*                        end of 8 bits Latch Register                        *
--******************************************************************************

Explanation
Line #Comment
009The std_logic library is specified.
012
-014
The pins of the input/output are specified.
020The rising edge of the CLK signal is judged.
021When CLK rising, input data(DIN) are memorized at registers(Q) and are output.