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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [genlib/] [cdc_pulse.vhd] - Blame information for rev 24

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 wfjm
-- $Id: cdc_pulse.vhd 426 2011-11-18 18:14:08Z mueller $
2
--
3
-- Copyright 2011- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
-- 
14
------------------------------------------------------------------------------
15
-- Module Name:    cdc_pulse - syn
16
-- Description:    clock domain cross for pulse
17
--
18
-- Dependencies:   -
19
-- Test bench:     -
20
-- Target Devices: generic
21
-- Tool versions:  xst 13.1; ghdl 0.29
22
-- Revision History: 
23
-- Date         Rev Version    Comment
24
-- 2011-11-09   422   1.0      Initial version
25
-- 
26
------------------------------------------------------------------------------
27
 
28
library ieee;
29
use ieee.std_logic_1164.all;
30
 
31
use work.slvtypes.all;
32
 
33
entity cdc_pulse is                     -- clock domain cross for pulse
34
  generic (
35
    POUT_SINGLE : boolean := false;     -- if true: single cycle pout
36
    BUSY_WACK : boolean := false);      -- if true: busy waits for ack
37
  port (
38
    CLKM : in slbit;                    -- clock master
39
    RESET : in slbit := '0';            -- M|reset
40
    CLKS : in slbit;                    -- clock slave
41
    PIN : in slbit;                     -- M|pulse in
42
    BUSY : out slbit;                   -- M|busy
43
    POUT : out slbit                    -- S|pulse out
44
  );
45
end entity cdc_pulse;
46
 
47
 
48
architecture syn of cdc_pulse is
49
 
50
  signal R_REQ   : slbit := '0';
51
  signal R_REQ_C : slbit := '0';
52
  signal R_ACK   : slbit := '0';
53
  signal R_ACK_C : slbit := '0';
54
  signal R_ACK_S : slbit := '0';
55
 
56
begin
57
 
58
  proc_master: process (CLKM)
59
  begin
60
    if rising_edge(CLKM) then
61
      if RESET = '1' then
62
        R_REQ <= '0';
63
      else
64
        if PIN = '1' then
65
          R_REQ <= '1';
66
        elsif R_ACK_S = '1' then
67
          R_REQ <= '0';
68
        end if;
69
      end if;
70
      R_ACK_C <= R_ACK;
71
      R_ACK_S <= R_ACK_C;
72
    end if;
73
  end process proc_master;
74
 
75
  proc_slave: process (CLKS)
76
  begin
77
    if rising_edge(CLKS) then
78
      R_REQ_C <= R_REQ;
79
      R_ACK   <= R_REQ_C;
80
    end if;
81
  end process proc_slave;
82
 
83
  SINGLE1: if POUT_SINGLE = true generate
84
    signal R_ACK_1 : slbit := '0';
85
    signal R_POUT  : slbit := '0';
86
  begin
87
    proc_pout: process (CLKS)
88
    begin
89
      if rising_edge(CLKS) then
90
        R_ACK_1 <= R_ACK;
91
        if R_ACK='1' and R_ACK_1='0' then
92
          R_POUT <= '1';
93
        else
94
          R_POUT <= '0';
95
        end if;
96
      end if;
97
    end process proc_pout;
98
    POUT <= R_POUT;
99
  end generate SINGLE1;
100
 
101
  SINGLE0: if POUT_SINGLE = false generate
102
  begin
103
    POUT <= R_ACK;
104
  end generate SINGLE0;
105
 
106
  BUSY1: if BUSY_WACK = true generate
107
  begin
108
    BUSY <= R_REQ or R_ACK_S;
109
  end generate BUSY1;
110
 
111
  BUSY0: if BUSY_WACK = false generate
112
  begin
113
    BUSY <= R_REQ;
114
  end generate BUSY0;
115
 
116
end syn;
117
 

powered by: WebSVN 2.1.0

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