]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blob - pmsm-control/dff3.vhdl
Dff3 filter added to irc inputs.
[fpga/rpi-motor-control.git] / pmsm-control / dff3.vhdl
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         --potlaceni duplikace klupnych obvodu ve fazi optimalizace
27         --attribute REGISTER_DUPLICATION : string;
28         --attribute REGISTER_DUPLICATION of d_3r : signal is "NO";
29         --attribute REGISTER_DUPLICATION of d_2r : signal is "NO";
30         --attribute REGISTER_DUPLICATION of d_r  : signal is "NO";
31         
32         attribute syn_keep : boolean;
33         attribute syn_keep of d_3r : signal is true;
34         attribute syn_keep of d_2r : signal is true;
35         attribute syn_keep of d_r : signal is true;
36         
37 begin
38   q_o <= data_s;
39
40 seq:
41         process
42         begin
43     wait until clk_i'event and clk_i = '1';
44                 if d_3r = d_2r and d_2r = d_r then
45                         data_s <= d_3r;
46                 end if;
47
48                 d_3r <= d_2r;
49                 d_2r <= d_r;
50                 d_r  <= d_i;
51   end process;
52
53 end behavioral;