]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/dff2.vhd
Update dff2, create dff3, fix LX Master for multiple slaves
[fpga/lx-cpu1/lx-rocon.git] / hw / dff2.vhd
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.std_logic_arith.all;
4 use ieee.std_logic_unsigned.all;
5 use ieee.numeric_std.all;
6 use work.lx_rocon_pkg.all;
7
8 -- D circuit (filtered)
9
10 entity dff2 is
11   port
12         (
13     clk_i   : in std_logic;
14                 reset_i : in std_logic;
15     d_i     : in std_logic;
16     q_o     : out std_logic
17   );
18 end dff2;
19
20 architecture behavioral of dff2 is
21         signal d_2r   : std_logic;
22         signal d_r    : std_logic;
23   signal data_s : std_logic;
24 begin
25   q_o <= data_s;
26
27 seq:
28         process
29         begin
30     wait until clk_i'event and clk_i = '1';
31                 if reset_i = '1' then
32                         d_r    <= '0';
33                         data_s <= '0';
34                 elsif d_2r = d_r then
35                         data_s <= d_r;
36                 end if;
37
38                 d_2r    <= d_r;
39                 d_r     <= d_i;
40   end process;
41
42 end behavioral;