]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-dad.git/blob - hw/dff3.vhd
extended memotry for 2 samples of sensor data
[fpga/lx-cpu1/lx-dad.git] / hw / dff3.vhd
1 library ieee;
2 use ieee.std_logic_1164.all;
3 use ieee.numeric_std.all;
4 use work.lx_dad_pkg.all;
5
6 -- D circuit (filtered)
7
8 entity dff3 is
9   port
10         (
11     clk_i   : in std_logic;
12     d_i     : in std_logic;
13     q_o     : out std_logic
14   );
15 end dff3;
16
17 architecture behavioral of dff3 is
18         signal d_3r   : std_logic;
19   signal d_2r   : std_logic;
20         signal d_r    : std_logic;
21   signal data_s : std_logic;
22
23         -- XST attributes
24   attribute REGISTER_DUPLICATION : string;
25         attribute REGISTER_DUPLICATION of d_3r : signal is "NO";
26         attribute REGISTER_DUPLICATION of d_2r : signal is "NO";
27         attribute REGISTER_DUPLICATION of d_r  : signal is "NO";
28
29 begin
30   q_o <= data_s;
31
32 seq:
33         process
34         begin
35     wait until clk_i'event and clk_i = '1';
36                 if d_3r = d_2r and d_2r = d_r then
37                         data_s <= d_3r;
38                 end if;
39
40                 d_3r <= d_2r;
41                 d_2r <= d_r;
42                 d_r  <= d_i;
43   end process;
44
45 end behavioral;