OpenCores
URL https://opencores.org/ocsvn/spacewire_light/spacewire_light/trunk

Subversion Repositories spacewire_light

[/] [spacewire_light/] [trunk/] [rtl/] [vhdl/] [syncdff.vhd] - Blame information for rev 10

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 jorisvr
--
2
--  Double flip-flop synchronizer.
3
--
4
--  This entity is used to safely capture asynchronous signals.
5
--
6
--  An implementation may assign additional constraints to this entity
7
--  in order to reduce the probability of meta-stability issues.
8
--  For example, an extra tight timing constraint could be placed on
9
--  the data path from syncdff_ff1 to syncdff_ff2 to ensure that
10
--  meta-stability of ff1 is resolved before ff2 captures the signal.
11
--
12
 
13
library ieee;
14
use ieee.std_logic_1164.all;
15
 
16
entity syncdff is
17
 
18
    port (
19
        clk:        in  std_logic;          -- clock (destination domain)
20
        rst:        in  std_logic;          -- asynchronous reset, active-high
21
        di:         in  std_logic;          -- input data
22
        do:         out std_logic           -- output data
23
    );
24
 
25
    -- Turn off register replication in XST.
26
    attribute REGISTER_DUPLICATION: string;
27
    attribute REGISTER_DUPLICATION of syncdff: entity is "NO";
28
 
29
end entity syncdff;
30
 
31
architecture syncdff_arch of syncdff is
32
 
33
    -- flip-flops
34
    signal syncdff_ff1: std_ulogic := '0';
35
    signal syncdff_ff2: std_ulogic := '0';
36
 
37
    -- Turn of shift-register extraction in XST.
38
    attribute SHIFT_EXTRACT: string;
39
    attribute SHIFT_EXTRACT of syncdff_ff1: signal is "NO";
40
    attribute SHIFT_EXTRACT of syncdff_ff2: signal is "NO";
41
 
42
    -- Tell XST to place both flip-flops in the same slice.
43
    attribute RLOC: string;
44
    attribute RLOC of syncdff_ff1: signal is "X0Y0";
45
    attribute RLOC of syncdff_ff2: signal is "X0Y0";
46
 
47
    -- Tell XST to keep the flip-flop net names to be used in timing constraints.
48
    attribute KEEP: string;
49
    attribute KEEP of syncdff_ff1: signal is "SOFT";
50
    attribute KEEP of syncdff_ff2: signal is "SOFT";
51
 
52
begin
53
 
54
    -- second flip-flop drives the output signal
55
    do <= syncdff_ff2;
56
 
57
    process (clk, rst) is
58
    begin
59
        if rst = '1' then
60
            -- asynchronous reset
61
            syncdff_ff1 <= '0';
62
            syncdff_ff2 <= '0';
63
        elsif rising_edge(clk) then
64
            -- data synchronization
65
            syncdff_ff1 <= di;
66
            syncdff_ff2 <= syncdff_ff1;
67
        end if;
68
    end process;
69
 
70
end architecture syncdff_arch;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.