rst_sync.vhd 3.05 KB
Newer Older
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
1
--------------------------------------------------------------------------------
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
2
-- 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
3
-- CTU CAN FD IP Core
4
-- Copyright (C) 2015-2018
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
5
-- 
6 7
-- Authors:
--     Ondrej Ille <ondrej.ille@gmail.com>
8
--     Martin Jerabek <martin.jerabek01@gmail.com>
9 10
-- 
-- Project advisors: 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
11 12
-- 	Jiri Novak <jnovak@fel.cvut.cz>
-- 	Pavel Pisa <pisa@cmp.felk.cvut.cz>
13
-- 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
14 15 16 17
-- Department of Measurement         (http://meas.fel.cvut.cz/)
-- Faculty of Electrical Engineering (http://www.fel.cvut.cz)
-- Czech Technical University        (http://www.cvut.cz/)
-- 
18 19 20 21 22
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this VHDL component and associated documentation files (the "Component"),
-- to deal in the Component without restriction, including without limitation
-- the rights to use, copy, modify, merge, publish, distribute, sublicense,
-- and/or sell copies of the Component, and to permit persons to whom the
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
23 24
-- Component is furnished to do so, subject to the following conditions:
-- 
25
-- The above copyright notice and this permission notice shall be included in
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
26 27
-- all copies or substantial portions of the Component.
-- 
28 29 30 31
-- THE COMPONENT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHTHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
33
-- FROM, OUT OF OR IN CONNECTION WITH THE COMPONENT OR THE USE OR OTHER DEALINGS
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
34 35
-- IN THE COMPONENT.
-- 
36 37
-- The CAN protocol is developed by Robert Bosch GmbH and protected by patents.
-- Anybody who wants to implement this IP core on silicon has to obtain a CAN
38
-- protocol license from Bosch.
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
39
-- 
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
40
--------------------------------------------------------------------------------
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
41

Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
42
--------------------------------------------------------------------------------
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
43
-- Purpose:
44
--  Asynchronous reset synchroniser.
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
45
--------------------------------------------------------------------------------
46 47
-- Revision History:
--    27.11.2017   Created file
48
--    16.11.2018   Added generic reset polarity
49 50 51 52
--------------------------------------------------------------------------------

Library ieee;
use ieee.std_logic_1164.all;
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
53 54

entity rst_sync is
55 56 57
    generic (
        constant reset_polarity     :       std_logic
    );    
58
    port (
59 60 61
        signal clk                  : in    std_logic;
        signal arst                 : in    std_logic;
        signal rst                  : out   std_logic
62
    );
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
63 64 65
end rst_sync;

architecture rtl of rst_sync is
66 67 68 69

    -- Synchroniser registers
    signal rff                      :       std_logic;

Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
70
begin
71 72

    -- Reset synchroniser process
Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
73
    rst_sync_proc : process (clk, arst)
74
    begin
75 76 77
        if (arst = reset_polarity) then
            rff     <= reset_polarity;
            rst     <= reset_polarity;
78
        elsif (rising_edge(clk)) then
79 80
            rff     <= not (reset_polarity);
            rst     <= rff;
81 82
        end if;
    end process;
83

Ille, Ondrej, Ing.'s avatar
Ille, Ondrej, Ing. committed
84
end rtl;