x393
1.0
FPGAcodeforElphelNC393camera
multipulse_cross_clock.v
Go to the documentation of this file.
1
44
`timescale 1ns/1ps
45
46
module
multipulse_cross_clock
#(
47
parameter
WIDTH
=
1
,
// width of the pulse counter (assign MSB of input to 0 to
48
// have more pending that possible input)
49
parameter
EXTRA_DLY
=
0
)(
// 0 or 1 - output duty cycle control
50
input
rst
,
51
input
src_clk
,
52
input
dst_clk
,
53
input
[
WIDTH
-
1
:
0
]
num_pulses
,
// single-cycle positive pulse
54
input
we
,
55
output
out_pulse
,
56
output
busy
57
);
58
reg
[
WIDTH
-
1
:
0
]
pend_cntr
=
0
;
59
wire
busy_single
;
60
wire
single_rq_w
;
61
reg
single_rq_r
=
0
;
62
63
// assign busy = busy_single && (|pend_cntr);
64
assign
busy
=
busy_single
|| (|
pend_cntr
);
65
assign
single_rq_w
= !
busy_single
&& (|
pend_cntr
);
66
67
always
@(
posedge
src_clk
)
begin
68
single_rq_r
<=
single_rq_w
;
69
if
(
rst
)
pend_cntr
<=
0
;
70
else
pend_cntr
<=
pend_cntr
+ (
we
?
num_pulses
: {
WIDTH
{
1'b0
}}) + (
single_rq_r
? {
WIDTH
{
1'b1
}}:{
WIDTH
{
1'b0
}});
71
end
72
73
pulse_cross_clock
#(
74
.
EXTRA_DLY
(
EXTRA_DLY
)
75
)
pulse_cross_clock_i
(
76
.
rst
(
rst
),
// input
77
.
src_clk
(
src_clk
),
// input
78
.
dst_clk
(
dst_clk
),
// input
79
.
in_pulse
(
single_rq_w
),
// input
80
.
out_pulse
(
out_pulse
),
// output
81
.
busy
(
busy_single
)
// output
82
);
83
84
endmodule
85
multipulse_cross_clock.10713busy
10713busy
Definition:
multipulse_cross_clock.v:56
multipulse_cross_clock.10717single_rq_r
10717single_rq_rreg
Definition:
multipulse_cross_clock.v:61
pulse_cross_clock.10722rst
10722rst
Definition:
pulse_cross_clock.v:46
pulse_cross_clock.10724dst_clk
10724dst_clk
Definition:
pulse_cross_clock.v:48
multipulse_cross_clock.10709dst_clk
10709dst_clk
Definition:
multipulse_cross_clock.v:52
pulse_cross_clock.10727busy
10727busy
Definition:
pulse_cross_clock.v:51
multipulse_cross_clock.10712out_pulse
10712out_pulse
Definition:
multipulse_cross_clock.v:55
pulse_cross_clock.10725in_pulse
10725in_pulse
Definition:
pulse_cross_clock.v:49
multipulse_cross_clock.10705WIDTH
10705WIDTH1
Definition:
multipulse_cross_clock.v:47
multipulse_cross_clock.10711we
10711we
Definition:
multipulse_cross_clock.v:54
pulse_cross_clock.10723src_clk
10723src_clk
Definition:
pulse_cross_clock.v:47
multipulse_cross_clock.10715busy_single
10715busy_singlewire
Definition:
multipulse_cross_clock.v:59
multipulse_cross_clock
Definition:
multipulse_cross_clock.v:46
multipulse_cross_clock.10708src_clk
10708src_clk
Definition:
multipulse_cross_clock.v:51
pulse_cross_clock.10726out_pulse
10726out_pulse
Definition:
pulse_cross_clock.v:50
multipulse_cross_clock.10716single_rq_w
10716single_rq_wwire
Definition:
multipulse_cross_clock.v:60
multipulse_cross_clock.10714pend_cntr
10714pend_cntrreg[WIDTH-1:0]
Definition:
multipulse_cross_clock.v:58
multipulse_cross_clock.10707rst
10707rst
Definition:
multipulse_cross_clock.v:50
multipulse_cross_clock.10706EXTRA_DLY
10706EXTRA_DLY0
Definition:
multipulse_cross_clock.v:49
multipulse_cross_clock.10710num_pulses
[WIDTH-1:0] 10710num_pulses
Definition:
multipulse_cross_clock.v:53
multipulse_cross_clock.pulse_cross_clock
pulse_cross_clock_i pulse_cross_clock
Definition:
multipulse_cross_clock.v:73
util_modules
multipulse_cross_clock.v
Generated by
1.8.12