w11 - vhd
0.794
W11 CPU core and support modules
Loading...
Searching...
No Matches
cdc_pulse.vhd
Go to the documentation of this file.
1
-- $Id: cdc_pulse.vhd 1181 2019-07-08 17:00:50Z mueller $
2
-- SPDX-License-Identifier: GPL-3.0-or-later
3
-- Copyright 2011-2016 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
------------------------------------------------------------------------------
6
-- Module Name: cdc_pulse - syn
7
-- Description: clock domain crossing for a pulse
8
--
9
-- Dependencies: -
10
-- Test bench: -
11
-- Target Devices: generic
12
-- Tool versions: xst 13.1-14.7; viv 2015.4-2016.2; ghdl 0.29-0.33
13
-- Revision History:
14
-- Date Rev Version Comment
15
-- 2016-06-11 774 1.2 add INIT generic
16
-- 2016-03-29 756 1.1 rename regs; add ASYNC_REG attributes
17
-- 2011-11-09 422 1.0 Initial version
18
--
19
------------------------------------------------------------------------------
20
21
library
ieee
;
22
use
ieee.std_logic_1164.
all
;
23
24
use
work.
slvtypes
.
all
;
25
26
entity
cdc_pulse
is
-- clock domain cross for pulse
27
generic
(
28
POUT_SINGLE
:
boolean
:=
false
;
-- if true: single cycle pout
29
BUSY_WACK
:
boolean
:=
false
;
-- if true: busy waits for ack
30
INIT
:
slbit
:=
'
0
'
)
;
-- initial state
31
port
(
32
CLKM
:
in
slbit
;
-- M|clock master
33
RESET
:
in
slbit
:=
'
0
'
;
-- M|reset
34
CLKS
:
in
slbit
;
-- S|clock slave
35
PIN
:
in
slbit
;
-- M|pulse in
36
BUSY
:
out
slbit
;
-- M|busy
37
POUT
:
out
slbit
-- S|pulse out
38
)
;
39
end
entity
cdc_pulse
;
40
41
42
architecture
syn
of
cdc_pulse
is
43
44
signal
RM_REQ
:
slbit
:=
INIT
;
-- request active
45
signal
RS_REQ_S0
:
slbit
:=
INIT
;
-- request: CLKM->CLKS
46
signal
RS_REQ_S1
:
slbit
:=
INIT
;
-- request: CLKS->CLKS
47
signal
RM_ACK_S0
:
slbit
:=
'
0
'
;
-- acknowledge: CLKS->CLKM
48
signal
RM_ACK_S1
:
slbit
:=
'
0
'
;
-- acknowledge: CLKM->CLKM
49
50
attribute
ASYNC_REG
:
string
;
51
52
attribute
ASYNC_REG
of
RS_REQ_S0
:
signal
is
"true"
;
53
attribute
ASYNC_REG
of
RS_REQ_S1
:
signal
is
"true"
;
54
attribute
ASYNC_REG
of
RM_ACK_S0
:
signal
is
"true"
;
55
attribute
ASYNC_REG
of
RM_ACK_S1
:
signal
is
"true"
;
56
57
begin
58
59
proc_master:
process
(
CLKM
)
60
begin
61
if
rising_edge
(
CLKM
)
then
62
if
RESET
=
'
1
'
then
63
RM_REQ
<=
'
0
'
;
64
else
65
if
PIN
=
'
1
'
then
66
RM_REQ
<=
'
1
'
;
67
elsif
RM_ACK_S1
=
'
1
'
then
68
RM_REQ
<=
'
0
'
;
69
end
if
;
70
end
if
;
71
RM_ACK_S0
<=
RS_REQ_S1
;
-- synch 0: CLKS->CLKM
72
RM_ACK_S1
<=
RM_ACK_S0
;
-- synch 1: CLKM
73
end
if
;
74
end
process
proc_master
;
75
76
proc_slave:
process
(
CLKS
)
77
begin
78
if
rising_edge
(
CLKS
)
then
79
RS_REQ_S0
<=
RM_REQ
;
-- synch 0: CLKM->CLKS
80
RS_REQ_S1
<=
RS_REQ_S0
;
-- synch 1: CLKS
81
end
if
;
82
end
process
proc_slave
;
83
84
-- Note: no pulse at startup when POUT_SINGLE=true, INIT=1 and PIN=1 initially
85
SINGLE1
:
if
POUT_SINGLE
=
true
generate
86
signal
RS_ACK_1
:
slbit
:=
INIT
;
87
signal
RS_POUT
:
slbit
:=
'
0
'
;
88
begin
89
proc_pout:
process
(
CLKS
)
90
begin
91
if
rising_edge
(
CLKS
)
then
92
RS_ACK_1
<=
RS_REQ_S1
;
93
if
RS_REQ_S1
=
'
1
'
and
RS_ACK_1
=
'
0
'
then
94
RS_POUT
<=
'
1
'
;
95
else
96
RS_POUT
<=
'
0
'
;
97
end
if
;
98
end
if
;
99
end
process
proc_pout
;
100
POUT
<=
RS_POUT
;
101
end
generate
SINGLE1;
102
103
SINGLE0
:
if
POUT_SINGLE
=
false
generate
104
begin
105
POUT
<=
RS_REQ_S1
;
106
end
generate
SINGLE0;
107
108
BUSY1
:
if
BUSY_WACK
=
true
generate
109
begin
110
BUSY
<=
RM_REQ
or
RM_ACK_S1
;
111
end
generate
BUSY1;
112
113
BUSY0
:
if
BUSY_WACK
=
false
generate
114
begin
115
BUSY
<=
RM_REQ
;
116
end
generate
BUSY0;
117
118
end
syn;
119
cdc_pulse.syn
Definition:
cdc_pulse.vhd:42
cdc_pulse.syn.ASYNC_REG
string ASYNC_REG
Definition:
cdc_pulse.vhd:50
cdc_pulse.syn.RS_REQ_S1
slbit := INIT RS_REQ_S1
Definition:
cdc_pulse.vhd:46
cdc_pulse.syn.RM_ACK_S0
slbit := '0' RM_ACK_S0
Definition:
cdc_pulse.vhd:47
cdc_pulse.syn.RM_REQ
slbit := INIT RM_REQ
Definition:
cdc_pulse.vhd:44
cdc_pulse.syn.RS_ACK_1
slbit := INIT RS_ACK_1
Definition:
cdc_pulse.vhd:86
cdc_pulse.syn.RS_POUT
slbit := '0' RS_POUT
Definition:
cdc_pulse.vhd:87
cdc_pulse.syn.RM_ACK_S1
slbit := '0' RM_ACK_S1
Definition:
cdc_pulse.vhd:48
cdc_pulse.syn.RS_REQ_S0
slbit := INIT RS_REQ_S0
Definition:
cdc_pulse.vhd:45
cdc_pulse
Definition:
cdc_pulse.vhd:26
cdc_pulse.CLKM
in CLKM slbit
Definition:
cdc_pulse.vhd:32
cdc_pulse.BUSY
out BUSY slbit
Definition:
cdc_pulse.vhd:36
cdc_pulse.POUT
out POUT slbit
Definition:
cdc_pulse.vhd:38
cdc_pulse.CLKS
in CLKS slbit
Definition:
cdc_pulse.vhd:34
cdc_pulse.PIN
in PIN slbit
Definition:
cdc_pulse.vhd:35
cdc_pulse.INIT
INIT slbit := '0'
Definition:
cdc_pulse.vhd:30
cdc_pulse.BUSY_WACK
BUSY_WACK boolean := false
Definition:
cdc_pulse.vhd:29
cdc_pulse.RESET
in RESET slbit := '0'
Definition:
cdc_pulse.vhd:33
cdc_pulse.POUT_SINGLE
POUT_SINGLE boolean := false
Definition:
cdc_pulse.vhd:28
slvtypes
Definition:
slvtypes.vhd:28
slvtypes.slbit
std_logic slbit
Definition:
slvtypes.vhd:30
vlib
cdclib
cdc_pulse.vhd
Generated on Thu Feb 9 2023 12:41:05 for w11 - vhd by
1.9.6