~ruther/vhdl-spi-2

ref: dc0e370ab44f26ba06f5e709c826cb73b3c15fd8 vhdl-spi-2/hdl_spi/src/register.vhd -rw-r--r-- 719 bytes
dc0e370a — Rutherther feat: implement initial hdl_spi 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
library ieee;
use ieee.std_logic_1164.all;


entity reg is

  generic (
    SIZE : natural := 1);

  port (
    clk_i   : in  std_logic;
    rst_in  : in  std_logic;
    d_i     : in  std_logic_vector(SIZE - 1 downto 0);
    q_o     : out std_logic_vector(SIZE - 1 downto 0);
    latch_i : in  std_logic);

end entity reg;

architecture a1 of reg is

begin  -- architecture a1

  set_q: process (clk_i) is
  begin  -- process set_q
    if rising_edge(clk_i) then          -- rising clock edge
      if rst_in = '0' then              -- synchronous reset (active low)
        q_o <= (others => '0');
      elsif latch_i = '1' then
        q_o <= d_i;
      end if;
    end if;
  end process set_q;

end architecture a1;
Do not follow this link