x393
1.0
FPGAcodeforElphelNC393camera
simul_clk_mult.v
Go to the documentation of this file.
1
39
`timescale 1ns/1ps
40
41
module
simul_clk_mult
#(
42
parameter
MULTIPLIER
=
3
,
43
parameter
SKIP_FIRST
=
5
44
) (
45
input
clk_in
,
46
input
en
,
47
output
clk_out
48
);
49
real
phase
;
50
real
prev_phase
=
0.0
;
51
real
out_half_period
=
0.0
;
52
integer
num_period
=
0
;
53
reg
en1
=
0
;
54
reg
clk_out_r
=
0
;
55
assign
clk_out
= (
MULTIPLIER
==
1
)?
clk_in
:
clk_out_r
;
56
always
@ (
posedge
clk_in
)
begin
57
phase
=
$realtime
;
58
if
(
num_period
>=
SKIP_FIRST
)
begin
59
out_half_period
= (
phase
-
prev_phase
) / (
2
*
MULTIPLIER
);
60
en1
=
1
;
61
end
62
prev_phase
=
phase
;
63
num_period
=
num_period
+
1
;
64
end
65
66
always
@ (
posedge
clk_in
)
if
(
en
&&
en1
)
begin
67
clk_out_r
=
1
;
68
repeat
(
MULTIPLIER
-
1
)
begin
69
#
out_half_period
clk_out_r
=
0
;
70
#
out_half_period
clk_out_r
=
1
;
71
end
72
#
out_half_period
clk_out_r
=
0
;
73
end
74
75
endmodule
76
simul_clk_mult.9202num_period
9202num_periodinteger
Definition:
simul_clk_mult.v:52
simul_clk_mult.9197en
9197en
Definition:
simul_clk_mult.v:46
simul_clk_mult.9195SKIP_FIRST
9195SKIP_FIRST5
Definition:
simul_clk_mult.v:43
simul_clk_mult.9196clk_in
9196clk_in
Definition:
simul_clk_mult.v:45
simul_clk_mult.9203en1
9203en1reg
Definition:
simul_clk_mult.v:53
simul_clk_mult.9201out_half_period
9201out_half_periodreal
Definition:
simul_clk_mult.v:51
simul_clk_mult.9199phase
9199phasereal
Definition:
simul_clk_mult.v:49
simul_clk_mult.9204clk_out_r
9204clk_out_rreg
Definition:
simul_clk_mult.v:54
simul_clk_mult.9194MULTIPLIER
9194MULTIPLIER3
Definition:
simul_clk_mult.v:42
simul_clk_mult.9198clk_out
9198clk_out
Definition:
simul_clk_mult.v:47
simul_clk_mult.9200prev_phase
9200prev_phasereal
Definition:
simul_clk_mult.v:50
simul_clk_mult
Definition:
simul_clk_mult.v:41
simulation_modules
simul_clk_mult.v
Generated by
1.8.12