File: reset_synchronizer.vhd

package info (click to toggle)
bladerf 0.2022.11-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 373,752 kB
  • sloc: ansic: 1,186,428; xml: 150,799; vhdl: 24,182; tcl: 15,408; python: 3,409; sh: 1,551; makefile: 1,255; asm: 158; csh: 18; cpp: 9
file content (46 lines) | stat: -rw-r--r-- 1,457 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library ieee ;
    use ieee.std_logic_1164.all ;

entity reset_synchronizer is
  generic (
    INPUT_LEVEL     :       std_logic   := '1' ;
    OUTPUT_LEVEL    :       std_logic   := '1'
  ) ;
  port (
    clock           :   in  std_logic ;
    async           :   in  std_logic ;
    sync            :   out std_logic
  ) ;
end entity ;

architecture arch of reset_synchronizer is

    attribute ALTERA_ATTRIBUTE  : string;
    attribute PRESERVE          : boolean;

    signal reg0, reg1   : std_logic;

    attribute ALTERA_ATTRIBUTE of arch  : architecture is "-name SDC_STATEMENT ""set_false_path -to [get_registers {*reset_synchronizer:*|*}] """;
    attribute ALTERA_ATTRIBUTE of reg0  : signal is "-name SYNCHRONIZER_IDENTIFICATION ""FORCED IF ASYNCHRONOUS""";
    attribute ALTERA_ATTRIBUTE of reg1  : signal is "-name SYNCHRONIZER_IDENTIFICATION ""FORCED IF ASYNCHRONOUS""";
    attribute PRESERVE of reg0          : signal is TRUE;
    attribute PRESERVE of reg1          : signal is TRUE;
    attribute PRESERVE of sync          : signal is TRUE;

begin

    synchronize : process( clock, async )
    begin
        if( async = INPUT_LEVEL ) then
            sync <= OUTPUT_LEVEL ;
            reg0 <= OUTPUT_LEVEL ;
            reg1 <= OUTPUT_LEVEL ;
        elsif( rising_edge( clock ) ) then
            sync <= reg1 ;
            reg1 <= reg0 ;
            reg0 <= not OUTPUT_LEVEL ;
        end if ;
    end process ;

end architecture ;