]> rtime.felk.cvut.cz Git - fpga/rpi-motor-control.git/blob - pmsm-control/dff3.vhdl
Correct typo in rpi-mc-1 mapping to Ti AM437x based RICO board.
[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
7 -- D circuit (filtered)
8
9 entity dff3 is
10   port
11         (
12     clk_i   : in std_logic;
13     d_i     : in std_logic;
14     q_o     : out std_logic
15   );
16 end dff3;
17
18 architecture behavioral of dff3 is
19         signal d_3r   : std_logic;
20         signal d_2r   : std_logic;
21         signal d_r    : std_logic;
22         signal data_s : std_logic;
23
24         -- XST attributes
25         --potlaceni duplikace klupnych obvodu ve fazi optimalizace
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         attribute syn_keep : boolean;
32         attribute syn_keep of d_3r : signal is true;
33         attribute syn_keep of d_2r : signal is true;
34         attribute syn_keep of d_r : signal is true;
35         
36 begin
37   q_o <= data_s;
38
39 seq:
40         process
41         begin
42     wait until clk_i'event and clk_i = '1';
43                 if d_3r = d_2r and d_2r = d_r then
44                         data_s <= d_3r;
45                 end if;
46
47                 d_3r <= d_2r;
48                 d_2r <= d_r;
49                 d_r  <= d_i;
50   end process;
51
52 end behavioral;