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

Subversion Repositories xucpu

[/] [xucpu/] [trunk/] [src/] [system/] [sync_reset.vhdl] - Blame information for rev 6

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 lcdsgmtr
-- Copyright 2015, Jürgen Defurne
2
--
3
-- This file is part of the Experimental Unstable CPU System.
4
--
5
-- The Experimental Unstable CPU System Is free software: you can redistribute
6
-- it and/or modify it under the terms of the GNU Lesser General Public License
7
-- as published by the Free Software Foundation, either version 3 of the
8
-- License, or (at your option) any later version.
9
--
10
-- The Experimental Unstable CPU System is distributed in the hope that it will
11
-- be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
12
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
13
-- General Public License for more details.
14
--
15
-- You should have received a copy of the GNU Lesser General Public License
16
-- along with Experimental Unstable CPU System. If not, see
17
-- http://www.gnu.org/licenses/lgpl.txt.
18
 
19
 
20
LIBRARY IEEE;
21
USE IEEE.STD_LOGIC_1164.ALL;
22
 
23
ENTITY sync_reset IS
24
  PORT (
25
    async_rst : IN  STD_LOGIC;
26
    clk       : IN  STD_LOGIC;
27
    clk_valid : IN  STD_LOGIC;
28
    rst       : OUT STD_LOGIC);
29
END ENTITY sync_reset;
30
 
31
ARCHITECTURE Behavioral OF sync_reset IS
32
 
33
  SIGNAL count : INTEGER RANGE 0 TO 3 := 0;
34
 
35
BEGIN  -- Behavioral
36
 
37
  -- purpose: Turn asynchronous reset into synchronous reset
38
  -- type   : sequential
39
  -- inputs : clk, async_rst, clk_valid
40
  -- outputs: rst
41
  reset : PROCESS (clk)
42
  BEGIN  -- PROCESS reset
43
    IF rising_edge(clk) THEN
44
      IF clk_valid = '1' THEN
45
        IF count < 3 THEN
46
          count <= count + 1;
47
        ELSE
48
          count <= 3;
49
        END IF;
50
      ELSE
51
        count <= 0;
52
      END IF;
53
    END IF;
54
  END PROCESS reset;
55
 
56
  rst <= '1' WHEN count < 3 ELSE '0';
57
 
58
END Behavioral;

powered by: WebSVN 2.1.0

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