]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/lx-rocon.git/blob - hw/dff2.vhd
RoCoN: new mode for testlxpwrrx to capture position, PWM and current for controller...
[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     d_i     : in std_logic;
15     q_o     : out std_logic
16   );
17 end dff2;
18
19 architecture behavioral of dff2 is
20         signal d_2r   : std_logic;
21         signal d_r    : std_logic;
22   signal data_s : std_logic;
23
24         -- XST attributes
25   attribute REGISTER_DUPLICATION : string;
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_2r = d_r then
37                         data_s <= d_r;
38                 end if;
39
40                 d_2r    <= d_r;
41                 d_r     <= d_i;
42   end process;
43
44 end behavioral;