]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/dff3.vhd
RoCoN: new mode for testlxpwrrx to capture position, PWM and current for controller...
[fpga/lx-cpu1/lx-rocon.git] / hw / dff3.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 dff3 is
11   port
12         (
13     clk_i   : in std_logic;
14     d_i     : in std_logic;
15     q_o     : out std_logic
16   );
17 end dff3;
18
19 architecture behavioral of dff3 is
20         signal d_3r   : std_logic;
21   signal d_2r   : std_logic;
22         signal d_r    : std_logic;
23   signal data_s : std_logic;
24
25         -- XST attributes
26   attribute REGISTER_DUPLICATION : string;
27         attribute REGISTER_DUPLICATION of d_3r : signal is "NO";
28         attribute REGISTER_DUPLICATION of d_2r : signal is "NO";
29         attribute REGISTER_DUPLICATION of d_r  : signal is "NO";
30
31 begin
32   q_o <= data_s;
33
34 seq:
35         process
36         begin
37     wait until clk_i'event and clk_i = '1';
38                 if d_3r = d_2r and d_2r = d_r then
39                         data_s <= d_3r;
40                 end if;
41
42                 d_3r <= d_2r;
43                 d_2r <= d_r;
44                 d_r  <= d_i;
45   end process;
46
47 end behavioral;